Example #1
0
    def __init__(self,
                 device,
                 id='thermostat',
                 name='thermostat',
                 type_='thermostat',
                 retain=True,
                 qos=1):
        super().__init__(device, id, name, type_, retain, qos)

        self.add_property(
            Property_Float(self,
                           'current-temp',
                           'Current Temp',
                           settable=False,
                           unit='ºC'))
        self.add_property(
            Property_Float(self,
                           'setpoint-temp',
                           'Setpoint Temp',
                           unit='ºC',
                           set_value=self.set_setpoint_temp))
        self.add_property(
            Property_Enum(self,
                          'setpoint-mode',
                          'Setpoint Mode',
                          data_format="auto,manual,away,hwb",
                          set_value=self.set_setpoint_mode))
        self.add_property(
            Property_Enum(self,
                          'system-mode',
                          'System Mode',
                          data_format="winter,summer,frostguard",
                          set_value=self.set_system_mode))
        self.add_property(Property_Battery(self))
Example #2
0
    def __init__(self,
                 isy_device=None,
                 homie_settings=None,
                 mqtt_settings=None):

        Base.__init__(self, isy_device)

        Device_Base.__init__(
            self,
            self.get_homie_device_id(),
            isy_device.name,
            homie_settings,
            mqtt_settings,
        )

        node = Node_Base(self, "program", "Program", "program")
        self.add_node(node)

        self.status = Property_String(node, "status", "Status")
        node.add_property(self.status)

        self.run = Property_Enum(
            node,
            id="run",
            name="Run Program",
            data_format="RUNIF,RUNTHEN,RUNELSE,STOP",
            set_value=self.set_run_program,
        )
        node.add_property(self.run)

        self.start()
Example #3
0
    def __init__(self, device, id='state', name='State', type_='state', retain=True, qos=1, state_values=None,set_state=None): 
        assert (state_values)
        assert (set_state)

        super().__init__(device,id,name,type_,retain,qos)

        self.add_property (Property_Enum (self,'state','State',data_format=state_values,set_value=set_state))
Example #4
0
    def __init__(
        self,
        device,
        id="camera",
        name="Camera",
        type_="camera",
        retain=True,
        qos=1,
    ):

        super().__init__(device, id, name, type_, retain, qos)

        # important functions we need for the button to work
        assert self.shutter_button
        assert self.shutter_timer
        assert Node_Camera.BUTTON_STATES
        assert Node_Camera.SUPPRESSION_TIMEOUT

        # we need the Node_Image
        self.image = device.get_node('recent-image')
        assert self.image
        assert self.image.update_recent_image
        assert self.image.new_file

        self.device = device
        # camera resolution settings
        self.x_res = self.device.device_settings['camera_x_res']
        self.y_res = self.device.device_settings['camera_y_res']

        self.button_push_time = 0
        # button's default value is 'release'
        self.button = Property_Enum(
            node=self,
            id="shutter-button",
            name="Shutter Button",
            data_format=Node_Camera.BUTTON_STATES,
            set_value=self.shutter_button,
            value='release',
        )
        self.add_property(self.button)

        # timer's default value is 0, unit is milliseconds
        self.timer = Property_Integer(
            node=self,
            id='shutter-timer',
            name='Shutter Timer',
            unit='ms',
            data_format='0:10000',
            set_value=self.shutter_timer,
            value=0,
        )
        self.add_property(self.timer)

        # camera subscribes on scanner/apparatus/cameras/shutter-button
        self.device.add_subscription(
            topic='scanner/apparatus/cameras/shutter-button',
            handler=self.scanner_shutter_button)
Example #5
0
    def __init__(
        self,
        device,
        id="recent-images",
        name="All recent images",
        type_="file",
        retain=True,
        qos=1,
    ):

        super().__init__(device, id, name, type_, retain, qos)

        # important function we need
        assert self.save_all
        assert Node_RecentImages.RUN_STATES

        self.device = device

        # create image storage location must exist
        self.img_dir = os.path.expanduser(
            self.device.device_settings['img_dir'])
        os.makedirs(self.img_dir, mode=0o755, exist_ok=True)
        assert os.path.isdir(self.img_dir)
        # temp directory to store retrieved images in json format
        self.img_tmp_dir = os.path.expanduser(
            self.device.device_settings['img_tmp_dir'])
        os.makedirs(self.img_tmp_dir, mode=0o755, exist_ok=True)
        assert os.path.isdir(self.img_tmp_dir)
        """scanner/apparatus/recent-images/save-all"""
        # function's default state is 'idle'
        self.prop_save_all = Property_Enum(
            node=self,
            id="save-all",
            name="Save all images",
            data_format=Node_RecentImages.RUN_STATES,
            set_value=self.save_all,
            value='idle',
        )
        self.current_run_state = self.prop_save_all.value
        self.add_property(self.prop_save_all)
        """
        scanner/apparatus/recent-images/last-saved
        scanner/apparatus/recent-images/image-count
        """
        self.last_saved = Property_DateTime(
            node=self,
            id='last-saved',
            name='Most recent image date',
            data_format='%Y-%m-%dT%H:%M:%S.000',
        )
        self.image_count = Property_Integer(node=self,
                                            id='image-count',
                                            name='Count of saved images',
                                            settable=False)

        self.add_property(self.image_count)
        self.add_property(self.last_saved)
