示例#1
0
 def __init__(self, dev, idx, val, param):
     """Init LifeSmart cover device."""
     super().__init__(dev, idx, val, param)
     self._name = dev['name']
     cdata = dev['data']
     self.entity_id = ENTITY_ID_FORMAT.format(
         (dev['devtype'] + "_" + dev['agt'] + "_" +
          dev['me']).lower().replace(":", "_").replace("@", "_"))
     if dev['devtype'] in AIR_TYPES:
         self._modes = LIFESMART_STATE_LIST
         if cdata['O']['type'] % 2 == 0:
             self._mode = LIFESMART_STATE_LIST[0]
         else:
             self._mode = LIFESMART_STATE_LIST[cdata['MODE']['val']]
         self._attributes.update(
             {"last_mode": LIFESMART_STATE_LIST[cdata['MODE']['val']]})
         self._current_temperature = cdata['T']['v']
         self._target_temperature = cdata['tT']['v']
         self._min_temp = 10
         self._max_temp = 35
         self._fanspeed = cdata['F']['val']
     else:
         self._modes = LIFESMART_STATE_LIST2
         if cdata['P1']['type'] % 2 == 0:
             self._mode = LIFESMART_STATE_LIST2[0]
         else:
             self._mode = LIFESMART_STATE_LIST2[1]
         if cdata['P2']['type'] % 2 == 0:
             self._attributes.setdefault('Heating', "false")
         else:
             self._attributes.setdefault('Heating', "true")
         self._current_temperature = cdata['P4']['val'] / 10
         self._target_temperature = cdata['P3']['val'] / 10
         self._min_temp = 5
         self._max_temp = 35
 def __init__(self, tesla_device, controller):
     """Initialize the Tesla device."""
     super().__init__(tesla_device, controller)
     self.entity_id = ENTITY_ID_FORMAT.format(self.tesla_id)
     self._target_temperature = None
     self._temperature = None
     self._name = self.tesla_device.name
示例#3
0
 def __init__(self, tuya):
     """Init climate device."""
     super().__init__(tuya)
     self.entity_id = ENTITY_ID_FORMAT.format(tuya.object_id())
     self.operations = [HVAC_MODE_OFF, HVAC_MODE_HEAT, HVAC_MODE_AUTO]
     self._thermostat_current_mode = HVAC_MODE_OFF if not self.tuya.state(
     ) else HVAC_MODE_HEAT
示例#4
0
 def __init__(self, tesla_device, controller):
     """Initialize the Tesla device."""
     super().__init__(tesla_device, controller)
     self.entity_id = ENTITY_ID_FORMAT.format(self.tesla_id)
     self._target_temperature = None
     self._temperature = None
     self._name = self.tesla_device.name
示例#5
0
 def __init__(self, tuya, platform):
     """Init climate device."""
     super().__init__(tuya, platform)
     self.entity_id = ENTITY_ID_FORMAT.format(tuya.object_id())
     self.operations = [HVAC_MODE_OFF]
     self._has_operation = False
     self._def_hvac_mode = HVAC_MODE_AUTO
     self._min_temp = None
     self._max_temp = None
示例#6
0
    def __init__(self, client, heater, room) -> None:
        """Initialize the climate device."""
        super().__init__()

        self._unique_id = f"{heater.serial_no}_{room.room_no}"
        self.entity_id = ENTITY_ID_FORMAT.format(f"{DOMAIN}_{room.room_no}")
        self._name = f"Thermostat {room.room_no}"

        self._client = client
        self._room = room
示例#7
0
    def __init__(self, hass, device, endpoint):
        """Initialize the ZiGate climate."""
        self._device = device
        self._endpoint = endpoint
        ieee = device.ieee or device.addr  # compatibility
        entity_id = 'zigate_{}_{}'.format(ieee, endpoint)
        self.entity_id = ENTITY_ID_FORMAT.format(entity_id)
        hass.bus.listen('zigate.attribute_updated', self._handle_event)

        self._support_flags = SUPPORT_FLAGS
示例#8
0
    def __init__(self, uplink, system_id: int, statuses: Set[str],
                 climate: ClimateSystem):
        """Init."""
        super().__init__(uplink, system_id, statuses, climate)

        self.entity_id = ENTITY_ID_FORMAT.format("{}_{}_{}_room".format(
            DOMAIN_NIBE, system_id, str(climate.name)))

        self.get_parameters([
            self._climate.room_temp,
            self._climate.room_setpoint_heat,
            self._climate.room_setpoint_cool,
        ])
