Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2f2461c
Add updated userdata for Anna Elga cooling change to heating
bouwew Dec 6, 2024
fc76fef
Extend related test
bouwew Dec 6, 2024
ec9142e
Add related test-data json-file
bouwew Dec 6, 2024
a830c32
Correct directory name
bouwew Dec 6, 2024
07ecca3
Correct related test-case
bouwew Dec 6, 2024
c2e06ab
Userdata fixes
bouwew Dec 6, 2024
e46042e
Assert fix
bouwew Dec 6, 2024
74509da
Improve helper.py
bouwew Dec 6, 2024
5b8baf2
test_anna: fix to smile._cooling_enabled
bouwew Dec 7, 2024
2a90f25
Make _cooling_enabled for Smile class
bouwew Dec 7, 2024
7e7930e
test_anna: also fix to smile._cooling_active
bouwew Dec 7, 2024
16356c9
Test-adam also add/improve cooling asserts
bouwew Dec 7, 2024
45adc06
Disable setting self._cooling_enabled in smile.py
bouwew Dec 7, 2024
8293aa5
Extend test_init output
bouwew Dec 7, 2024
30d52fa
Revert back to self._cooling_*
bouwew Dec 7, 2024
29fe41c
Adam: add cooling_enabled when not in xml-data
bouwew Dec 7, 2024
f0b0cf3
Clean up unused code, clarify function via comment
bouwew Dec 7, 2024
161f5db
Save updated fixture and test-json files
bouwew Dec 7, 2024
12d2566
Revert adding self._cooling_enabled at top-level
bouwew Dec 7, 2024
2b69b2a
Add back setting self._cooling_enabled at top-level
bouwew Dec 7, 2024
62d910c
Another revert
bouwew Dec 7, 2024
ce6176b
Clean up
bouwew Dec 7, 2024
3463856
Add elga_2 tinker_thermostat test
bouwew Dec 7, 2024
573298c
Correct-extend tinker_thermostat_temp()
bouwew Dec 7, 2024
7c6901d
Adapt relevant testcases
bouwew Dec 7, 2024
c2deae7
Elga_2_cooling: tests again after async_update
bouwew Dec 7, 2024
74931e4
Update CHANGELOG
bouwew Dec 7, 2024
4bb7b95
Bump to v1.6.3a0 test-version
bouwew Dec 7, 2024
e654a08
Fix complexity
bouwew Dec 7, 2024
6c4339c
Fix to python 3.13.0
bouwew Dec 7, 2024
66e3ab2
Set cooling_enabled binary_sensor for Loria/Thermastage too
bouwew Dec 8, 2024
54ef0ce
Set to v1.6.3 release-version
bouwew Dec 8, 2024
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
1 change: 1 addition & 0 deletions fixtures/adam_heatpump_cooling/all_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"0ca13e8176204ca7bf6f09de59f81c83": {
"available": true,
"binary_sensors": {
"cooling_enabled": true,
"cooling_state": false,
"dhw_state": true,
"flame_state": false,
Expand Down
1 change: 1 addition & 0 deletions fixtures/adam_onoff_cooling_fake_firmware/all_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"devices": {
"0ca13e8176204ca7bf6f09de59f81c83": {
"binary_sensors": {
"cooling_enabled": true,
"cooling_state": true,
"dhw_state": true,
"flame_state": false,
Expand Down
2 changes: 2 additions & 0 deletions plugwise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def __init__(
self._websession,
)

self._cooling_enabled = False
self._cooling_present = False
self._elga = False
self._is_thermostat = False
Expand Down Expand Up @@ -130,6 +131,7 @@ async def connect(self) -> Version | None:
self._password,
self._request,
self._websession,
self._cooling_enabled,
self._cooling_present,
self._elga,
self._is_thermostat,
Expand Down
9 changes: 7 additions & 2 deletions plugwise/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ def _get_adam_data(self, entity: GwEntityData, data: GwEntityData) -> None:
"""Helper-function for _get_entity_data().

Determine Adam heating-status for on-off heating via valves,
available regulations_modes and thermostat control_states.
available regulations_modes and thermostat control_states,
and add missing cooling_enabled when required.
"""
if self.smile(ADAM):
# Indicate heating_state based on valves being open in case of city-provided heating
Expand All @@ -236,6 +237,11 @@ def _get_adam_data(self, entity: GwEntityData, data: GwEntityData) -> None:
):
data["binary_sensors"]["heating_state"] = self._heating_valves() != 0

# Add cooling_enabled binary_sensor
if entity["dev_class"] == "heater_central" and "binary_sensors" in data:
if "cooling_enabled" not in data["binary_sensors"] and self._cooling_present:
data["binary_sensors"].update({"cooling_enabled": self._cooling_enabled})

# Show the allowed regulation_modes and gateway_modes
if entity["dev_class"] == "gateway":
if self._reg_allowed_modes:
Expand All @@ -245,7 +251,6 @@ def _get_adam_data(self, entity: GwEntityData, data: GwEntityData) -> None:
data["gateway_modes"] = self._gw_allowed_modes
self._count += 1


def _climate_data(
self,
location_id: str,
Expand Down
4 changes: 2 additions & 2 deletions plugwise/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def __init__(self) -> None:
# 'cooling_state' = on means cooling is active.
###################################################################
self._cooling_active = False
self._cooling_enabled = False
self._cooling_enabled: bool

self.gateway_id: str
self.gw_data: GatewayData = {}
Expand Down Expand Up @@ -798,7 +798,7 @@ def _update_elga_cooling(self, data: GwEntityData) -> None:
# Techneco Elga has cooling-capability
self._cooling_present = True
data["model"] = "Generic heater/cooler"
self._cooling_enabled = data["elga_status_code"] in (8, 9)
self._cooling_enabled = data["binary_sensors"]["cooling_enabled"] = data["elga_status_code"] in (8, 9)
data["binary_sensors"]["cooling_state"] = self._cooling_active = (
data["elga_status_code"] == 8
)
Expand Down
12 changes: 4 additions & 8 deletions plugwise/smile.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def __init__(
password: str,
request: Callable[..., Awaitable[Any]],
websession: aiohttp.ClientSession,
_cooling_enabled: bool,
_cooling_present: bool,
_elga: bool,
_is_thermostat: bool,
Expand All @@ -71,7 +72,7 @@ def __init__(
username: str = DEFAULT_USERNAME,
) -> None:
"""Set the constructor for this class."""
self._cooling_enabled = False
self._cooling_enabled = _cooling_enabled
self._cooling_present = _cooling_present
self._elga = _elga
self._heater_id: str
Expand Down Expand Up @@ -131,13 +132,8 @@ async def async_update(self) -> PlugwiseData:
try:
await self.full_xml_update()
self.get_all_gateway_entities()
if "heater_id" in self.gw_data:
heat_cooler = self.gw_entities[self.gw_data["heater_id"]]
if (
"binary_sensors" in heat_cooler
and "cooling_enabled" in heat_cooler["binary_sensors"]
):
self._cooling_enabled = heat_cooler["binary_sensors"]["cooling_enabled"]
# Check for a failed data-retrieval
_ = self.gw_entities[self.gw_data["gateway_id"]]
except KeyError as err:
raise DataMissingError("No Plugwise data received") from err

Expand Down
1 change: 1 addition & 0 deletions tests/data/adam/adam_heatpump_cooling.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"0ca13e8176204ca7bf6f09de59f81c83": {
"available": true,
"binary_sensors": {
"cooling_enabled": true,
"cooling_state": false,
"dhw_state": true,
"flame_state": false,
Expand Down
1 change: 1 addition & 0 deletions tests/data/adam/adam_onoff_cooling_fake_firmware.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"entities": {
"0ca13e8176204ca7bf6f09de59f81c83": {
"binary_sensors": {
"cooling_enabled": true,
"cooling_state": true,
"dhw_state": true,
"flame_state": false,
Expand Down
100 changes: 100 additions & 0 deletions tests/data/anna/anna_elga_2_cooling_UPDATED_DATA.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"entities": {
"573c152e7d4f4720878222bd75638f5b": {
"available": true,
"binary_sensors": {
"compressor_state": true,
"cooling_enabled": false,
"cooling_state": false,
"dhw_state": false,
"flame_state": true,
"heating_state": true,
"secondary_boiler_state": false
},
"dev_class": "heater_central",
"location": "d34dfe6ab90b410c98068e75de3eb631",
"maximum_boiler_temperature": {
"lower_bound": 0.0,
"resolution": 1.0,
"setpoint": 60.0,
"upper_bound": 100.0
},
"model": "Generic heater/cooler",
"name": "OpenTherm",
"sensors": {
"domestic_hot_water_setpoint": 60.0,
"intended_boiler_temperature": 0.0,
"modulation_level": 0.0,
"outdoor_air_temperature": 3.0,
"return_temperature": 23.4,
"water_pressure": 0.5,
"water_temperature": 22.8
},
"switches": {
"dhw_cm_switch": true
},
"vendor": "Techneco"
},
"ebd90df1ab334565b5895f37590ccff4": {
"active_preset": "home",
"available_schedules": [
"Thermostat schedule",
"off"
],
"climate_mode": "auto",
"dev_class": "thermostat",
"firmware": "2018-02-08T11:15:53+01:00",
"hardware": "6539-1301-5002",
"location": "d3ce834534114348be628b61b26d9220",
"model": "ThermoTouch",
"name": "Anna",
"preset_modes": [
"away",
"no_frost",
"vacation",
"home",
"asleep"
],
"select_schedule": "Thermostat schedule",
"sensors": {
"cooling_activation_outdoor_temperature": 26.0,
"cooling_deactivation_threshold": 3.0,
"illuminance": 0.5,
"setpoint_high": 30.0,
"setpoint_low": 19.5,
"temperature": 18.9
},
"temperature_offset": {
"lower_bound": -2.0,
"resolution": 0.1,
"setpoint": 0.0,
"upper_bound": 2.0
},
"thermostat": {
"lower_bound": 4.0,
"resolution": 0.1,
"setpoint_high": 30.0,
"setpoint_low": 19.5,
"upper_bound": 30.0
},
"vendor": "Plugwise"
},
"fb49af122f6e4b0f91267e1cf7666d6f": {
"binary_sensors": {
"plugwise_notification": false
},
"dev_class": "gateway",
"firmware": "4.2.1",
"hardware": "AME Smile 2.0 board",
"location": "d34dfe6ab90b410c98068e75de3eb631",
"mac_address": "C4930002FE76",
"model": "Gateway",
"model_id": "smile_thermo",
"name": "Smile Anna",
"sensors": {
"outdoor_temperature": 3.0
},
"vendor": "Plugwise"
}
}
}
2 changes: 2 additions & 0 deletions tests/test_adam.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ async def test_adam_heatpump_cooling(self):
assert smile._last_active["8cf650a4c10c44819e426bed406aec34"] == WERKDAG_SCHEMA
assert smile._last_active["5cc21042f87f4b4c94ccb5537c47a53f"] == WERKDAG_SCHEMA
assert self.entity_items == 497
assert self.cooling_present
assert self._cooling_enabled

await smile.close_connection()
await self.disconnect(server, client)
Expand Down
13 changes: 13 additions & 0 deletions tests/test_anna.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,19 @@ async def test_connect_anna_elga_2_cooling(self):
assert self._cooling_enabled
assert self._cooling_active

# Simulate a change of season: from cooling to heating after an update_interval
testdata_updated = self.load_testdata(
SMILE_TYPE, f"{self.smile_setup}_UPDATED_DATA"
)

self.smile_setup = "updated/anna_elga_2_switch_heating"
await self.device_test(
smile, "2020-04-05 00:00:01", testdata_updated, initialize=False
)
assert self.cooling_present
assert not self._cooling_enabled
assert not self._cooling_active

await smile.close_connection()
await self.disconnect(server, client)

Expand Down
1 change: 1 addition & 0 deletions tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ def test_and_assert(test_dict, data, header):

_LOGGER.info("Gateway id = %s", data.gateway["gateway_id"])
_LOGGER.info("Hostname = %s", smile.smile_hostname)
_LOGGER.info("_cooling_enabled = %s", smile._cooling_enabled)
_LOGGER.info("Gateway data = %s", data.gateway)
_LOGGER.info("Entities list = %s", data.devices)
self.show_setup(location_list, data.devices)
Expand Down
Empty file.
Loading