Example #6
0
    def __init__(self,
                 device_id=None,
                 name=None,
                 homie_settings=None,
                 mqtt_settings=None,
                 set_lift_mode=None):

        super().__init__(device_id, name, homie_settings, mqtt_settings)

        node = (Node_Base(self, 'boatlift', 'Boat Lift', 'boatlift'))
        self.add_node(node)

        self.set_lift_mode = Property_Enum(
            node,
            id='setliftmode',
            name='Set Lift Mode',
            data_format=','.join(LIFT_MODES),
            set_value=lambda value: set_lift_mode(value))
        node.add_property(self.set_lift_mode)

        self.lift_mode = Property_String(node, id='liftmode', name='Lift Mode')
        node.add_property(self.lift_mode)

        self.lift_position = Property_String(node,
                                             id='position',
                                             name='Position')
        node.add_property(self.lift_position)

        self.lift_height = Property_String(node, id='height', name='Height')
        node.add_property(self.lift_height)

        self.lift_roll = Property_String(node, id='roll', name='Roll')
        node.add_property(self.lift_roll)

        self.lift_pitch = Property_String(node, id='pitch', name='Pitch')
        node.add_property(self.lift_pitch)

        self.valves = Property_String(node, id='valves', name='Valves')
        node.add_property(self.valves)

        self.water_temp = Property_Temperature(node,
                                               id='watertemp',
                                               name='Water Temp',
                                               unit='C')
        node.add_property(self.water_temp)

        self.mode_run_time = Property_String(node,
                                             id='moderuntime',
                                             name='Mode Run Time')
        node.add_property(self.mode_run_time)

        self.start()
Example #7
0
    def __init__(
                self, 
                device_id=None, 
                name=None, 
                homie_settings=None, 
                mqtt_settings=None,
                device_comfoairq=None,
                connect_at_start=True,

    ):
        assert device_id
        assert name
        assert device_comfoairq
        assert mqtt_settings
        super().__init__ (device_id, name, homie_settings, mqtt_settings)

        self.device_comfoairq=device_comfoairq
# Gateway Controls
        node = Node_Base(self,'controls','ComfoAirQ Gateway Controls','controls')
        self.add_node (node)

        node.add_property(Property_Switch(node,id='stayconnected',name = 'Stay connected to Comfoconnect' ,settable = True, set_value=self.set_stay_connected))

        node.add_property(Property_Switch(node,id='reload',name = 'Publish Homie Devices' ,settable = True, set_value=self.set_reload))

        node = Node_Base(self,'sensors','ComfoAirQ Gateway Sensors','sensors')
        self.add_node (node)



        node.add_property (Property_Enum (node,id='state',name = 'Connection state',settable = False,data_format=','.join(DEVICE_STATES)))

        if self.device_comfoairq is not None:
            self.device_comfoairq.comfoairq.add_on_state_change_callback(self.publish_connection_status)
        
        global repeating_timer
        if repeating_timer == None:
            repeating_timer = Repeating_Timer(
                self.homie_settings["update_interval"]
            )

        repeating_timer.add_callback(self.publish_connection_status)

        self.start()
        if connect_at_start:
            self.set_stay_connected("ON")

        self.publish_connection_status()
 def __init__(self,
              device,
              node_id,
              name,
              type_="next_check",
              retain=True,
              qos=1):
     '''
     Constructor
     '''
     super().__init__(device, node_id, name, type_, retain, qos)
     self.add_property(
         Property_String(self, "checkobject",
                         f"Zu prüfendes Objekt {node_id}"))
     self.add_property(
         Property_DateTime(
             self, "nextcheck",
             f"Nächste Prüfung ({node_id})"))  ## TODO: make settable
     self.add_property(
         Property_String(self, "instruction",
                         f"Wartungsanleitung {node_id}"))
     self.add_property(
         Property_Integer(self,
                          'prewarntime',
                          f'Vorwarnzeit {node_id}',
                          unit='hours',
                          settable=False))
     self.add_property(
         Property_Enum(self,
                       "expiration",
                       f"Fälligkeit ({node_id})",
                       settable=False,
                       data_format="Valid,Expired,Due_Soon")
     )  # TODO: Clarify, if a state for failed check shall be added here
     self.add_property(
         Property_Boolean(self,
                          "passed",
                          f"Prüfung Bestanden ({node_id})",
                          settable=False))
Example #9
0
    def __init__(
        self,
        device,
        id="state",
        name="State",
        type_="state",
        retain=True,
        qos=1,
        state_values=None,
        set_state=None,
    ):
        assert state_values
        assert set_state

        super().__init__(device, id, name, type_, retain, qos)

        self.add_property(
            Property_Enum(self,
                          "state",
                          "State",
                          data_format=state_values,
                          set_value=set_state))
Example #10
0
    def __init__(self,
                 isy_device=None,
                 homie_settings=None,
                 mqtt_settings=None):

        Base.__init__(self, isy_device)

        Device_Base.__init__(self, self.get_homie_device_id(), isy_device.name,
                             homie_settings, mqtt_settings)

        node = (Node_Base(self, 'program', 'Program', 'program'))
        self.add_node(node)

        self.status = Property_String(node, 'status', 'Status')
        node.add_property(self.status)

        self.run = Property_Enum(node,
                                 id='run',
                                 name='Run Program',
                                 data_format='RUNIF,RUNTHEN,RUNELSE,STOP',
                                 set_value=self.set_run_program)
        node.add_property(self.run)

        self.start()
