Exemplo n.º 1
0
    def __init__(self, data_handler: NetatmoDataHandler, home_id: str,
                 room_id: str) -> None:
        """Initialize the sensor."""
        ClimateEntity.__init__(self)
        super().__init__(data_handler)

        self._id = room_id
        self._home_id = home_id

        self._home_status_class = f"{HOMESTATUS_DATA_CLASS_NAME}-{self._home_id}"

        self._data_classes.extend([
            {
                "name": HOMEDATA_DATA_CLASS_NAME,
                SIGNAL_NAME: HOMEDATA_DATA_CLASS_NAME,
            },
            {
                "name": HOMESTATUS_DATA_CLASS_NAME,
                "home_id": self._home_id,
                SIGNAL_NAME: self._home_status_class,
            },
        ])

        self._home_status = self.data_handler.data[self._home_status_class]
        self._room_status = self._home_status.rooms[room_id]
        self._room_data: dict = self._data.rooms[home_id][room_id]

        self._model: str = NA_VALVE
        for module in self._room_data.get("module_ids", []):
            if self._home_status.thermostats.get(module):
                self._model = NA_THERM
                break

        self._netatmo_type = TYPE_ENERGY

        self._device_name = self._data.rooms[home_id][room_id]["name"]
        self._attr_name = f"{MANUFACTURER} {self._device_name}"
        self._current_temperature: float | None = None
        self._target_temperature: float | None = None
        self._preset: str | None = None
        self._away: bool | None = None
        self._operation_list = [HVAC_MODE_AUTO, HVAC_MODE_HEAT]
        self._support_flags = SUPPORT_FLAGS
        self._hvac_mode: str = HVAC_MODE_AUTO
        self._battery_level = None
        self._connected: bool | None = None

        self._away_temperature: float | None = None
        self._hg_temperature: float | None = None
        self._boilerstatus: bool | None = None
        self._setpoint_duration = None
        self._selected_schedule = None

        if self._model == NA_THERM:
            self._operation_list.append(HVAC_MODE_OFF)

        self._attr_max_temp = DEFAULT_MAX_TEMP
        self._attr_unique_id = f"{self._id}-{self._model}"
Exemplo n.º 2
0
    def __init__(self, data_handler, home_id, room_id):
        """Initialize the sensor."""
        ClimateEntity.__init__(self)
        super().__init__(data_handler)

        self._id = room_id
        self._home_id = home_id

        self._home_status_class = f"{HOMESTATUS_DATA_CLASS_NAME}-{self._home_id}"

        self._data_classes.extend(
            [
                {
                    "name": HOMEDATA_DATA_CLASS_NAME,
                    SIGNAL_NAME: HOMEDATA_DATA_CLASS_NAME,
                },
                {
                    "name": HOMESTATUS_DATA_CLASS_NAME,
                    "home_id": self._home_id,
                    SIGNAL_NAME: self._home_status_class,
                },
            ]
        )

        self._home_status = self.data_handler.data[self._home_status_class]
        self._room_status = self._home_status.rooms[room_id]
        self._room_data = self._data.rooms[home_id][room_id]

        self._model = NA_VALVE
        for module in self._room_data.get("module_ids"):
            if self._home_status.thermostats.get(module):
                self._model = NA_THERM
                break

        self._state = None
        self._device_name = self._data.rooms[home_id][room_id]["name"]
        self._name = f"{MANUFACTURER} {self._device_name}"
        self._current_temperature = None
        self._target_temperature = None
        self._preset = None
        self._away = None
        self._operation_list = [HVAC_MODE_AUTO, HVAC_MODE_HEAT]
        self._support_flags = SUPPORT_FLAGS
        self._hvac_mode = None
        self._battery_level = None
        self._connected = None

        self._away_temperature = None
        self._hg_temperature = None
        self._boilerstatus = None
        self._setpoint_duration = None
        self._selected_schedule = None

        if self._model == NA_THERM:
            self._operation_list.append(HVAC_MODE_OFF)

        self._unique_id = f"{self._id}-{self._model}"
Exemplo n.º 3
0
    def __init__(
        self, data_handler: NetatmoDataHandler, room: pyatmo.climate.NetatmoRoom
    ) -> None:
        """Initialize the sensor."""
        ClimateEntity.__init__(self)
        super().__init__(data_handler)

        self._room = room
        self._id = self._room.entity_id

        self._climate_state_class = (
            f"{CLIMATE_STATE_CLASS_NAME}-{self._room.home.entity_id}"
        )
        self._climate_state: pyatmo.AsyncClimate = data_handler.data[
            self._climate_state_class
        ]

        self._data_classes.extend(
            [
                {
                    "name": CLIMATE_TOPOLOGY_CLASS_NAME,
                    SIGNAL_NAME: CLIMATE_TOPOLOGY_CLASS_NAME,
                },
                {
                    "name": CLIMATE_STATE_CLASS_NAME,
                    "home_id": self._room.home.entity_id,
                    SIGNAL_NAME: self._climate_state_class,
                },
            ]
        )

        self._model: str = getattr(room.device_type, "value")

        self._netatmo_type = TYPE_ENERGY

        self._attr_name = self._room.name
        self._away: bool | None = None
        self._connected: bool | None = None

        self._away_temperature: float | None = None
        self._hg_temperature: float | None = None
        self._boilerstatus: bool | None = None
        self._selected_schedule = None

        self._attr_hvac_modes = [HVAC_MODE_AUTO, HVAC_MODE_HEAT]
        if self._model == NA_THERM:
            self._attr_hvac_modes.append(HVAC_MODE_OFF)

        self._attr_unique_id = f"{self._room.entity_id}-{self._model}"
Exemplo n.º 4
0
    def __init__(self, data_handler, data_class, home_id, room_id):
        """Initialize the sensor."""
        ClimateEntity.__init__(self)
        NetatmoBase.__init__(self, data_handler)

        self._room_id = room_id
        self._home_id = home_id

        self._home_status_class = f"HomeStatus-{self._home_id}"

        self._data_classes.extend([{
            "name": data_class
        }, {
            "name": "HomeStatus",
            "home_id": self._home_id
        }])

        self._home_status = self.data_handler.data[self._home_status_class]
        self._room_status = self._home_status.rooms[room_id]
        self._room_data = self._data.rooms[home_id][room_id]

        self._module_type = NA_VALVE
        for module in self._room_data.get("module_ids"):
            if self._home_status.thermostats.get(module):
                self._module_type = NA_THERM

        self._state = None
        self._room_name = self._data.rooms[home_id][room_id]["name"]
        self._name = f"{MANUFACTURER} {self._room_name}"
        self._current_temperature = None
        self._target_temperature = None
        self._preset = None
        self._away = None
        self._operation_list = [HVAC_MODE_AUTO, HVAC_MODE_HEAT]
        self._support_flags = SUPPORT_FLAGS
        self._hvac_mode = None
        self._battery_level = None
        self._connected = None

        self._away_temperature = None
        self._hg_temperature = None
        self._boilerstatus = None
        self._setpoint_duration = None

        if self._module_type == NA_THERM:
            self._operation_list.append(HVAC_MODE_OFF)

        self._unique_id = f"{self._room_id}-{self._module_type}"