示例#9
0
文件: climate.py 项目: JLFN/hass_nibe
    def __init__(self, uplink, system_id: int, statuses: Set[str],
                 climate: ClimateDevice):
        """Init."""
        super().__init__(uplink, system_id, statuses, climate)
        self._adjust_id = None
        self._target_id = None

        self.entity_id = ENTITY_ID_FORMAT.format('{}_{}_{}_supply'.format(
            DOMAIN_NIBE, system_id, str(climate.name)))

        self.get_parameters([
            self._climate.supply_temp, self._climate.calc_supply_temp_heat,
            self._climate.calc_supply_temp_cool, self._climate.offset_heat,
            self._climate.offset_cool, self._climate.external_adjustment_active
        ])
示例#10
0
    def __init__(self, hass, HiveComponent_HiveObjects, NodeID, NodeName, DeviceType):
        """Initialize the HotWater device."""
        self.HiveObjects = HiveComponent_HiveObjects
        self.NodeID = NodeID
        self.NodeName = NodeName
        self.DeviceType = DeviceType

        SetEntityID = "Hive_HotWater"
        self.entity_id = ENTITY_ID_FORMAT.format(SetEntityID.lower())


        def handle_event(event):
            tmp_attribute = None
            self.schedule_update_ha_state()

        hass.bus.listen('Event_Hive_NewNodeData', handle_event)
示例#11
0
 def __init__(self, uplink, name: str, system_id: int, current_id: str,
              target_id: str, adjust_id: str, active_id: str,
              object_id: str):
     super(NibeClimate, self).__init__(uplink, system_id)
     self._name = name
     self._current_id = current_id
     self._target_id = target_id
     self._adjust_id = adjust_id
     self._active_id = active_id
     self._unit = None
     self._current = None
     self._target = None
     self._adjust = None
     self._active = None
     self._status = 'DONE'
     if object_id:  # Forced id on discovery
         self.entity_id = ENTITY_ID_FORMAT.format(object_id)
示例#12
0
    def __init__(self, system: NibeSystem, climate: ClimateSystem):
        """Init."""

        parameters = {
            climate.room_temp,
            climate.room_setpoint_heat,
            climate.room_setpoint_cool,
        }

        super().__init__(system, climate, parameters)

        self.entity_id = ENTITY_ID_FORMAT.format(
            "{}_{}_{}_room".format(DOMAIN_NIBE, system.system_id, str(climate.name))
        )

        self._attr_name = "{} Room".format(self._climate.name)
        self._attr_unique_id = "{}_{}".format(super().unique_id, "room")
        self._attr_max_temp = 35.0
        self._attr_min_temp = 5.0
        self._attr_target_temperature_step = 0.5
示例#13
0
 def __init__(self, dev, idx, val, param):
     """Init LifeSmart cover device."""
     super().__init__(dev, idx, val, param)
     dev['agt'] = dev['agt'].replace("_", "")
     self._name = dev['name']
     cdata = dev['data']
     self.entity_id = ENTITY_ID_FORMAT.format(
         (dev['devtype'] + "_" + dev['agt'] + "_" +
          dev['me']).lower().replace(":", "_").replace("@", "_"))
     self._modes = LIFESMART_STATE_LIST
     if cdata['O']['type'] % 2 == 0:
         self._mode = LIFESMART_STATE_LIST[0]
     else:
         self._mode = LIFESMART_STATE_LIST[cdata['MODE']['val']]
     self._attributes.update(
         {"last_mode": LIFESMART_STATE_LIST[cdata['MODE']['val']]})
     self._current_temperature = cdata['T']['v']
     self._target_temperature = cdata['tT']['v']
     self._min_temp = 10
     self._max_temp = 35
     self._fanspeed = cdata['F']['val']
示例#14
0
    def __init__(self, system: NibeSystem, climate: ClimateSystem):
        """Init."""

        parameters = {
            climate.supply_temp,
            climate.calc_supply_temp_heat,
            climate.calc_supply_temp_cool,
            climate.offset_heat,
            climate.offset_cool,
            climate.external_adjustment_active,
        }

        super().__init__(system, climate, parameters)

        self.entity_id = ENTITY_ID_FORMAT.format(
            "{}_{}_{}_supply".format(DOMAIN_NIBE, system.system_id, str(climate.name))
        )
        self._attr_name = "{} Supply".format(self._climate.name)
        self._attr_unique_id = "{}_{}".format(super().unique_id, "supply")
        self._attr_max_temp = 50.0
        self._attr_min_temp = 5.0
        self._attr_target_temperature_step = 1.0