Example #11
0
    def __init__(self,
                 atag: AtagDataStore,
                 eventloop,
                 device_id="atagone",
                 name=None):
        """Create an ATAG ONE device."""
        super().__init__(device_id, name, TRANSLATED_HOMIE_SETTINGS,
                         TRANSLATED_MQTT_SETTINGS)
        self._eventloop = eventloop
        self.atag: AtagDataStore = atag
        self.temp_unit = "°C"

        node = (Node_Base(self, 'burner', 'Burner', 'status'))
        self.add_node(node)

        self.burner_modulation = Property_Integer(node,
                                                  id="modulation",
                                                  name="Burner modulation",
                                                  settable=False)
        node.add_property(self.burner_modulation)

        self.burner_target = Property_Enum(node,
                                           id="target",
                                           name="Burner target",
                                           settable=False,
                                           data_format="none,ch,dhw")
        node.add_property(self.burner_target)

        # Central heating status properties
        node = (Node_Base(self, 'centralheating', 'Central heating', 'status'))
        self.add_node(node)

        self.ch_status = Property_Boolean(node,
                                          id="status",
                                          name="CH status",
                                          settable=False)
        node.add_property(self.ch_status)

        self.ch_temperature = Property_Temperature(node,
                                                   id="temperature",
                                                   name="CH temperature",
                                                   settable=False,
                                                   value=self.atag.temperature)
        node.add_property(self.ch_temperature)

        self.ch_water_temperature = Property_Temperature(
            node,
            id="water-temperature",
            name="CH water temperature",
            settable=False,
            value=self.atag.sensordata['ch_water_temp'].get('state', 0))
        node.add_property(self.ch_water_temperature)

        self.ch_target_water_temperature = Property_Temperature(
            node,
            id="target-water-temperature",
            name="CH target water temperature",
            settable=False,
            value=self.atag.sensordata['ch_setpoint'].get('state', 0))
        node.add_property(self.ch_target_water_temperature)

        self.ch_return_water_temperature = Property_Temperature(
            node,
            id="return-water-temperature",
            name="CH return water temperature",
            settable=False,
            value=self.atag.sensordata['ch_return_temp'].get('state', 0))
        node.add_property(self.ch_return_water_temperature)

        self.ch_water_pressure = Property_Float(
            node,
            id="water-pressure",
            name="CH water pressure",
            settable=False,
            value=self.atag.sensordata['ch_water_pres'].get('state', 0))
        node.add_property(self.ch_water_pressure)

        # Domestic hot water status properties
        node = (Node_Base(self, 'domestichotwater', 'Domestic hot water',
                          'status'))
        self.add_node(node)

        self.dhw_status = Property_Boolean(node,
                                           id="status",
                                           name="DHW status",
                                           settable=False)
        node.add_property(self.dhw_status)

        self.dhw_temperature = Property_Temperature(
            node,
            id="temperature",
            name="DHW temperature",
            settable=False,
            value=self.atag.dhw_temperature)
        node.add_property(self.dhw_temperature)

        node = (Node_Base(self, 'weather', 'Weather', 'status'))
        self.add_node(node)

        self.weather_temperature = Property_Temperature(
            node,
            id="temperature",
            name="Weather temperature",
            settable=False,
            value=self.atag.sensordata['weather_temp'].get('state', 0))
        node.add_property(self.weather_temperature)

        # Control properties
        node = (Node_Base(self, 'controls', 'Controls', 'controls'))
        self.add_node(node)

        ch_min_temp = 12
        ch_max_temp = 25
        ch_target_temperature_limits = f'{ch_min_temp}:{ch_max_temp}'
        self.ch_target_temperature = Property_Setpoint(
            node,
            id='ch-target-temperature',
            name='CH Target temperature',
            data_format=ch_target_temperature_limits,
            unit=self.temp_unit,
            value=self.atag.target_temperature,
            set_value=self.set_ch_target_temperature)
        node.add_property(self.ch_target_temperature)

        dhw_min_temp = self.atag.dhw_min_temp
        dhw_max_temp = self.atag.dhw_max_temp
        dhw_target_temperature_limits = f'{dhw_min_temp}:{dhw_max_temp}'
        self.dhw_target_temperature = Property_Setpoint(
            node,
            id='dhw-target-temperature',
            name='DHW Target temperature',
            data_format=dhw_target_temperature_limits,
            unit=self.temp_unit,
            value=self.atag.dhw_target_temperature,
            set_value=self.set_dhw_target_temperature)
        node.add_property(self.dhw_target_temperature)

        hvac_values = "auto,heat"
        self.hvac_mode = Property_Enum(node,
                                       id='hvac-mode',
                                       name='HVAC mode',
                                       data_format=hvac_values,
                                       value=self.atag.hvac_mode,
                                       set_value=self.set_hvac_mode)
        node.add_property(self.hvac_mode)

        self.start()
Example #12
0
    def __init__(
        self,
        device_id=None,
        name=None,
        homie_settings=None,
        mqtt_settings=None,
        thermostat_settings=THERMOSTAT_SETTINGS,
    ):

        super().__init__(device_id, name, homie_settings, mqtt_settings)

        node = Node_Base(self, "controls", "Controls", "controls")
        self.add_node(node)

        if "heat_setpoint" in thermostat_settings:
            heat_setpt_limits = "{}:{}".format(
                thermostat_settings["min_heat_setpoint"],
                thermostat_settings["max_heat_setpoint"],
            )
            self.heat_setpoint = Property_Setpoint(
                node,
                id="heatsetpoint",
                name="Heat Setpoint",
                data_format=heat_setpt_limits,
                unit=thermostat_settings["units"],
                value=thermostat_settings["heat_setpoint"],
                set_value=self.set_heat_setpoint,
            )
            node.add_property(self.heat_setpoint)

        if "cool_setpoint" in thermostat_settings:
            cool_setpt_limits = "{}:{}".format(
                thermostat_settings["min_cool_setpoint"],
                thermostat_settings["max_cool_setpoint"],
            )
            self.cool_setpoint = Property_Setpoint(
                node,
                id="coolsetpoint",
                name="Cool Setpoint",
                data_format=cool_setpt_limits,
                unit=thermostat_settings["units"],
                value=thermostat_settings["cool_setpoint"],
                set_value=self.set_cool_setpoint,
            )
            node.add_property(self.cool_setpoint)

        if "system_mode" in thermostat_settings:
            self.system_mode = Property_Enum(
                node,
                id="systemmode",
                name="System Mode",
                data_format=",".join(thermostat_settings["system_modes"]),
                value=thermostat_settings["system_mode"],
                set_value=self.set_system_mode,
            )
            node.add_property(self.system_mode)

        if "fan_mode" in thermostat_settings:
            self.fan_mode = Property_Enum(
                node,
                id="fanmode",
                name="Fan Mode",
                data_format=",".join(thermostat_settings["fan_modes"]),
                value=thermostat_settings["fan_mode"],
                set_value=self.set_fan_mode,
            )
            node.add_property(self.fan_mode)

        if "hold_mode" in thermostat_settings:
            self.hold_mode = Property_Enum(
                node,
                id="holdmode",
                name="Hold Mode",
                data_format=",".join(thermostat_settings["hold_modes"]),
                value=thermostat_settings["hold_mode"],
                set_value=self.set_hold_mode,
            )
            node.add_property(self.hold_mode)

        node = Node_Base(self, "status", "Status", "status")
        self.add_node(node)

        self.current_temperture = Property_Temperature(
            node,
            unit=thermostat_settings["units"],
            value=thermostat_settings["current_temperature"],
        )
        node.add_property(self.current_temperture)

        self.current_humidity = Property_Humidity(
            node, value=thermostat_settings["current_humidity"]
        )
        node.add_property(self.current_humidity)

        self.system_status = Property_String(
            node,
            id="systemstatus",
            name="System Status",
            value=thermostat_settings["system_status"],
        )
        node.add_property(self.system_status)

        self.start()
