Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Versions from 0.40 and up

## Ongoing

- Add a ThermoZone to Anna

Comment on lines +5 to +8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Document the breaking changes and provide migration guidance.

This change introduces breaking changes for Anna users (entity_id and unique_id changes from anna to living_room, as evidenced by the test snapshots). The changelog should:

  • Clearly mark this as a BREAKING change
  • Explain that existing climate.anna entities will become climate.living_room
  • Provide migration steps for users (automations, dashboards, etc. will need updates)
  • Explain the new ThermoZone concept and architecture

Consider adding something like:

 ## Ongoing
 
-- Add a ThermoZone to Anna
+- **BREAKING**: Add a ThermoZone to Anna - climate entities are now zone-based
+  - Climate entity IDs change from `climate.anna` to `climate.living_room` (or the zone name)
+  - Users will need to update automations, dashboards, and scripts that reference the old entity IDs
+  - The Anna device now represents the physical thermostat, while a new ThermoZone device represents the climate control zone
🤖 Prompt for AI Agents
In CHANGELOG.md around lines 5 to 8, mark the addition of ThermoZone as a
BREAKING change and expand the entry to document what changed and how to
migrate: state that entity_id and unique_id for Anna changed from anna to
living_room (e.g., climate.anna -> climate.living_room), add clear migration
steps for users to update automations, dashboards, and YAML/config references,
summarize the new ThermoZone concept and architecture at a high level, and
include any notes about compatibility or scripts/commands to help bulk-rename or
map old IDs to new ones.

## v0.59.0

