Get program name by prcode
This commit is contained in:
parent
d4c6ccdce3
commit
9ee5dbc956
@ -33,7 +33,7 @@ class HonAppliance:
|
|||||||
try:
|
try:
|
||||||
self._extra = importlib.import_module(
|
self._extra = importlib.import_module(
|
||||||
f"pyhon.appliances.{self.appliance_type.lower()}"
|
f"pyhon.appliances.{self.appliance_type.lower()}"
|
||||||
).Appliance()
|
).Appliance(self)
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
self._extra = None
|
self._extra = None
|
||||||
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
class Appliance:
|
class Appliance:
|
||||||
|
def __init__(self, appliance):
|
||||||
|
self.parent = appliance
|
||||||
|
|
||||||
def data(self, data):
|
def data(self, data):
|
||||||
if data["attributes"]["lastConnEvent"]["category"] == "DISCONNECTED":
|
if data["attributes"]["lastConnEvent"]["category"] == "DISCONNECTED":
|
||||||
data["attributes"]["parameters"]["machMode"] = "0"
|
data["attributes"]["parameters"]["machMode"] = "0"
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
class Appliance:
|
class Appliance:
|
||||||
|
def __init__(self, appliance):
|
||||||
|
self.parent = appliance
|
||||||
|
|
||||||
def data(self, data):
|
def data(self, data):
|
||||||
if data["attributes"]["lastConnEvent"]["category"] == "DISCONNECTED":
|
if data["attributes"]["lastConnEvent"]["category"] == "DISCONNECTED":
|
||||||
data["attributes"]["parameters"]["temp"] = "0"
|
data["attributes"]["parameters"]["temp"] = "0"
|
||||||
|
@ -2,11 +2,16 @@ from pyhon.parameter.fixed import HonParameterFixed
|
|||||||
|
|
||||||
|
|
||||||
class Appliance:
|
class Appliance:
|
||||||
|
def __init__(self, appliance):
|
||||||
|
self.parent = appliance
|
||||||
|
|
||||||
def data(self, data):
|
def data(self, data):
|
||||||
if data["attributes"]["lastConnEvent"]["category"] == "DISCONNECTED":
|
if data["attributes"]["lastConnEvent"]["category"] == "DISCONNECTED":
|
||||||
data["attributes"]["parameters"]["machMode"] = "0"
|
data["attributes"]["parameters"]["machMode"] = "0"
|
||||||
data["active"] = bool(data.get("attributes", {}).get("activity"))
|
data["active"] = bool(data.get("attributes", {}).get("activity"))
|
||||||
data["pause"] = data["attributes"]["parameters"]["machMode"] == "3"
|
data["pause"] = data["attributes"]["parameters"]["machMode"] == "3"
|
||||||
|
program = int(data["attributes"]["parameters"]["prCode"])
|
||||||
|
data["programName"] = self.parent.settings["startProgram.program"].ids[program]
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def settings(self, settings):
|
def settings(self, settings):
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
class Appliance:
|
class Appliance:
|
||||||
|
def __init__(self, appliance):
|
||||||
|
self.parent = appliance
|
||||||
|
|
||||||
def data(self, data):
|
def data(self, data):
|
||||||
if data["attributes"]["lastConnEvent"]["category"] == "DISCONNECTED":
|
if data["attributes"]["lastConnEvent"]["category"] == "DISCONNECTED":
|
||||||
data["attributes"]["parameters"]["machMode"] = "0"
|
data["attributes"]["parameters"]["machMode"] = "0"
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
class Appliance:
|
class Appliance:
|
||||||
|
def __init__(self, appliance):
|
||||||
|
self.parent = appliance
|
||||||
|
|
||||||
def data(self, data):
|
def data(self, data):
|
||||||
if data["attributes"]["lastConnEvent"]["category"] == "DISCONNECTED":
|
if data["attributes"]["lastConnEvent"]["category"] == "DISCONNECTED":
|
||||||
data["attributes"]["parameters"]["machMode"] = "0"
|
data["attributes"]["parameters"]["machMode"] = "0"
|
||||||
|
@ -31,3 +31,12 @@ class HonParameterProgram(HonParameterEnum):
|
|||||||
def values(self) -> List[str]:
|
def values(self) -> List[str]:
|
||||||
values = [v for v in self._programs if all(f not in v for f in self._FILTER)]
|
values = [v for v in self._programs if all(f not in v for f in self._FILTER)]
|
||||||
return sorted(values)
|
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 New Issue
Block a user