Example #13
0
 def __init__(self,
              device,
              id='eq3bt',
              name='EQ3BT',
              type_='eq3bt',
              retain=True,
              qos=1):
     super().__init__(device, id, name, type_, retain, qos)
     self.add_property(
         Property_Temperature(self,
                              id='target-temperature',
                              name='Target temperature',
                              unit='C',
                              set_value=self.set_target_temperature,
                              settable=True))
     self.add_property(
         Property_Integer(self,
                          id="valve-state",
                          name="Valve state",
                          settable=False,
                          unit="%",
                          data_format="0:100"))
     self.add_property(
         Property_Boolean(self,
                          id="low-battery",
                          name="Low battery",
                          settable=False))
     self.add_property(
         Property_Enum(self,
                       id="mode",
                       name="Mode",
                       data_format="Boost,Away,Closed,Open,Manual,Auto",
                       settable=True,
                       set_value=self.set_mode))
     self.add_property(
         Property_Boolean(self,
                          id="mode-manual",
                          name="Mode manual",
                          settable=True,
                          set_value=self.set_mode_manual))
     self.add_property(
         Property_Boolean(self,
                          id="mode-away",
                          name="Mode away",
                          settable=True,
                          set_value=self.set_away))
     self.add_property(
         Property_Boolean(self,
                          id="mode-dst",
                          name="Mode dst",
                          settable=False))
     self.add_property(
         Property_Boolean(self,
                          id="mode-window",
                          name="Mode window",
                          settable=False))
     self.add_property(
         Property_Boolean(self,
                          id="locked",
                          name="Locked",
                          set_value=self.set_locked,
                          settable=True))
     self.add_property(
         Property_Boolean(self,
                          id="boost",
                          name="Boost",
                          set_value=self.set_boost,
                          settable=True))
     self.add_property(
         Property_Temperature(self,
                              id='comfort-temperature',
                              name='Comfort temperature',
                              unit='C',
                              settable=False))
     self.add_property(
         Property_Temperature(self,
                              id='eco-temperature',
                              name='Eco temperature',
                              unit='C',
                              settable=False))
     self.add_property(
         Property_Temperature(self,
                              id='temperature-offset',
                              name='Temperature offset',
                              settable=True,
                              unit='C',
                              set_value=self.set_temperature_offset))
     self.add_property(
         Property_Temperature(self,
                              id='min-temp',
                              name='Minimum temperature',
                              unit='C',
                              settable=False))
     self.add_property(
         Property_Temperature(self,
                              id='max-temp',
                              name='Maximum temperature',
                              unit='C',
                              settable=False))
     self.add_property(
         Property_String(self,
                         id="firmware-version",
                         name="Firmware version",
                         settable=False))
     self.add_property(
         Property_String(self,
                         id="device-serial",
                         name="Device serial",
                         settable=False))
     self.add_property(
         Property_String(self,
                         id="last-update",
                         name="Last update",
                         settable=True,
                         set_value=self.set_last_update))
     self.add_property(
         Property_String(self,
                         id="away-end",
                         name="Away end",
                         settable=True,
                         set_value=self.set_away_end))
