Kan du gjøre noe tilsvarende dette?
registered_triggers = []
factory_apps = []
@time_trigger('startup')
def heating_startup():
for app in pyscript.app_config:
factory_apps.append(ClassComfortTemperature(app))
class ClassComfortTemperature:
def __init__(self, config):
self.cfg = config
@state_trigger(f"{self.cfg['input']}", state_hold=self.cfg['delay'])
def new_status(value=None):
task.unique(f"comforttempe_{self.cfg['input']}")
tl = float(state.get(f"{self.cfg['output']}.target_temp_low"))
th = float(state.get(f"{self.cfg['output']}.target_temp_high"))
if value == "off":
climate.set_temperature(entity_id = self.cfg['output'], target_temp_high = int(th - float(self.cfg['temperature'])), target_temp_low = int(tl))
log.info('Setter ned temperatur')
else:
climate.set_temperature(entity_id = self.cfg['output'], target_temp_high = int(th + float(self.cfg['temperature'])), target_temp_low = int(tl))
log.info('Setter opp temperatur')
registered_triggers.append(new_status)
Reference — hacs-pyscript 1.3.3 documentation