- New Feature: use RestoreState in climate to save schedule en regulation status, also via plugwise [v1.8.3](https://github.com/plugwise/python-plugwise/releases/tag/v1.8.3)
Expand All @@ -15,7 +19,6 @@ Versions from 0.40 and up

- Fix mypy errors in Core (not accepted in HA Core)
- Introduce Snapshot testing for all platforms (requirement from HA Core)
- New Feature: add initial support for the Emma via plugwise [v1.8.0](https://github.com/plugwise/python-plugwise/releases/tag/v1.8.0)

## v0.57.6

Expand Down
24 changes: 5 additions & 19 deletions custom_components/plugwise/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@
CONTROL_STATE,
DEV_CLASS,
DOMAIN,
LOCATION,
LOGGER,
LOWER_BOUND,
MASTER_THERMOSTATS,
REGULATION_MODES,
RESOLUTION,
SELECT_REGULATION_MODE,
Expand Down Expand Up @@ -76,18 +74,9 @@ def _add_entities() -> None:
return

entities: list[PlugwiseClimateEntity] = []
gateway_name = coordinator.api.smile.name
for device_id in coordinator.new_devices:
device = coordinator.data[device_id]
if gateway_name == "Adam":
if device[DEV_CLASS] == "climate":
entities.append(
PlugwiseClimateEntity(
coordinator, device_id, homekit_enabled
) # pw-beta homekit emulation
)
LOGGER.debug("Add climate %s", device[ATTR_NAME])
elif device[DEV_CLASS] in MASTER_THERMOSTATS:
if device[DEV_CLASS] == "climate":
entities.append(
PlugwiseClimateEntity(
coordinator, device_id, homekit_enabled
Expand Down Expand Up @@ -160,10 +149,7 @@ def __init__(
gateway_id: str = coordinator.api.gateway_id
self._gateway_data = coordinator.data[gateway_id]
self._homekit_enabled = homekit_enabled # pw-beta homekit emulation
self._location = device_id
if (location := self.device.get(LOCATION)) is not None:
self._location = location

self._location_id = device_id
self._attr_max_temp = min(self.device.get(THERMOSTAT, {}).get(UPPER_BOUND, 35.0), 35.0)
self._attr_min_temp = self.device.get(THERMOSTAT, {}).get(LOWER_BOUND, 0.0)
# Ensure we don't drop below 0.1
Expand Down Expand Up @@ -311,7 +297,7 @@ async def async_set_temperature(self, **kwargs: Any) -> None:
if mode := kwargs.get(ATTR_HVAC_MODE):
await self.async_set_hvac_mode(mode)

await self.coordinator.api.set_temperature(self._location, data)
await self.coordinator.api.set_temperature(self._location_id, data)

@plugwise_command
async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
Expand All @@ -334,7 +320,7 @@ async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
raise HomeAssistantError(ERROR_NO_SCHEDULE)

await self.coordinator.api.set_schedule_state(
self._location,
self._location_id,
STATE_ON if hvac_mode == HVACMode.AUTO else STATE_OFF,
desired,
)
Expand Down Expand Up @@ -363,4 +349,4 @@ async def _homekit_translate_or_not(self, mode: HVACMode) -> None:
@plugwise_command
async def async_set_preset_mode(self, preset_mode: str) -> None:
"""Set the preset mode."""
await self.coordinator.api.set_preset(self._location, preset_mode)
await self.coordinator.api.set_preset(self._location_id, preset_mode)
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,17 @@
"vendor": "Techneco"
},
"3cb70739631c4d17a86b8b12e8a5161b": {
"active_preset": "home",
"available_schedules": ["standaard", "off"],
"climate_mode": "auto",
"control_state": "heating",
"dev_class": "thermostat",
"firmware": "2018-02-08T11:15:53+01:00",
"hardware": "6539-1301-5002",
"location": "c784ee9fdab44e1395b8dee7d7a497d5",
"model": "ThermoTouch",
"name": "Anna",
"preset_modes": ["no_frost", "home", "away", "asleep", "vacation"],
"select_schedule": "standaard",
"sensors": {
"cooling_activation_outdoor_temperature": 21.0,
"cooling_deactivation_threshold": 4.0,
"illuminance": 86.0,
"setpoint_high": 30.0,
"setpoint_low": 20.5,
"setpoint": 20.5,
"temperature": 19.3
},
"temperature_offset": {
Expand All @@ -85,13 +78,34 @@
"setpoint": -0.5,
"upper_bound": 2.0
},
"vendor": "Plugwise"
},
"c784ee9fdab44e1395b8dee7d7a497d5": {
"active_preset": "home",
"available_schedules": ["standaard", "off"],
"climate_mode": "auto",
"control_state": "idle",
"dev_class": "climate",
"model": "ThermoZone",
"name": "Living room",
"preset_modes": ["no_frost", "home", "away", "asleep", "vacation"],
"select_schedule": "standaard",
"sensors": {
"setpoint_high": 30.0,
"setpoint_low": 20.5,
"temperature": 23.3
},
"thermostat": {
"lower_bound": 4.0,
"resolution": 0.1,
"setpoint_high": 30.0,
"setpoint_low": 20.5,
"upper_bound": 30.0
},
"thermostats": {
"primary": ["3cb70739631c4d17a86b8b12e8a5161b"],
"secondary": []
},
"vendor": "Plugwise"
}
}
37 changes: 25 additions & 12 deletions tests/components/plugwise/fixtures/anna_v4/data.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
{
"01b85360fdd243d0aaad4d6ac2a5ba7e": {
"active_preset": "home",
"available_schedules": ["Standaard", "Thuiswerken", "off"],
"climate_mode": "heat",
"control_state": "heating",
"dev_class": "thermostat",
"firmware": "2018-02-08T11:15:53+01:00",
"hardware": "6539-1301-5002",
"location": "eb5309212bf5407bb143e5bfa3b18aee",
"model": "ThermoTouch",
"name": "Anna",
"preset_modes": ["vacation", "no_frost", "away", "asleep", "home"],
"select_schedule": "off",
"sensors": {
"illuminance": 60.0,
"setpoint": 20.5,
Expand All @@ -23,12 +17,6 @@
"setpoint": 0.0,
"upper_bound": 2.0
},
"thermostat": {
"lower_bound": 4.0,
"resolution": 0.1,
"setpoint": 20.5,
"upper_bound": 30.0
},
"vendor": "Plugwise"
},
"0466eae8520144c78afb29628384edeb": {
Expand Down Expand Up @@ -84,5 +72,30 @@
"dhw_cm_switch": false
},
"vendor": "Bosch Thermotechniek B.V."
},
"eb5309212bf5407bb143e5bfa3b18aee": {
"active_preset": "home",
"available_schedules": ["Standaard", "Thuiswerken", "off"],
"climate_mode": "heat",
"control_state": "idle",
"dev_class": "climate",
"model": "ThermoZone",
"name": "Living room",
"preset_modes": ["vacation", "no_frost", "away", "asleep", "home"],
"select_schedule": "off",
"sensors": {
"temperature": 20.6
},
"thermostat": {
"lower_bound": 4.0,
"resolution": 0.1,
"setpoint": 20.5,
"upper_bound": 30.0
},
"thermostats": {
"primary": ["01b85360fdd243d0aaad4d6ac2a5ba7e"],
"secondary": []
},
"vendor": "Plugwise"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,39 +59,53 @@
"vendor": "Techneco"
},
"3cb70739631c4d17a86b8b12e8a5161b": {
"active_preset": "home",
"available_schedules": ["standaard", "off"],
"climate_mode": "auto",
"control_state": "cooling",
"dev_class": "thermostat",
"firmware": "2018-02-08T11:15:53+01:00",
"hardware": "6539-1301-5002",
"location": "c784ee9fdab44e1395b8dee7d7a497d5",
"model": "ThermoTouch",
"name": "Anna",
"preset_modes": ["no_frost", "home", "away", "asleep", "vacation"],
"select_schedule": "standaard",
"sensors": {
"cooling_activation_outdoor_temperature": 21.0,
"cooling_deactivation_threshold": 4.0,
"illuminance": 86.0,
"setpoint_high": 30.0,
"setpoint_low": 20.5,
"temperature": 26.3
"setpoint": 20.5,
"temperature": 19.3
},
"temperature_offset": {
"lower_bound": -2.0,
"resolution": 0.1,
"setpoint": -0.5,
"upper_bound": 2.0
},
"vendor": "Plugwise"
},
"c784ee9fdab44e1395b8dee7d7a497d5": {
"active_preset": "home",
"available_schedules": ["standaard", "off"],
"climate_mode": "auto",
"control_state": "cooling",
"dev_class": "climate",
"model": "ThermoZone",
"name": "Living room",
"preset_modes": ["no_frost", "home", "away", "asleep", "vacation"],
"select_schedule": "standaard",
"sensors": {
"setpoint_high": 30.0,
"setpoint_low": 20.5,
"temperature": 26.3
},
"thermostat": {
"lower_bound": 4.0,
"resolution": 0.1,
"setpoint_high": 30.0,
"setpoint_low": 20.5,
"upper_bound": 30.0
},
"thermostats": {
"primary": ["3cb70739631c4d17a86b8b12e8a5161b"],
"secondary": []
},
"vendor": "Plugwise"
}
}
35 changes: 25 additions & 10 deletions tests/components/plugwise/fixtures/m_anna_heatpump_idle/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,39 +59,54 @@
"vendor": "Techneco"
},
"3cb70739631c4d17a86b8b12e8a5161b": {
"active_preset": "home",
"available_schedules": ["standaard", "off"],
"climate_mode": "auto",
"control_state": "idle",
"dev_class": "thermostat",
"firmware": "2018-02-08T11:15:53+01:00",
"hardware": "6539-1301-5002",
"location": "c784ee9fdab44e1395b8dee7d7a497d5",
"model": "ThermoTouch",
"name": "Anna",
"preset_modes": ["no_frost", "home", "away", "asleep", "vacation"],
"select_schedule": "standaard",
"sensors": {
"cooling_activation_outdoor_temperature": 25.0,
"cooling_activation_outdoor_temperature": 21.0,
"cooling_deactivation_threshold": 4.0,
"illuminance": 86.0,
"setpoint_high": 30.0,
"setpoint_low": 20.5,
"temperature": 23.0
"setpoint": 20.5,
"temperature": 19.3
},
"temperature_offset": {
"lower_bound": -2.0,
"resolution": 0.1,
"setpoint": -0.5,
"upper_bound": 2.0
},
"vendor": "Plugwise"
},
"c784ee9fdab44e1395b8dee7d7a497d5": {
"active_preset": "home",
"available_schedules": ["standaard", "off"],
"climate_mode": "auto",
"control_state": "idle",
"dev_class": "climate",
"model": "ThermoZone",
"name": "Living room",
"preset_modes": ["no_frost", "home", "away", "asleep", "vacation"],
"select_schedule": "standaard",
"sensors": {
"cooling_activation_outdoor_temperature": 25.0,
"setpoint_high": 30.0,
"setpoint_low": 20.5,
"temperature": 23.0
},
"thermostat": {
"lower_bound": 4.0,
"resolution": 0.1,
"setpoint_high": 30.0,
"setpoint_low": 20.5,
"upper_bound": 30.0
},
"thermostats": {
"primary": ["3cb70739631c4d17a86b8b12e8a5161b"],
"secondary": []
},
"vendor": "Plugwise"
}
}
Loading
Loading