2023-04-08 07:36:36 +05:30
|
|
|
from pyhon.parameter import HonParameterEnum
|
|
|
|
|
|
|
|
|
|
|
|
class Appliance:
|
2023-04-10 00:59:29 +05:30
|
|
|
_FILTERS = {
|
|
|
|
"default": "^(?!iot_(?:recipe|guided))\\S+$",
|
|
|
|
"recipe": "iot_recipe_",
|
|
|
|
"guided": "iot_guided_",
|
|
|
|
}
|
|
|
|
|
2023-04-08 07:36:36 +05:30
|
|
|
def __init__(self):
|
2023-04-10 00:59:29 +05:30
|
|
|
filters = list(self._FILTERS.values())
|
|
|
|
data = {"defaultValue": filters[0], "enumValues": filters}
|
2023-04-08 07:36:36 +05:30
|
|
|
self._program_filter = HonParameterEnum("program_filter", data)
|
|
|
|
|
|
|
|
def data(self, data):
|
|
|
|
return data
|
|
|
|
|
|
|
|
def settings(self, settings):
|
|
|
|
settings["program_filter"] = self._program_filter
|
2023-04-10 00:59:29 +05:30
|
|
|
value = self._FILTERS[self._program_filter.value]
|
|
|
|
settings["startProgram.program"].filter = value
|
2023-04-08 07:36:36 +05:30
|
|
|
return settings
|