mirror of
https://github.com/RichieCahill/dotfiles.git
synced 2026-04-17 04:58:19 -04:00
fix treefmt issues
This commit is contained in:
@@ -20,6 +20,7 @@ class HeaterController:
|
|||||||
"""Controls a Tuya heater device via local network."""
|
"""Controls a Tuya heater device via local network."""
|
||||||
|
|
||||||
def __init__(self, config: DeviceConfig) -> None:
|
def __init__(self, config: DeviceConfig) -> None:
|
||||||
|
"""Initialize the controller."""
|
||||||
self.device = tinytuya.Device(config.device_id, config.ip, config.local_key)
|
self.device = tinytuya.Device(config.device_id, config.ip, config.local_key)
|
||||||
self.device.set_version(config.version)
|
self.device.set_version(config.version)
|
||||||
self.device.set_socketTimeout(0.5)
|
self.device.set_socketTimeout(0.5)
|
||||||
@@ -45,7 +46,7 @@ class HeaterController:
|
|||||||
def turn_on(self) -> ActionResult:
|
def turn_on(self) -> ActionResult:
|
||||||
"""Turn heater on."""
|
"""Turn heater on."""
|
||||||
try:
|
try:
|
||||||
self.device.set_value(DPS_POWER, True)
|
self.device.set_value(index=DPS_POWER, value=True)
|
||||||
return ActionResult(success=True, action="on", power=True)
|
return ActionResult(success=True, action="on", power=True)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
logger.exception("Failed to turn on")
|
logger.exception("Failed to turn on")
|
||||||
@@ -54,7 +55,7 @@ class HeaterController:
|
|||||||
def turn_off(self) -> ActionResult:
|
def turn_off(self) -> ActionResult:
|
||||||
"""Turn heater off."""
|
"""Turn heater off."""
|
||||||
try:
|
try:
|
||||||
self.device.set_value(DPS_POWER, False)
|
self.device.set_value(index=DPS_POWER, value=False)
|
||||||
return ActionResult(success=True, action="off", power=False)
|
return ActionResult(success=True, action="off", power=False)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
logger.exception("Failed to turn off")
|
logger.exception("Failed to turn off")
|
||||||
|
|||||||
@@ -11,9 +11,9 @@
|
|||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
PYTHONPATH = "${inputs.self}/";
|
PYTHONPATH = "${inputs.self}/";
|
||||||
};
|
};
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
|
|||||||
Reference in New Issue
Block a user