mirror of
https://github.com/Andre0512/pyhOn.git
synced 2024-01-19 02:50:44 +00:00
Get program name by prcode
This commit is contained in:
parent
d4c6ccdce3
commit
9ee5dbc956
|
@ -33,7 +33,7 @@ class HonAppliance:
|
|||
try:
|
||||
self._extra = importlib.import_module(
|
||||
f"pyhon.appliances.{self.appliance_type.lower()}"
|
||||
).Appliance()
|
||||
).Appliance(self)
|
||||
except ModuleNotFoundError:
|
||||
self._extra = None
|
||||
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
class Appliance:
|
||||
def __init__(self, appliance):
|
||||
self.parent = appliance
|
||||
|
||||
def data(self, data):
|
||||
if data["attributes"]["lastConnEvent"]["category"] == "DISCONNECTED":
|
||||
data["attributes"]["parameters"]["machMode"] = "0"
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
class Appliance:
|
||||
def __init__(self, appliance):
|
||||
self.parent = appliance
|
||||
|
||||
def data(self, data):
|
||||
if data["attributes"]["lastConnEvent"]["category"] == "DISCONNECTED":
|
||||
data["attributes"]["parameters"]["temp"] = "0"
|
||||
|
|
|
@ -2,11 +2,16 @@ from pyhon.parameter.fixed import HonParameterFixed
|
|||
|
||||
|
||||
class Appliance:
|
||||
def __init__(self, appliance):
|
||||
self.parent = appliance
|
||||
|
||||
def data(self, data):
|
||||
if data["attributes"]["lastConnEvent"]["category"] == "DISCONNECTED":
|
||||
data["attributes"]["parameters"]["machMode"] = "0"
|
||||
data["active"] = bool(data.get("attributes", {}).get("activity"))
|
||||
data["pause"] = data["attributes"]["parameters"]["machMode"] == "3"
|
||||
program = int(data["attributes"]["parameters"]["prCode"])
|
||||
data["programName"] = self.parent.settings["startProgram.program"].ids[program]
|
||||
return data
|
||||
|
||||
def settings(self, settings):
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
class Appliance:
|
||||
def __init__(self, appliance):
|
||||
self.parent = appliance
|
||||
|
||||
def data(self, data):
|
||||
if data["attributes"]["lastConnEvent"]["category"] == "DISCONNECTED":
|
||||
data["attributes"]["parameters"]["machMode"] = "0"
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
class Appliance:
|
||||
def __init__(self, appliance):
|
||||
self.parent = appliance
|
||||
|
||||
def data(self, data):
|
||||
if data["attributes"]["lastConnEvent"]["category"] == "DISCONNECTED":
|
||||
data["attributes"]["parameters"]["machMode"] = "0"
|
||||
|
|
|
@ -31,3 +31,12 @@ class HonParameterProgram(HonParameterEnum):
|
|||
def values(self) -> List[str]:
|
||||
values = [v for v in self._programs if all(f not in v for f in self._FILTER)]
|
||||
return sorted(values)
|
||||
|
||||
@property
|
||||
def ids(self):
|
||||
values = {
|
||||
int(p.parameters["prCode"].value): n
|
||||
for i, (n, p) in enumerate(self._programs.items())
|
||||
if "iot_" not in n and p.parameters.get("prCode")
|
||||
}
|
||||
return dict(sorted(values.items()))
|
||||
|
|
Loading…
Reference in a new issue