diff --git a/custom_components/airobot_thermostat/climate.py b/custom_components/airobot_thermostat/climate.py index c104736..14d2f13 100644 --- a/custom_components/airobot_thermostat/climate.py +++ b/custom_components/airobot_thermostat/climate.py @@ -28,6 +28,10 @@ def __init__(self, coordinator): self._attr_preset_modes = [PRESET_HOME, PRESET_AWAY] self._attr_preset_mode = None + @property + def device_info(self): + return self.coordinator.device_info + @property def preset_mode(self): mode = self.coordinator.data.get("preset_mode", 1) # Default to Home diff --git a/custom_components/airobot_thermostat/coordinator.py b/custom_components/airobot_thermostat/coordinator.py index 12133a9..acfc521 100644 --- a/custom_components/airobot_thermostat/coordinator.py +++ b/custom_components/airobot_thermostat/coordinator.py @@ -24,6 +24,15 @@ def __init__(self, hass, room, host, username, password): update_interval=timedelta(seconds=15), ) + @property + def device_info(self): + return { + "identifiers": {(DOMAIN, self._username)}, + "name": f"Airobot {self._room} Thermostat", + "manufacturer": "Airobot", + "model": "Thermostat", + } + def _get_headers(self): """Return the headers for REST API with proper Basic Authentication.""" credentials = f"{self._username}:{self._password}" diff --git a/custom_components/airobot_thermostat/sensor.py b/custom_components/airobot_thermostat/sensor.py index f07c720..1c62f96 100644 --- a/custom_components/airobot_thermostat/sensor.py +++ b/custom_components/airobot_thermostat/sensor.py @@ -32,6 +32,10 @@ def __init__(self, coordinator): self._attr_device_class = "temperature" self._attr_state_class = "measurement" + @property + def device_info(self): + return self.coordinator.device_info + @property def state(self): return self.coordinator.data["temperature"] @@ -47,6 +51,10 @@ def __init__(self, coordinator): self._attr_device_class = "humidity" self._attr_state_class = "measurement" + @property + def device_info(self): + return self.coordinator.device_info + @property def state(self): return self.coordinator.data["humidity"] @@ -62,6 +70,10 @@ def __init__(self, coordinator): self._attr_device_class = "carbon_dioxide" self._attr_state_class = "measurement" + @property + def device_info(self): + return self.coordinator.device_info + @property def state(self): return self.coordinator.data["co2"] @@ -74,6 +86,10 @@ def __init__(self, coordinator): self._attr_name = f"Airobot {coordinator._room} Heating Status" self._attr_unique_id = f"{DOMAIN}_{coordinator._username}_{coordinator._room}_heating_status" + @property + def device_info(self): + return self.coordinator.device_info + @property def state(self): """Return the state of the sensor.""" @@ -96,6 +112,10 @@ def __init__(self, coordinator): self._attr_device_class = "temperature" self._attr_state_class = "measurement" + @property + def device_info(self): + return self.coordinator.device_info + @property def state(self): """Return the state of the sensor."""