Example #14
0
    def __init__(self,
                 atag: AtagOne,
                 eventloop,
                 device_id="atagone",
                 name="Atag One"):
        """Create an ATAG ONE Homie device."""
        super().__init__(device_id, name, TRANSLATED_HOMIE_SETTINGS,
                         TRANSLATED_MQTT_SETTINGS)
        self.atag: AtagOne = atag
        self.temp_unit = atag.climate.temp_unit
        self._eventloop = eventloop

        LOGGER.debug("Setting up Homie nodes")
        node = (Node_Base(self, 'burner', 'Burner', 'status'))
        self.add_node(node)

        self.burner_modulation = Property_Integer(node,
                                                  id="modulation",
                                                  name="Burner modulation",
                                                  settable=False)
        node.add_property(self.burner_modulation)

        self.burner_target = Property_Enum(node,
                                           id="target",
                                           name="Burner target",
                                           settable=False,
                                           data_format="none,ch,dhw")
        node.add_property(self.burner_target)

        # Central heating status properties
        node = (Node_Base(self, 'centralheating', 'Central heating', 'status'))
        self.add_node(node)

        self.ch_status = Property_Boolean(node,
                                          id="status",
                                          name="CH status",
                                          settable=False)
        node.add_property(self.ch_status)

        self.ch_temperature = Property_Temperature(
            node,
            id="temperature",
            name="CH temperature",
            settable=False,
            value=self.atag.climate.temperature,
            unit=self.temp_unit)
        node.add_property(self.ch_temperature)

        self.ch_water_temperature = Property_Temperature(
            node,
            id="water-temperature",
            name="CH water temperature",
            settable=False,
            value=self.atag.report["CH Water Temperature"].state,
            unit=self.temp_unit)
        node.add_property(self.ch_water_temperature)

        self.ch_target_water_temperature = Property_Temperature(
            node,
            id="target-water-temperature",
            name="CH target water temperature",
            settable=False,
            value=self.atag.climate.target_temperature,
            unit=self.temp_unit)
        node.add_property(self.ch_target_water_temperature)

        self.ch_return_water_temperature = Property_Temperature(
            node,
            id="return-water-temperature",
            name="CH return water temperature",
            settable=False,
            value=self.atag.report["CH Return Temperature"].state,
            unit=self.temp_unit)
        node.add_property(self.ch_return_water_temperature)

        self.ch_water_pressure = Property_Float(
            node,
            id="water-pressure",
            name="CH water pressure",
            settable=False,
            value=self.atag.report["CH Water Pressure"].state,
            unit=self.temp_unit)
        node.add_property(self.ch_water_pressure)

        ch_mode_values = ",".join(STATES["ch_mode"].values())
        self.ch_mode = Property_Enum(node,
                                     id="mode",
                                     name="CH mode",
                                     settable=False,
                                     value=self.atag.climate.preset_mode,
                                     data_format=ch_mode_values)
        node.add_property(self.ch_mode)

        self.ch_mode_duration = Property_String(
            node,
            id="mode-duration",
            name="CH mode duration",
            settable=False,
            value=self.atag.climate.preset_mode_duration,
        )
        node.add_property(self.ch_mode_duration)

        # Domestic hot water status properties
        node = (Node_Base(self, 'domestichotwater', 'Domestic hot water',
                          'status'))
        self.add_node(node)

        self.dhw_status = Property_Boolean(node,
                                           id="status",
                                           name="DHW status",
                                           settable=False)
        node.add_property(self.dhw_status)

        self.dhw_temperature = Property_Temperature(
            node,
            id="temperature",
            name="DHW temperature",
            settable=False,
            value=self.atag.dhw.temperature,
            unit=self.temp_unit)
        node.add_property(self.dhw_temperature)

        dhw_mode_values = ",".join(STATES["dhw_mode"].values()) + ",off"
        self.dhw_mode = Property_Enum(node,
                                      id="mode",
                                      name="DHW mode",
                                      settable=False,
                                      value=self.atag.dhw.current_operation,
                                      data_format=dhw_mode_values)
        node.add_property(self.dhw_mode)

        node = (Node_Base(self, 'weather', 'Weather', 'status'))
        self.add_node(node)

        self.weather_temperature = Property_Temperature(
            node,
            id="temperature",
            name="Weather temperature",
            settable=False,
            value=self.atag.report["weather_temp"].state,
            unit=self.temp_unit)
        node.add_property(self.weather_temperature)

        # Control properties
        node = (Node_Base(self, 'controls', 'Controls', 'controls'))
        self.add_node(node)

        ch_min_temp = 12
        ch_max_temp = 25
        ch_target_temperature_limits = f'{ch_min_temp}:{ch_max_temp}'
        self.ch_target_temperature = Property_Setpoint(
            node,
            id='ch-target-temperature',
            name='CH Target temperature',
            data_format=ch_target_temperature_limits,
            unit=self.temp_unit,
            value=self.atag.climate.target_temperature,
            set_value=self.set_ch_target_temperature)
        node.add_property(self.ch_target_temperature)

        dhw_min_temp = self.atag.dhw.min_temp
        dhw_max_temp = self.atag.dhw.max_temp
        dhw_target_temperature_limits = f'{dhw_min_temp}:{dhw_max_temp}'
        self.dhw_target_temperature = Property_Setpoint(
            node,
            id='dhw-target-temperature',
            name='DHW Target temperature',
            data_format=dhw_target_temperature_limits,
            unit=self.temp_unit,
            value=self.atag.dhw.target_temperature,
            set_value=self.set_dhw_target_temperature)
        node.add_property(self.dhw_target_temperature)

        hvac_values = ",".join(STATES["ch_control_mode"].values())
        self.hvac_mode = Property_Enum(node,
                                       id='hvac-mode',
                                       name='HVAC mode',
                                       data_format=hvac_values,
                                       unit=self.temp_unit,
                                       value=self.atag.climate.hvac_mode,
                                       set_value=self.set_hvac_mode)
        node.add_property(self.hvac_mode)

        ch_mode_values = ",".join(STATES["ch_mode"].values())
        self.ch_mode_control = Property_Enum(
            node,
            id="ch-mode",
            name="CH mode",
            data_format=ch_mode_values,
            value=self.atag.climate.preset_mode,
            set_value=self.set_ch_mode)
        node.add_property(self.ch_mode_control)

        LOGGER.debug("Starting Homie device")
        self.start()
  def __init__(self, device_id=None, name=None, homie_settings=None, mqtt_settings=None, tstat_device=None):
    super().__init__ (device_id, name, homie_settings, mqtt_settings)

    self.tstat_device=tstat_device

    node = (Node_Base(self,'controls','Controls','controls'))
    self.add_node (node)
    
    self.heat_setpoint = Property_Setpoint (node,id='heatsetpoint',name='Heat Setpoint',data_format=SETPOINT_LIMITS,unit=UNITS,value=tstat_device.t_heat['raw'],set_value = lambda value: self.set_heat_setpoint(value) )
    node.add_property (self.heat_setpoint)
    
    self.cool_setpoint = Property_Setpoint (node,id='coolsetpoint',name='Cool Setpoint',data_format=SETPOINT_LIMITS,unit=UNITS,value=tstat_device.t_cool['raw'],set_value=lambda value: self.set_cool_setpoint(value) )
    node.add_property (self.cool_setpoint)

    self.system_mode = Property_Enum (node,id='systemmode',name='System Mode',data_format=','.join(SYSTEM_MODES),value=tstat_device.tmode['human'],set_value = lambda value: self.set_system_mode(value) )
    node.add_property (self.system_mode)

    self.fan_mode = Property_Enum (node,id='fanmode',name='Fan Mode',data_format=','.join(FAN_MODES),value=tstat_device.fmode['human'],set_value = lambda value: self.set_fan_mode(value) )
    node.add_property (self.fan_mode)

    self.hold = Property_Enum (node,id='hold',name='Hold',data_format=','.join(HOLD_MODES),value=tstat_device.hold['human'],set_value = lambda value: self.set_hold(value) )
    node.add_property (self.hold)

    self.override = Property_Enum (node,id='override',name='Override',data_format=','.join(HOLD_MODES),value=tstat_device.override['human'],set_value = lambda value: self.set_override(value) )
    node.add_property (self.override)

    
    node = (Node_Base(self,'status','Status','status'))
    self.add_node (node)

    self.temperature = Property_Temperature (node,unit='F',value=tstat_device.temp['raw'])
    node.add_property (self.temperature)

    self.system_status = Property_String (node,id='systemstatus',name='System Status',value=tstat_device.tstate['human'])
    node.add_property (self.system_status)

    self.fan_status = Property_String (node,id='fanstatus',name='Fan Status',value=tstat_device.fstate['human'])
    node.add_property (self.fan_status)

    
    node = (Node_Base(self,'runtime','Runtime','runtime'))
    self.add_node (node)

    self.today_heat = Property_String (node,id='todayheat',name='Today Heat')
    node.add_property (self.today_heat)

    self.today_cool = Property_String (node,id='todaycool',name='Today Cool')
    node.add_property (self.today_cool)

    self.today_total = Property_String (node,id='todaytotal',name='Today Total')
    node.add_property (self.today_total)

    self.yesterday_heat = Property_String (node,id='yesterdayheat',name='Yesterday Heat')
    node.add_property (self.yesterday_heat)

    self.yesterday_cool = Property_String (node,id='yesterdaycool',name='Yesterday Cool')
    node.add_property (self.yesterday_cool)

    self.yesterday_total = Property_String (node,id='yesterdaytotal',name='Yesterday Total')
    node.add_property (self.yesterday_total)


    self.start()
    def __init__(
                self, 
                device_id=None, 
                name=None, 
                homie_settings=None, 
                mqtt_settings=None,
                sensors_definition = comfoairq_sensors,
                comfoconnect_settings=None,                
    ):
        assert comfoconnect_settings
        assert mqtt_settings

        super().__init__ (device_id, name, homie_settings, mqtt_settings)

        self.state = 'init'
        global repeating_timer
        if repeating_timer == None:
            repeating_timer = Repeating_Timer(
                self.homie_settings["update_interval"]
            )

        repeating_timer.add_callback(self.publish_connection_status)

        self.sensors = sensors_definition
        self.comfoconnect_settings=comfoconnect_settings
        self.min_low_flow = self.comfoconnect_settings['COMFOCONNECT_MIN_LOW_FLOW']

        self.max_high_flow = self.comfoconnect_settings['COMFOCONNECT_MAX_HIGH_FLOW']

        self.comfoairq = ComfoAirQ(comfoconnect_settings=self.comfoconnect_settings)
        self.comfoairq.callback_sensor = self.callback_sensor

        self.comfoairq.add_on_state_change_callback(self.publish_connection_status)