示例#15
0
 def __init__(self, vera_device, controller):
     """Initialize the Vera device."""
     VeraDevice.__init__(self, vera_device, controller)
     self.entity_id = ENTITY_ID_FORMAT.format(self.vera_id)
示例#16
0
 def __init__(self, vera_device, controller):
     """Initialize the Vera device."""
     VeraDevice.__init__(self, vera_device, controller)
     self.entity_id = ENTITY_ID_FORMAT.format(self.vera_id)
示例#17
0
 def __init__(self, hass, homee_node, cube):
     HomeeDevice.__init__(self, hass, homee_node, cube)
     self.entity_id = ENTITY_ID_FORMAT.format(self.homee_id)
示例#18
0
 def __init__(self, vera_device: veraApi.VeraThermostat,
              controller_data: ControllerData) -> None:
     """Initialize the Vera device."""
     VeraDevice.__init__(self, vera_device, controller_data)
     self.entity_id = ENTITY_ID_FORMAT.format(self.vera_id)
示例#19
0
    def __init__(self, fibaro_device):
        """Initialize the Fibaro device."""
        super().__init__(fibaro_device)
        self._temp_sensor_device = None
        self._target_temp_device = None
        self._op_mode_device = None
        self._fan_mode_device = None
        self._support_flags = 0
        self.entity_id = ENTITY_ID_FORMAT.format(self.ha_id)
        self._hvac_support = []
        self._preset_support = []
        self._fan_support = []

        siblings = fibaro_device.fibaro_controller.get_siblings(fibaro_device)
        _LOGGER.debug("%s siblings: %s", fibaro_device.ha_id, siblings)
        tempunit = "C"
        for device in siblings:
            # Detecting temperature device, one strong and one weak way of
            # doing so, so we prefer the hard evidence, if there is such.
            if device.type == "com.fibaro.temperatureSensor":
                self._temp_sensor_device = FibaroDevice(device)
                tempunit = device.properties.unit
            elif (self._temp_sensor_device is None
                  and "unit" in device.properties
                  and ("value" in device.properties
                       or "heatingThermostatSetpoint" in device.properties)
                  and device.properties.unit in ("C", "F")):
                self._temp_sensor_device = FibaroDevice(device)
                tempunit = device.properties.unit

            if ("setTargetLevel" in device.actions
                    or "setThermostatSetpoint" in device.actions
                    or "setHeatingThermostatSetpoint" in device.actions):
                self._target_temp_device = FibaroDevice(device)
                self._support_flags |= SUPPORT_TARGET_TEMPERATURE
                tempunit = device.properties.unit

            if "setMode" in device.actions or "setOperatingMode" in device.actions:
                self._op_mode_device = FibaroDevice(device)
                self._support_flags |= SUPPORT_PRESET_MODE

            if "setFanMode" in device.actions:
                self._fan_mode_device = FibaroDevice(device)
                self._support_flags |= SUPPORT_FAN_MODE

        if tempunit == "F":
            self._unit_of_temp = TEMP_FAHRENHEIT
        else:
            self._unit_of_temp = TEMP_CELSIUS

        if self._fan_mode_device:
            fan_modes = (self._fan_mode_device.fibaro_device.properties.
                         supportedModes.split(","))
            for mode in fan_modes:
                mode = int(mode)
                if mode not in FANMODES:
                    _LOGGER.warning("%d unknown fan mode", mode)
                    continue
                self._fan_support.append(FANMODES[int(mode)])

        if self._op_mode_device:
            prop = self._op_mode_device.fibaro_device.properties
            if "supportedOperatingModes" in prop:
                op_modes = prop.supportedOperatingModes.split(",")
            elif "supportedModes" in prop:
                op_modes = prop.supportedModes.split(",")
            for mode in op_modes:
                mode = int(mode)
                if mode in OPMODES_HVAC:
                    mode_ha = OPMODES_HVAC[mode]
                    if mode_ha not in self._hvac_support:
                        self._hvac_support.append(mode_ha)
                if mode in OPMODES_PRESET:
                    self._preset_support.append(OPMODES_PRESET[mode])
示例#20
0
 def __init__(self, tuya):
     """Init climate device."""
     super().__init__(tuya)
     self.entity_id = ENTITY_ID_FORMAT.format(tuya.object_id())
     self.operations = [HVAC_MODE_OFF]
示例#21
0
 def __init__(self, tuya):
     """Init climate device."""
     super().__init__(tuya)
     self.entity_id = ENTITY_ID_FORMAT.format(tuya.object_id())
     self.operations = []