Example #1
0
    def __init__(self,
                 isy_device=None,
                 homie_settings=None,
                 mqtt_settings=None):

        Base.__init__(self, isy_device)

        Device_Base.__init__(self, 'isycontroller', 'ISY Controller',
                             homie_settings, mqtt_settings)

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

        self.heartbeat = Property_String(node, 'heartbeat', 'Heart Beat')
        node.add_property(self.heartbeat)

        self.state_busy = Property_String(node, 'state', 'State')
        node.add_property(self.state_busy)

        self.htpp_connected = Property_String(node, 'http', 'HTTP Status')
        node.add_property(self.htpp_connected)

        self.websocket_connected = Property_String(node, 'websocket',
                                                   'Websocket Status')
        node.add_property(self.websocket_connected)

        Device_Base.start(self)
Example #2
0
    def __init__(self,
                 isy_device=None,
                 homie_settings=None,
                 mqtt_settings=None):

        Base.__init__(self, isy_device)

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

        node = self.get_node("dimmer")
        self.paddle = Property_String(node, "paddleaction", "Paddle Action")
        node.add_property(self.paddle)

        self.power = Property_String(node, "power", "Power State")
        node.add_property(self.power)

        level = self.isy_device.get_property("level")
        if level is not None:
            self.property_change("level", level)
Example #3
0
        def __init__(self, device, log):
            super().__init__(device=device,
                             id='camera',
                             name='Camera',
                             type_='camera')

            self.log = log

            self.add_property(
                Property_Boolean(node=self,
                                 id='switch',
                                 name='Switch',
                                 set_value=self._set_switch))
            self.add_property(Property_Battery(node=self))
            self.add_property(
                Property_String(node=self, id='charging', name='Charging'))
            self.add_property(
                Property_String(node=self, id='connection', name='Connection'))
            self.add_property(
                Property_Integer(node=self,
                                 id='signal',
                                 name='Signal',
                                 settable=False))
            self.add_property(
                Property_String(node=self, id='lastimage', name='Last Image'))
Example #4
0
    def __init__(
        self,
        device,
        id="software",
        name="Software",
        type_="software",
        retain=True,
        qos=1,
    ):

        super().__init__(device, id, name, type_, retain, qos)
        # scanner/camnode-hwaddr/software/repo-revision
        sw_repo = self.sw_repo_revision()
        logger.info('Repo software revision: {}'.format(sw_repo))
        self.repo_revision = Property_String(node=self,
                                             id='repo-revision',
                                             name='Repository Revision',
                                             value=sw_repo)

        # scanner/camnode-hwaddr/software/local-revision
        sw_local = self.sw_local_revision()
        logger.info('Local software revision: {}'.format(sw_local))
        self.local_revision = Property_String(node=self,
                                              id='local-revision',
                                              name='Local Revision',
                                              value=sw_local)
        self.add_property(self.repo_revision)
        self.add_property(self.local_revision)
Example #5
0
    def __init__(self,
                 device_id=None,
                 name=None,
                 homie_settings=None,
                 mqtt_settings=None):

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

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

        self.account_status = Property_String(node,
                                              id='connectionstatus',
                                              name='Connection Status',
                                              value='Not Connected')
        node.add_property(self.account_status)

        self.last_update = Property_String(node,
                                           id='lastupdate',
                                           name='Last Update',
                                           value='None')
        node.add_property(self.last_update)

        self.device_count = Property_String(node,
                                            id='devicecount',
                                            name='Device Count',
                                            value='None')
        node.add_property(self.device_count)

        self.start()
Example #6
0
    def __init__(self, isy_device=None, homie_settings=None, mqtt_settings=None):

        Base.__init__(self, isy_device)

        Device_Base.__init__(
            self, "isycontroller", "ISY Controller", homie_settings, mqtt_settings
        )

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

        self.heartbeat = Property_String(node, "heartbeat", "Heart Beat")
        node.add_property(self.heartbeat)

        self.state_busy = Property_String(node, "state", "State")
        node.add_property(self.state_busy)

        self.http_connected = Property_String(node, "http", "HTTP Status")
        node.add_property(self.http_connected)

        self.websocket_connected = Property_String(
            node, "websocket", "Websocket Status"
        )
        node.add_property(self.websocket_connected)

        self.add_communication_error_property()

        Device_Base.start(self)
Example #7
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 #8
0
    def __init__(self,
                 isy_device=None,
                 homie_settings=None,
                 mqtt_settings=None):

        Base.__init__(self, isy_device)

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

        node = self.get_node("switch")
        self.paddle = Property_String(node, "paddle-action", "Paddle Action")
        node.add_property(self.paddle)

        self.add_communication_error_property()

        onoff = self.isy_device.get_property("onoff")
        if onoff is not None:
            self.property_change("onoff", onoff)

        self.state = self.isy_device.get_property("status")
    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,
        )

        paddle_node = Node_Base(self,
                                id="paddle",
                                name="paddle",
                                type_="paddle")
        self.add_node(paddle_node)

        self.paddle = Property_String(paddle_node, "paddle-action",
                                      "Paddle Action")
        paddle_node.add_property(self.paddle)

        Device_Base.start(self)