# Sensors

        node = Node_Base(self,'sensors','Sensors','sensors')
        self.add_node (node)

        for comfoairq_sensor in self.sensors:
            self.comfoairq.register_sensor(comfoairq_sensor)
            for homie_sensor in self.sensors[comfoairq_sensor]:
                sensor_id ,sensor_name ,sensor_type, transformation_function, function_args =  homie_sensor
                if sensor_type == 'temperature':
                    node.add_property (Property_Temperature (node,id=sensor_id,name = sensor_name, unit='°C'))
                elif sensor_type == 'fan_speed':
                    node.add_property (Property_Float (node,id=sensor_id,name = sensor_name,settable = False,unit='rpm'))
                elif sensor_type == 'fan_flow':
                    node.add_property (Property_Float (node,id=sensor_id,name = sensor_name,settable = False,unit='m³/h'))
                elif sensor_type == 'percentage':
                    node.add_property (Property_Float (node,id=sensor_id,name = sensor_name,settable = False,unit='%'))
                elif sensor_type == 'mode_end_date':
                    node.add_property (Property_DateTime (node,id=sensor_id,name = sensor_name,settable = False,data_format='%Y-%m-%d %H:%M:%S.%f'))
                elif sensor_type == 'mode_timer':
                    node.add_property (Property_Integer (node,id=sensor_id,name = sensor_name,settable = False,unit='s'))
                elif sensor_type == 'enum':
                    node.add_property (Property_Enum (node,id=sensor_id,name = sensor_name,settable = False,data_format=','.join(function_args.values())))
                elif sensor_type == 'power_current':
                    node.add_property (Property_Float (node,id=sensor_id,name = sensor_name,settable = False,unit='W'))
                elif sensor_type == 'energy':
                    node.add_property (Property_Float (node,id=sensor_id,name = sensor_name,settable = False,unit='kWh'))
                elif sensor_type == 'integer':
                    node.add_property (Property_Integer(node,id=sensor_id,name = sensor_name,settable = False))

# Sensors managed same way as Controls 

        node.add_property(Property_Enum (node,id='current-mode',name ='Current Mode',settable = False,data_format=','.join(CURRENT_OPERATING_MODE_SENSOR_VALUES.values())))
        self.add_controls_callback(SENSOR_OPERATING_MODE_BIS,self.update_current_mode)
        self.add_controls_callback(SENSOR_OPERATING_MODE,self.update_current_mode)

# Controls

        node = Node_Base(self,'controls','Controls','controls')
        self.add_node (node)

# FAN SPEED MODE
        node.add_property(Property_Enum (node,id='fan-mode',name='Fan Mode',data_format=','.join(FAN_MODES.keys()),set_value = lambda value: self.set_fan_mode(value)))
        self.add_controls_callback(SENSOR_FAN_SPEED_MODE,self.update_fan_mode)

# BYPASS  MODE (for 1 hour)
        node.add_property(Property_Enum (node,id='bypass-mode',name='Bypass Mode',data_format=','.join(BYPASS_MODES.keys()),set_value = lambda value: self.set_bypass_mode(value)))
        self.add_controls_callback(SENSOR_BYPASS_MODE,self.update_bypass_mode)

# BYPASS ON 
        node.add_property(Property_Integer (node,id='bypass-on', name='Bypass On',data_format='0:'+ str(0xffffffff),set_value = lambda value: self.set_bypass_on(value)))
# BYPASS OFF
        node.add_property(Property_Integer (node,id='bypass-off', name='Bypass Off',data_format='0:'+ str(0xffffffff),set_value = lambda value: self.set_bypass_off(value)))

        self.add_controls_callback(SENSOR_BYPASS_MODE,self.update_bypass)
        self.add_controls_callback(SENSOR_BYPASS_TIMER,self.update_bypass)

# TEMPERATURE PROFILE
        node.add_property(Property_Enum (node,id='temperature-profile',name='Temperature Profile',data_format=','.join(TEMPERATURE_PROFILES.keys()),set_value = lambda value: self.set_temperature_profile(value)))
        self.add_controls_callback(SENSOR_TEMPERATURE_PROFILE,self.update_temperature_profile)

# OPERATING MODE
        node.add_property(Property_Enum (node,id='operating-mode',name='Operating Mode',data_format=','.join(OPERATING_MODES.keys()),set_value = lambda value: self.set_operating_mode(value)))
        self.add_controls_callback(SENSOR_OPERATING_MODE,self.update_operating_mode)

# Manual MODE
        node.add_property(Property_Switch (node,id='manual-mode',name='Manual Mode',set_value = lambda value: self.set_manual_mode(value)))
        self.add_controls_callback(SENSOR_OPERATING_MODE,self.update_manual_mode)

# VENT MODE
        node.add_property(Property_Enum (node,id='vent-mode',name='Ventilation Mode',data_format=','.join(VENT_MODES.keys()),set_value = lambda value: self.set_vent_mode(value)))
        self.add_controls_callback(SENSOR_TEMPORARY_STOP_EXHAUST_FAN_STATE,self.update_vent_mode)
        self.add_controls_callback(SENSOR_TEMPORARY_STOP_SUPPLY_FAN_STATE,self.update_vent_mode)

# SUPPLY FAN OFF 
        node.add_property(Property_Integer (node,id='supply-fan-off', name='Supply Fan Off',data_format='0:'+ str(0xffffffff),set_value = lambda value: self.set_supply_fan_off(value)))
        self.add_controls_callback(SENSOR_SUPPLY_FAN_TIMER,self.update_supply_fan_off)

# EXHAUST FAN  OFF
        node.add_property(Property_Integer (node,id='exhaust-fan-off', name='Exhaust Fan Off',data_format='0:'+ str(0xffffffff),set_value = lambda value: self.set_exhaust_fan_off(value)))
        self.add_controls_callback(SENSOR_EXHAUST_FAN_TIMER,self.update_exhaust_fan_off)

# BOOST MODE
        node.add_property(Property_Integer (node,id='boost-mode',name='Activate Scheduled Boost Mode',data_format='0:'+ str(0xffffffff),set_value = lambda value: self.set_boost_mode(value)))
        self.add_controls_callback(SENSOR_OPERATING_MODE_BIS,self.update_boost_mode)
        self.add_controls_callback(SENSOR_FAN_NEXT_CHANGE,self.update_boost_mode)

# AWAY MODE
        node.add_property(Property_Integer (node,id='away-mode',name='Activate Scheduled Away Mode',data_format='0:'+ str(0xffffffff),set_value = lambda value: self.set_away_mode(value)))
        self.add_controls_callback(SENSOR_OPERATING_MODE_BIS,self.update_away_mode)
        self.add_controls_callback(SENSOR_FAN_NEXT_CHANGE,self.update_away_mode)

# Heating Season detection RMOT
        node.add_property(Property_Temperature (node,id='heating-rmot',name='Heating Limit RMOT',data_format='0:20',unit='°C',settable = True, set_value = lambda value: self.set_heating_rmot(value)))
        self.comfoairq.add_on_state_change_callback(self.update_heating_rmot)
        repeating_timer.add_callback(self.update_heating_rmot)

# Cooling Season detection RMOT
        node.add_property(Property_Temperature (node,id='cooling-rmot',name='Cooling Limit RMOT',data_format='20:40',unit='°C',settable = True, set_value = lambda value: self.set_cooling_rmot(value)))
        self.comfoairq.add_on_state_change_callback(self.update_cooling_rmot)
        repeating_timer.add_callback(self.update_cooling_rmot)

#Temperature  passive
        node.add_property(Property_Enum (node,id='temperature-passive',name='Temperature Passive',data_format=','.join(SENSOR_VENTILATION),set_value = lambda value: self.set_temperature_passive(value)))
        self.comfoairq.add_on_state_change_callback(self.update_temperature_passive)
        repeating_timer.add_callback(self.update_temperature_passive)

#Humidity comfort
        node.add_property(Property_Enum (node,id='humidity-comfort',name='Humidity Comfort',data_format=','.join(SENSOR_VENTILATION),set_value = lambda value: self.set_humidity_comfort(value)))
        self.comfoairq.add_on_state_change_callback(self.update_humidity_comfort)
        repeating_timer.add_callback(self.update_humidity_comfort)

#Humidity protection
        node.add_property(Property_Enum (node,id='humidity-protection',name='Humidity Protection',data_format=','.join(SENSOR_VENTILATION),set_value = lambda value: self.set_humidity_protection(value)))
        self.comfoairq.add_on_state_change_callback(self.update_humidity_protection)
        repeating_timer.add_callback(self.update_humidity_protection)

#Flow unbalance
        node.add_property(Property_Float (node,id='unbalance',name='Flow Unbalance',data_format='-15:15',set_value = lambda value: self.set_unbalance(value)))
        self.comfoairq.add_on_state_change_callback(self.update_unbalance)
        repeating_timer.add_callback(self.update_unbalance)

#Flow Away
        node.add_property(Property_Integer (node,id='flow-away',name='Flow Away Speed',data_format='0:' + str(self.max_high_flow),set_value = lambda value: self.set_flow_away(value)))
        self.comfoairq.add_on_state_change_callback(self.update_flow_away)
        repeating_timer.add_callback(self.update_flow_away)

#Flow Low
        node.add_property(Property_Integer (node,id='flow-low',name='Flow Low Speed',data_format= str(self.min_low_flow) + ':' + str(self.max_high_flow),set_value = lambda value: self.set_flow_low(value)))
        self.comfoairq.add_on_state_change_callback(self.update_flow_low)
        repeating_timer.add_callback(self.update_flow_low)