Example #10
0
    def __init__(
        self,
        device,
        id="recent-image",
        name="Recent Image",
        type_="file",
        retain=True,
        qos=1,
    ):

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

        os.makedirs(Node_Image.IMAGE_DIR, mode=0o755, exist_ok=True)
        assert os.path.exists(Node_Image.IMAGE_DIR)

        self.device_name = device.name

        self.filename = Property_String(node=self,
                                        id='filename',
                                        name='Filename')
        self.datetime = Property_DateTime(node=self,
                                          id='datetime',
                                          name='File Date')

        file_meta = {}
        file_meta['encoding'] = {}
        file_meta['encoding']['name'] = 'file encoding'
        file_meta['encoding']['value'] = 'base64'
        file_meta['hashfunc'] = {}
        file_meta['hashfunc']['name'] = 'hashlib'
        file_meta['hashfunc']['value'] = 'blake2s'
        file_meta['jsonfiledata'] = {}
        file_meta['jsonfiledata']['name'] = 'json_var'
        file_meta['jsonfiledata']['value'] = 'b64file'
        file_meta['jsonfilehash'] = {}
        file_meta['jsonfilehash']['name'] = 'json_var'
        file_meta['jsonfilehash']['value'] = 'filehash'
        self.file = Property_String(node=self,
                                    id='file',
                                    name='File',
                                    meta=file_meta)

        self.add_property(self.filename)
        self.add_property(self.datetime)
        self.add_property(self.file)
Example #11
0
    def __init__(self, isy_device=None,homie_settings=None, mqtt_settings=None):

        Base.__init__ (self,isy_device)

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

        node = self.get_node ('switch')
        self.paddle = Property_String(node,'paddle-action','Paddle Action')
        node.add_property(self.paddle)

        onoff = self.isy_device.get_property('onoff')
        if onoff is not None:
            self.property_change('onoff',onoff)
Example #12
0
 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 #13
0
    def __init__(self, isy_device=None,homie_settings=None, mqtt_settings=None):

        Base.__init__ (self,isy_device)

        Device_Dimmer.__init__ (self,self.get_homie_device_id(), isy_device.name, homie_settings, mqtt_settings)
        
        node = self.get_node ('dimmer')
        self.paddle = Property_String(node,'paddle-action','Paddle Action')
        node.add_property(self.paddle)

        level = self.isy_device.get_property('level')
        if level is not None:
            self.property_change('level',level)
Example #14
0
        def __init__(self, device, log):
            super().__init__(device=device,
                             id='basestation',
                             name='Base Station',
                             type_='basestation')

            self.log = log

            self.add_property(
                Property_String(node=self,
                                id='activemodes',
                                name='Active Modes',
                                settable=True,
                                set_value=self._set_active_modes))
Example #15
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 #16
0
    def __init__(self, isy_device=None, homie_settings=None, mqtt_settings=None):

        Base.__init__(self, isy_device)

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

        node = self.get_node("switch")
        self.duration = Property_String(node, "duration", "Duration")
        node.add_property(self.duration)
        self.duration.value = 0

        onoff = self.isy_device.get_property("onoff")
        if onoff is not None:
            self.property_change("onoff", onoff)
    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)

        paddle_node = Node_Base(self,
                                id='paddle',
                                name='paddle',
                                type_='paddle')
        self.add_node(paddle_node)

        self.paddle = Property_String(paddle_node, 'paddle-action',
                                      'Paddle Action')
        paddle_node.add_property(self.paddle)

        Device_Base.start(self)
Example #18
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 #19
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()
get_config()

iCloud = Device_Base(device_id='icloud-bridge',
                     name='iCloud Homie Bridge',
                     mqtt_settings=mqtt_config)
for node in node_config.items():
    node_id = node[0]
    lstatus_handler = lambda value: location_status_handler(node_id, value)

    node_config[node[0]]['node'] = Node_Base(iCloud, node[0], node[0].title(),
                                             node[0])
    iCloud.add_node(node_config[node[0]]['node'])

    node_config[node[0]]['battery_status'] = Property_String(
        node_config[node[0]]['node'],
        id="batterystatus",
        name="%s Battery Status" % (node[0].title()),
        settable=False,
        value=None)
    node_config[node[0]]['node'].add_property(
        node_config[node[0]]['battery_status'])
    node_config[node[0]]['battery_level'] = Property_Float(
        node_config[node[0]]['node'],
        id="batterylevel",
        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",
Example #21
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))
  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()
Example #23
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()
    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()