#Flow Medium
        node.add_property(Property_Integer (node,id='flow-medium',name='Flow Medium Speed',data_format=str(self.min_low_flow) + ':' + str(self.max_high_flow),set_value = lambda value: self.set_flow_medium(value)))
        self.comfoairq.add_on_state_change_callback(self.update_flow_medium)
        repeating_timer.add_callback(self.update_flow_medium)

#Flow High
        node.add_property(Property_Integer (node,id='flow-high',name='Flow High Speed',data_format=str(self.min_low_flow) + ':' + str(self.max_high_flow),set_value = lambda value: self.set_flow_high(value)))
        self.comfoairq.add_on_state_change_callback(self.update_flow_high)
        repeating_timer.add_callback(self.update_flow_high)

        self.start()
        self.publish_connection_status()
    def __init__(self, device_id=None, name=None, homie_settings=None, mqtt_settings=None, tcc_device=None):

        super().__init__ (device_id, name, homie_settings, mqtt_settings)

        self.tcc_device=tcc_device

        node = (Node_Base(self,'controls','Controls','controls'))
        self.add_node (node)

        heat_setpt_limits = '{}:{}'.format(tcc_device.raw_ui_data['HeatLowerSetptLimit'],tcc_device.raw_ui_data['HeatUpperSetptLimit'])
        self.heat_setpoint = Property_Setpoint (node,id='heatsetpoint',name='Heat Setpoint',data_format=heat_setpt_limits,unit=tcc_device.temperature_unit,value=tcc_device.setpoint_heat,set_value = lambda value: self.set_heat_setpoint(value) )
        node.add_property (self.heat_setpoint)

        cool_setpt_limits = '{}:{}'.format(tcc_device.raw_ui_data['CoolLowerSetptLimit'],tcc_device.raw_ui_data['CoolUpperSetptLimit'])
        self.cool_setpoint = Property_Setpoint (node,id='coolsetpoint',name='Cool Setpoint',data_format=cool_setpt_limits,unit=tcc_device.temperature_unit,value=tcc_device.setpoint_cool,set_value=lambda value: self.set_cool_setpoint(value) )
        node.add_property (self.cool_setpoint)

        self.system_mode = Property_Enum (node,id='systemmode',name='System Mode',data_format=','.join(SYSTEM_MODES),value=tcc_device.system_mode,set_value = lambda value: self.set_system_mode(value) )
        node.add_property (self.system_mode)

        self.fan_mode = Property_Enum (node,id='fanmode',name='Fan Mode',data_format=','.join(FAN_MODES),value=tcc_device.fan_mode,set_value = lambda value: self.set_fan_mode(value) )
        node.add_property (self.fan_mode)

#        self.hold_mode = Property_Enum (node,id='holdmode',name='Hold Mode',data_format=','.join(HOLD_MODES),value=self.get_hold_mode(),set_value = lambda value: self.set_hold_mode(value) )
        self.hold_mode = Property_String (node,id='holdmode',name='Hold Mode',settable=True,value=self.get_hold_mode(),set_value = lambda value: self.set_hold_mode(value) )
        node.add_property (self.hold_mode)

        self.temp_hold_time = Property_Integer (node,id='tempholdtime',name='Temporary Hold Hours',data_format='1:24',settable=True,value=Default_Temporay_Hold_Hours,set_value = lambda value: self.set_temp_hold_time(value) )
        node.add_property (self.temp_hold_time)

        self.request_refresh = Property_Button (node,id='requestrefresh',name='Request Refresh',settable=True,set_value = lambda value: self.update() )
        node.add_property (self.request_refresh)

        node = (Node_Base(self,'status','Status','status'))
        self.add_node (node)

        self.temperture = Property_Temperature (node,unit=tcc_device.temperature_unit)
        node.add_property (self.temperture)

        self.humidity = Property_Humidity (node)
        node.add_property (self.humidity)

        self.system_status = Property_String (node,id='systemstatus',name='System Status',value=tcc_device.equipment_output_status)
        node.add_property (self.system_status)
        
        self.account_status = Property_String (node,id='accountstatus',name='Account Status',value='Connected')
        node.add_property (self.account_status)

        self.last_update = Property_String (node,id='lastupdate',name='Last Update',value=datetime.datetime.now().strftime("%d/%m/%Y %H:%M:%S"))
        node.add_property (self.last_update)

        node = (Node_Base(self,'outside','Outside','status'))
        self.add_node (node)

        self.outside_temperature = Property_Temperature (node,name='Outside Temperature',unit=tcc_device.temperature_unit)
        node.add_property (self.outside_temperature)

        self.outside_humidity = Property_Humidity (node,name='Outside Humidity')
        node.add_property (self.outside_humidity)

        self.start()
     name="%s Battery Level" % (node[0].title()),
     settable=False,
     value=None)
 node_config[node[0]]['node'].add_property(
     node_config[node[0]]['battery_level'])
 node_config[node[0]]['location'] = Property_String(
     node_config[node[0]]['node'],
     id="location",
     name="%s Location Coordinates" % (node[0].title()),
     settable=False,
     value=None)
 node_config[node[0]]['node'].add_property(node_config[node[0]]['location'])
 node_config[node[0]]['location_status'] = Property_Enum(
     node_config[node[0]]['node'],
     id="locationstatus",
     name="%s Location Status" % (node[0].title()),
     data_format='ON,OFF',
     value=node_config[node[0]]['enableLocation'],
     set_value=lstatus_handler)
 node_config[node[0]]['node'].add_property(
     node_config[node[0]]['location_status'])
 node_config[node[0]]['location_cache'] = Property_Enum(
     node_config[node[0]]['node'],
     id="locationcache",
     name="%s Location Cache" % (node[0].title()),
     data_format='ON,OFF',
     value=node_config[node[0]]['cachedLocation'],
     set_value=lambda value: location_cache_handler(value))
 node_config[node[0]]['node'].add_property(
     node_config[node[0]]['location_cache'])
 node_config[node[0]]['play_sound'] = Property_Enum(