From ed36cb7bebf4c55003c54e42417da801edf18e83 Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 17 Nov 2020 02:54:44 +0100 Subject: [PATCH] Add notification binary_sensor to Plugwise integration (#41473) * Notifications extract from beta * Remove info loggings * Delete notification service * Only notifications for right smiles * Revert to correct logic * Catchup with dev (mostly with ourselves from #41201) * Remove debug logging * Naming improvement * Improve test quality as per codecov patch requirement * Revert to original condition (and appropriately test) * Fix delete_notification_service, bring tests fixtures up to 1.6.0 including notifications * Review comment (@bouwew) * Correct test value * Re-apply #40108 fix after rebase sidestep * Update tests/components/plugwise/test_init.py Co-authored-by: Chris Talkington * Add needed state to imports * Remove separate gw unload code * Change entry_fail approach * Revert persistent notification part * Revert persistent notification part - lint * Update homeassistant/components/plugwise/binary_sensor.py Co-authored-by: Martin Hjelmare * Update homeassistant/components/plugwise/binary_sensor.py Co-authored-by: Martin Hjelmare * Rework reuse of sensor in binary_sensor * Explicit state attribute keys * Remove tempfile * List of notifications per severity * Update homeassistant/components/plugwise/binary_sensor.py Co-authored-by: Martin Hjelmare Co-authored-by: Chris Talkington Co-authored-by: Martin Hjelmare --- .../components/plugwise/binary_sensor.py | 96 ++++++++++++++++--- homeassistant/components/plugwise/const.py | 2 + tests/components/plugwise/conftest.py | 6 ++ .../components/plugwise/test_binary_sensor.py | 12 +++ tests/components/plugwise/test_init.py | 18 +++- tests/components/plugwise/test_sensor.py | 15 ++- .../get_all_devices.json | 2 +- .../680423ff840043738f42cc7f1ff97a36.json | 2 +- .../6a3bf693d05e48e0b460c815a4fdd09d.json | 2 +- .../90986d591dcd426cae3ec3e8111ff730.json | 2 +- .../a2c3583e0a6349358998b760cea82d2a.json | 2 +- .../b310b72a0e354bfab43089919b9a88bf.json | 2 +- .../b59bcebaf94b499ea7d46e4a66fb62d8.json | 2 +- .../d3da73bde12a47d5a6b8f9dad971f2ec.json | 2 +- .../df4a4a8169904cdb9c03d61a21f42140.json | 2 +- .../e7693eb9582644e5b865dba8d4447cf1.json | 2 +- .../f1fee6043d3642a9b0a65297455f008e.json | 2 +- .../notifications.json | 1 + .../anna_heatpump/get_all_devices.json | 2 +- .../1cbf783bb11e4a7c8a6843dee3a86927.json | 2 +- .../3cb70739631c4d17a86b8b12e8a5161b.json | 2 +- .../plugwise/anna_heatpump/notifications.json | 1 + .../p1v3_full_option/get_all_devices.json | 2 +- .../e950c7d5e1ee407a858e2a8b5016c8b3.json | 2 +- .../p1v3_full_option/notifications.json | 1 + 25 files changed, 152 insertions(+), 32 deletions(-) create mode 100644 tests/fixtures/plugwise/adam_multiple_devices_per_zone/notifications.json create mode 100644 tests/fixtures/plugwise/anna_heatpump/notifications.json create mode 100644 tests/fixtures/plugwise/p1v3_full_option/notifications.json diff --git a/homeassistant/components/plugwise/binary_sensor.py b/homeassistant/components/plugwise/binary_sensor.py index 2ba85326265..825d27d59bb 100644 --- a/homeassistant/components/plugwise/binary_sensor.py +++ b/homeassistant/components/plugwise/binary_sensor.py @@ -3,7 +3,6 @@ import logging from homeassistant.components.binary_sensor import BinarySensorEntity -from homeassistant.const import STATE_OFF, STATE_ON from homeassistant.core import callback from .const import ( @@ -13,13 +12,16 @@ from .const import ( FLOW_OFF_ICON, FLOW_ON_ICON, IDLE_ICON, + NO_NOTIFICATION_ICON, + NOTIFICATION_ICON, ) -from .sensor import SmileSensor +from .gateway import SmileGateway BINARY_SENSOR_MAP = { "dhw_state": ["Domestic Hot Water State", None], "slave_boiler_state": ["Secondary Heater Device State", None], } +SEVERITIES = ["other", "info", "warning", "error"] _LOGGER = logging.getLogger(__name__) @@ -30,12 +32,13 @@ async def async_setup_entry(hass, config_entry, async_add_entities): coordinator = hass.data[DOMAIN][config_entry.entry_id][COORDINATOR] entities = [] + is_thermostat = api.single_master_thermostat() all_devices = api.get_all_devices() for dev_id, device_properties in all_devices.items(): + if device_properties["class"] == "heater_central": data = api.get_device_data(dev_id) - for binary_sensor in BINARY_SENSOR_MAP: if binary_sensor not in data: continue @@ -47,32 +50,65 @@ async def async_setup_entry(hass, config_entry, async_add_entities): device_properties["name"], dev_id, binary_sensor, - device_properties["class"], ) ) + if device_properties["class"] == "gateway" and is_thermostat is not None: + entities.append( + PwNotifySensor( + api, + coordinator, + device_properties["name"], + dev_id, + "plugwise_notification", + ) + ) + async_add_entities(entities, True) -class PwBinarySensor(SmileSensor, BinarySensorEntity): - """Representation of a Plugwise binary_sensor.""" +class SmileBinarySensor(SmileGateway): + """Represent Smile Binary Sensors.""" - def __init__(self, api, coordinator, name, dev_id, binary_sensor, model): - """Set up the Plugwise API.""" - super().__init__(api, coordinator, name, dev_id, binary_sensor) + def __init__(self, api, coordinator, name, dev_id, binary_sensor): + """Initialise the binary_sensor.""" + super().__init__(api, coordinator, name, dev_id) self._binary_sensor = binary_sensor - self._is_on = False self._icon = None + self._is_on = False + + if dev_id == self._api.heater_id: + self._entity_name = "Auxiliary" + + sensorname = binary_sensor.replace("_", " ").title() + self._name = f"{self._entity_name} {sensorname}" + + if dev_id == self._api.gateway_id: + self._entity_name = f"Smile {self._entity_name}" self._unique_id = f"{dev_id}-{binary_sensor}" + @property + def icon(self): + """Return the icon of this entity.""" + return self._icon + @property def is_on(self): """Return true if the binary sensor is on.""" return self._is_on + @callback + def _async_process_data(self): + """Update the entity.""" + raise NotImplementedError + + +class PwBinarySensor(SmileBinarySensor, BinarySensorEntity): + """Representation of a Plugwise binary_sensor.""" + @callback def _async_process_data(self): """Update the entity.""" @@ -89,10 +125,48 @@ class PwBinarySensor(SmileSensor, BinarySensorEntity): self._is_on = data[self._binary_sensor] - self._state = STATE_ON if self._is_on else STATE_OFF if self._binary_sensor == "dhw_state": self._icon = FLOW_ON_ICON if self._is_on else FLOW_OFF_ICON if self._binary_sensor == "slave_boiler_state": self._icon = FLAME_ICON if self._is_on else IDLE_ICON self.async_write_ha_state() + + +class PwNotifySensor(SmileBinarySensor, BinarySensorEntity): + """Representation of a Plugwise Notification binary_sensor.""" + + def __init__(self, api, coordinator, name, dev_id, binary_sensor): + """Set up the Plugwise API.""" + super().__init__(api, coordinator, name, dev_id, binary_sensor) + + self._attributes = {} + + @property + def device_state_attributes(self): + """Return the state attributes.""" + return self._attributes + + @callback + def _async_process_data(self): + """Update the entity.""" + notify = self._api.notifications + + for severity in SEVERITIES: + self._attributes[f"{severity}_msg"] = [] + + self._is_on = False + self._icon = NO_NOTIFICATION_ICON + + if notify: + self._is_on = True + self._icon = NOTIFICATION_ICON + + for details in notify.values(): + for msg_type, msg in details.items(): + if msg_type not in SEVERITIES: + msg_type = "other" + + self._attributes[f"{msg_type.lower()}_msg"].append(msg) + + self.async_write_ha_state() diff --git a/homeassistant/components/plugwise/const.py b/homeassistant/components/plugwise/const.py index 5c0cf2b097a..f965676aef2 100644 --- a/homeassistant/components/plugwise/const.py +++ b/homeassistant/components/plugwise/const.py @@ -42,6 +42,8 @@ FLOW_OFF_ICON = "mdi:water-pump-off" FLOW_ON_ICON = "mdi:water-pump" IDLE_ICON = "mdi:circle-off-outline" SWITCH_ICON = "mdi:electric-switch" +NO_NOTIFICATION_ICON = "mdi:mailbox-outline" +NOTIFICATION_ICON = "mdi:mailbox-up-outline" COORDINATOR = "coordinator" UNDO_UPDATE_LISTENER = "undo_update_listener" diff --git a/tests/components/plugwise/conftest.py b/tests/components/plugwise/conftest.py index 0f0e4551b1c..938e61146e5 100644 --- a/tests/components/plugwise/conftest.py +++ b/tests/components/plugwise/conftest.py @@ -75,6 +75,8 @@ def mock_smile_adam(): smile_mock.return_value.smile_type = "thermostat" smile_mock.return_value.smile_hostname = "smile98765" + smile_mock.return_value.notifications = _read_json(chosen_env, "notifications") + smile_mock.return_value.connect.side_effect = AsyncMock(return_value=True) smile_mock.return_value.full_update_device.side_effect = AsyncMock( return_value=True @@ -118,6 +120,8 @@ def mock_smile_anna(): smile_mock.return_value.smile_type = "thermostat" smile_mock.return_value.smile_hostname = "smile98765" + smile_mock.return_value.notifications = _read_json(chosen_env, "notifications") + smile_mock.return_value.connect.side_effect = AsyncMock(return_value=True) smile_mock.return_value.full_update_device.side_effect = AsyncMock( return_value=True @@ -161,6 +165,8 @@ def mock_smile_p1(): smile_mock.return_value.smile_type = "power" smile_mock.return_value.smile_hostname = "smile98765" + smile_mock.return_value.notifications = _read_json(chosen_env, "notifications") + smile_mock.return_value.connect.side_effect = AsyncMock(return_value=True) smile_mock.return_value.full_update_device.side_effect = AsyncMock( return_value=True diff --git a/tests/components/plugwise/test_binary_sensor.py b/tests/components/plugwise/test_binary_sensor.py index b2221194d8e..6df5b90878a 100644 --- a/tests/components/plugwise/test_binary_sensor.py +++ b/tests/components/plugwise/test_binary_sensor.py @@ -35,3 +35,15 @@ async def test_anna_climate_binary_sensor_change(hass, mock_smile_anna): state = hass.states.get("binary_sensor.auxiliary_dhw_state") assert str(state.state) == STATE_OFF + + +async def test_adam_climate_binary_sensor_change(hass, mock_smile_adam): + """Test change of climate related binary_sensor entities.""" + entry = await async_init_integration(hass, mock_smile_adam) + assert entry.state == ENTRY_STATE_LOADED + + state = hass.states.get("binary_sensor.adam_plugwise_notification") + assert str(state.state) == STATE_ON + assert "unreachable" in state.attributes.get("warning_msg")[0] + assert not state.attributes.get("error_msg") + assert not state.attributes.get("other_msg") diff --git a/tests/components/plugwise/test_init.py b/tests/components/plugwise/test_init.py index d968f1825f0..db7a71d660b 100644 --- a/tests/components/plugwise/test_init.py +++ b/tests/components/plugwise/test_init.py @@ -5,13 +5,13 @@ import asyncio from Plugwise_Smile.Smile import Smile from homeassistant.components.plugwise import DOMAIN -from homeassistant.components.plugwise.gateway import async_unload_entry from homeassistant.config_entries import ( + ENTRY_STATE_NOT_LOADED, ENTRY_STATE_SETUP_ERROR, ENTRY_STATE_SETUP_RETRY, ) -from tests.common import AsyncMock +from tests.common import AsyncMock, MockConfigEntry from tests.components.plugwise.common import async_init_integration @@ -53,5 +53,17 @@ async def test_unload_entry(hass, mock_smile_adam): entry = await async_init_integration(hass, mock_smile_adam) mock_smile_adam.async_reset = AsyncMock(return_value=True) - assert await async_unload_entry(hass, entry) + await hass.config_entries.async_unload(entry.entry_id) + await hass.async_block_till_done() + assert entry.state == ENTRY_STATE_NOT_LOADED assert not hass.data[DOMAIN] + + +async def test_async_setup_entry_fail(hass): + """Test async_setup_entry.""" + entry = MockConfigEntry(domain=DOMAIN, data={}) + + entry.add_to_hass(hass) + await hass.config_entries.async_setup(entry.entry_id) + await hass.async_block_till_done() + assert entry.state == ENTRY_STATE_SETUP_ERROR diff --git a/tests/components/plugwise/test_sensor.py b/tests/components/plugwise/test_sensor.py index a727337d747..a722749496f 100644 --- a/tests/components/plugwise/test_sensor.py +++ b/tests/components/plugwise/test_sensor.py @@ -2,6 +2,7 @@ from homeassistant.config_entries import ENTRY_STATE_LOADED +from tests.common import Mock from tests.components.plugwise.common import async_init_integration @@ -30,7 +31,7 @@ async def test_adam_climate_sensor_entities(hass, mock_smile_adam): assert int(state.state) == 34 -async def test_anna_climate_sensor_entities(hass, mock_smile_anna): +async def test_anna_as_smt_climate_sensor_entities(hass, mock_smile_anna): """Test creation of climate related sensor entities.""" entry = await async_init_integration(hass, mock_smile_anna) assert entry.state == ENTRY_STATE_LOADED @@ -45,6 +46,16 @@ async def test_anna_climate_sensor_entities(hass, mock_smile_anna): assert float(state.state) == 86.0 +async def test_anna_climate_sensor_entities(hass, mock_smile_anna): + """Test creation of climate related sensor entities as single master thermostat.""" + mock_smile_anna.single_master_thermostat.side_effect = Mock(return_value=False) + entry = await async_init_integration(hass, mock_smile_anna) + assert entry.state == ENTRY_STATE_LOADED + + state = hass.states.get("sensor.auxiliary_outdoor_temperature") + assert float(state.state) == 18.0 + + async def test_p1_dsmr_sensor_entities(hass, mock_smile_p1): """Test creation of power related sensor entities.""" entry = await async_init_integration(hass, mock_smile_p1) @@ -63,7 +74,7 @@ async def test_p1_dsmr_sensor_entities(hass, mock_smile_p1): assert float(state.state) == 442.9 state = hass.states.get("sensor.p1_gas_consumed_cumulative") - assert float(state.state) == 584.9 + assert float(state.state) == 584.85 async def test_stretch_sensor_entities(hass, mock_stretch): diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_all_devices.json b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_all_devices.json index 61ebc4d9a6c..bcaf40b4196 100644 --- a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_all_devices.json +++ b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_all_devices.json @@ -1 +1 @@ -{"df4a4a8169904cdb9c03d61a21f42140": {"name": "Zone Lisa Bios", "types": {"py/set": ["thermostat"]}, "class": "zone_thermostat", "location": "12493538af164a409c6a1c79e38afe1c"}, "b310b72a0e354bfab43089919b9a88bf": {"name": "Floor kraan", "types": {"py/set": ["thermostat"]}, "class": "thermo_sensor", "location": "c50f167537524366a5af7aa3942feb1e"}, "a2c3583e0a6349358998b760cea82d2a": {"name": "Bios Cv Thermostatic Radiator ", "types": {"py/set": ["thermostat"]}, "class": "thermo_sensor", "location": "12493538af164a409c6a1c79e38afe1c"}, "b59bcebaf94b499ea7d46e4a66fb62d8": {"name": "Zone Lisa WK", "types": {"py/set": ["thermostat"]}, "class": "zone_thermostat", "location": "c50f167537524366a5af7aa3942feb1e"}, "fe799307f1624099878210aa0b9f1475": {"name": "Adam", "types": {"py/set": ["temperature", "thermostat", "home"]}, "class": "gateway", "location": "1f9dcf83fd4e4b66b72ff787957bfe5d"}, "d3da73bde12a47d5a6b8f9dad971f2ec": {"name": "Thermostatic Radiator Jessie", "types": {"py/set": ["thermostat"]}, "class": "thermo_sensor", "location": "82fa13f017d240daa0d0ea1775420f24"}, "21f2b542c49845e6bb416884c55778d6": {"name": "Playstation Smart Plug", "types": {"py/set": ["plug", "power"]}, "class": "game_console", "location": "cd143c07248f491493cea0533bc3d669"}, "78d1126fc4c743db81b61c20e88342a7": {"name": "CV Pomp", "types": {"py/set": ["plug", "power"]}, "class": "central_heating_pump", "location": "c50f167537524366a5af7aa3942feb1e"}, "90986d591dcd426cae3ec3e8111ff730": {"name": "Adam", "types": {"py/set": ["temperature", "thermostat", "home"]}, "class": "heater_central", "location": "1f9dcf83fd4e4b66b72ff787957bfe5d"}, "cd0ddb54ef694e11ac18ed1cbce5dbbd": {"name": "NAS", "types": {"py/set": ["plug", "power"]}, "class": "vcr", "location": "cd143c07248f491493cea0533bc3d669"}, "4a810418d5394b3f82727340b91ba740": {"name": "USG Smart Plug", "types": {"py/set": ["plug", "power"]}, "class": "router", "location": "cd143c07248f491493cea0533bc3d669"}, "02cf28bfec924855854c544690a609ef": {"name": "NVR", "types": {"py/set": ["plug", "power"]}, "class": "vcr", "location": "cd143c07248f491493cea0533bc3d669"}, "a28f588dc4a049a483fd03a30361ad3a": {"name": "Fibaro HC2", "types": {"py/set": ["plug", "power"]}, "class": "settop", "location": "cd143c07248f491493cea0533bc3d669"}, "6a3bf693d05e48e0b460c815a4fdd09d": {"name": "Zone Thermostat Jessie", "types": {"py/set": ["thermostat"]}, "class": "zone_thermostat", "location": "82fa13f017d240daa0d0ea1775420f24"}, "680423ff840043738f42cc7f1ff97a36": {"name": "Thermostatic Radiator Badkamer", "types": {"py/set": ["thermostat"]}, "class": "thermo_sensor", "location": "08963fec7c53423ca5680aa4cb502c63"}, "f1fee6043d3642a9b0a65297455f008e": {"name": "Zone Thermostat Badkamer", "types": {"py/set": ["thermostat"]}, "class": "zone_thermostat", "location": "08963fec7c53423ca5680aa4cb502c63"}, "675416a629f343c495449970e2ca37b5": {"name": "Ziggo Modem", "types": {"py/set": ["plug", "power"]}, "class": "router", "location": "cd143c07248f491493cea0533bc3d669"}, "e7693eb9582644e5b865dba8d4447cf1": {"name": "CV Kraan Garage", "types": {"py/set": ["thermostat"]}, "class": "thermostatic_radiator_valve", "location": "446ac08dd04d4eff8ac57489757b7314"}} \ No newline at end of file +{"df4a4a8169904cdb9c03d61a21f42140": {"name": "Zone Lisa Bios", "types": {"py/set": ["thermostat"]}, "class": "zone_thermostat", "location": "12493538af164a409c6a1c79e38afe1c"}, "b310b72a0e354bfab43089919b9a88bf": {"name": "Floor kraan", "types": {"py/set": ["thermostat"]}, "class": "thermo_sensor", "location": "c50f167537524366a5af7aa3942feb1e"}, "a2c3583e0a6349358998b760cea82d2a": {"name": "Bios Cv Thermostatic Radiator ", "types": {"py/set": ["thermostat"]}, "class": "thermo_sensor", "location": "12493538af164a409c6a1c79e38afe1c"}, "b59bcebaf94b499ea7d46e4a66fb62d8": {"name": "Zone Lisa WK", "types": {"py/set": ["thermostat"]}, "class": "zone_thermostat", "location": "c50f167537524366a5af7aa3942feb1e"}, "fe799307f1624099878210aa0b9f1475": {"name": "Adam", "types": {"py/set": ["home", "temperature", "thermostat"]}, "class": "gateway", "location": "1f9dcf83fd4e4b66b72ff787957bfe5d"}, "d3da73bde12a47d5a6b8f9dad971f2ec": {"name": "Thermostatic Radiator Jessie", "types": {"py/set": ["thermostat"]}, "class": "thermo_sensor", "location": "82fa13f017d240daa0d0ea1775420f24"}, "21f2b542c49845e6bb416884c55778d6": {"name": "Playstation Smart Plug", "types": {"py/set": ["plug", "power"]}, "class": "game_console", "location": "cd143c07248f491493cea0533bc3d669"}, "78d1126fc4c743db81b61c20e88342a7": {"name": "CV Pomp", "types": {"py/set": ["plug", "power"]}, "class": "central_heating_pump", "location": "c50f167537524366a5af7aa3942feb1e"}, "90986d591dcd426cae3ec3e8111ff730": {"name": "Adam", "types": {"py/set": ["home", "temperature", "thermostat"]}, "class": "heater_central", "location": "1f9dcf83fd4e4b66b72ff787957bfe5d"}, "cd0ddb54ef694e11ac18ed1cbce5dbbd": {"name": "NAS", "types": {"py/set": ["plug", "power"]}, "class": "vcr", "location": "cd143c07248f491493cea0533bc3d669"}, "4a810418d5394b3f82727340b91ba740": {"name": "USG Smart Plug", "types": {"py/set": ["plug", "power"]}, "class": "router", "location": "cd143c07248f491493cea0533bc3d669"}, "02cf28bfec924855854c544690a609ef": {"name": "NVR", "types": {"py/set": ["plug", "power"]}, "class": "vcr", "location": "cd143c07248f491493cea0533bc3d669"}, "a28f588dc4a049a483fd03a30361ad3a": {"name": "Fibaro HC2", "types": {"py/set": ["plug", "power"]}, "class": "settop", "location": "cd143c07248f491493cea0533bc3d669"}, "6a3bf693d05e48e0b460c815a4fdd09d": {"name": "Zone Thermostat Jessie", "types": {"py/set": ["thermostat"]}, "class": "zone_thermostat", "location": "82fa13f017d240daa0d0ea1775420f24"}, "680423ff840043738f42cc7f1ff97a36": {"name": "Thermostatic Radiator Badkamer", "types": {"py/set": ["thermostat"]}, "class": "thermo_sensor", "location": "08963fec7c53423ca5680aa4cb502c63"}, "f1fee6043d3642a9b0a65297455f008e": {"name": "Zone Thermostat Badkamer", "types": {"py/set": ["thermostat"]}, "class": "zone_thermostat", "location": "08963fec7c53423ca5680aa4cb502c63"}, "675416a629f343c495449970e2ca37b5": {"name": "Ziggo Modem", "types": {"py/set": ["plug", "power"]}, "class": "router", "location": "cd143c07248f491493cea0533bc3d669"}, "e7693eb9582644e5b865dba8d4447cf1": {"name": "CV Kraan Garage", "types": {"py/set": ["thermostat"]}, "class": "thermostatic_radiator_valve", "location": "446ac08dd04d4eff8ac57489757b7314"}} \ No newline at end of file diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/680423ff840043738f42cc7f1ff97a36.json b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/680423ff840043738f42cc7f1ff97a36.json index 75bc62fbad4..6754cf63d2d 100644 --- a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/680423ff840043738f42cc7f1ff97a36.json +++ b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/680423ff840043738f42cc7f1ff97a36.json @@ -1 +1 @@ -{"setpoint": 14.0, "temperature": 19.1, "battery": 0.51, "valve_position": 0.0, "temperature_difference": -0.4} \ No newline at end of file +{"temperature": 19.1, "setpoint": 14.0, "battery": 0.51, "temperature_difference": -0.4, "valve_position": 0.0} \ No newline at end of file diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/6a3bf693d05e48e0b460c815a4fdd09d.json b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/6a3bf693d05e48e0b460c815a4fdd09d.json index 41333f374e1..14d596fb315 100644 --- a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/6a3bf693d05e48e0b460c815a4fdd09d.json +++ b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/6a3bf693d05e48e0b460c815a4fdd09d.json @@ -1 +1 @@ -{"setpoint": 15.0, "temperature": 17.2, "battery": 0.37, "active_preset": "asleep", "presets": {"home": [20.0, 22.0], "no_frost": [10.0, 30.0], "away": [12.0, 25.0], "vacation": [11.0, 28.0], "asleep": [16.0, 24.0]}, "schedule_temperature": 15.0, "available_schedules": ["CV Jessie"], "selected_schedule": "CV Jessie", "last_used": "CV Jessie"} \ No newline at end of file +{"temperature": 17.2, "setpoint": 15.0, "battery": 0.37, "active_preset": "asleep", "presets": {"home": [20.0, 22.0], "no_frost": [10.0, 30.0], "away": [12.0, 25.0], "vacation": [11.0, 28.0], "asleep": [16.0, 24.0]}, "schedule_temperature": 16.5, "available_schedules": ["CV Jessie"], "selected_schedule": "CV Jessie", "last_used": "CV Jessie"} \ No newline at end of file diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/90986d591dcd426cae3ec3e8111ff730.json b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/90986d591dcd426cae3ec3e8111ff730.json index 5e481d36b46..862a3159754 100644 --- a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/90986d591dcd426cae3ec3e8111ff730.json +++ b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/90986d591dcd426cae3ec3e8111ff730.json @@ -1 +1 @@ -{"water_temperature": 70.0, "intended_boiler_temperature": 70.0, "modulation_level": 0.01} \ No newline at end of file +{"water_temperature": 70.0, "intended_boiler_temperature": 70.0, "modulation_level": 0.01, "heating_state": true} \ No newline at end of file diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/a2c3583e0a6349358998b760cea82d2a.json b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/a2c3583e0a6349358998b760cea82d2a.json index eef83a67a20..c3e1a35b292 100644 --- a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/a2c3583e0a6349358998b760cea82d2a.json +++ b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/a2c3583e0a6349358998b760cea82d2a.json @@ -1 +1 @@ -{"setpoint": 13.0, "temperature": 17.2, "battery": 0.62, "valve_position": 0.0, "temperature_difference": -0.2} \ No newline at end of file +{"temperature": 17.2, "setpoint": 13.0, "battery": 0.62, "temperature_difference": -0.2, "valve_position": 0.0} \ No newline at end of file diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/b310b72a0e354bfab43089919b9a88bf.json b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/b310b72a0e354bfab43089919b9a88bf.json index 16da5f44ef5..8478716dc7b 100644 --- a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/b310b72a0e354bfab43089919b9a88bf.json +++ b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/b310b72a0e354bfab43089919b9a88bf.json @@ -1 +1 @@ -{"setpoint": 21.5, "temperature": 26.0, "valve_position": 1.0, "temperature_difference": 3.5} \ No newline at end of file +{"temperature": 26.0, "setpoint": 21.5, "temperature_difference": 3.5, "valve_position": 1.0} \ No newline at end of file diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/b59bcebaf94b499ea7d46e4a66fb62d8.json b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/b59bcebaf94b499ea7d46e4a66fb62d8.json index 65fa0dd3d52..6d1a8d135a4 100644 --- a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/b59bcebaf94b499ea7d46e4a66fb62d8.json +++ b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/b59bcebaf94b499ea7d46e4a66fb62d8.json @@ -1 +1 @@ -{"setpoint": 21.5, "temperature": 20.9, "battery": 0.34, "active_preset": "home", "presets": {"vacation": [15.0, 28.0], "asleep": [18.0, 24.0], "no_frost": [12.0, 30.0], "away": [17.0, 25.0], "home": [21.5, 22.0]}, "schedule_temperature": 21.5, "available_schedules": ["GF7 Woonkamer"], "selected_schedule": "GF7 Woonkamer", "last_used": "GF7 Woonkamer"} \ No newline at end of file +{"temperature": 20.9, "setpoint": 21.5, "battery": 0.34, "active_preset": "home", "presets": {"vacation": [15.0, 28.0], "asleep": [18.0, 24.0], "no_frost": [12.0, 30.0], "away": [17.0, 25.0], "home": [21.5, 22.0]}, "schedule_temperature": 21.5, "available_schedules": ["GF7 Woonkamer"], "selected_schedule": "GF7 Woonkamer", "last_used": "GF7 Woonkamer"} \ No newline at end of file diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/d3da73bde12a47d5a6b8f9dad971f2ec.json b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/d3da73bde12a47d5a6b8f9dad971f2ec.json index fd202e05586..b5a26000c7f 100644 --- a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/d3da73bde12a47d5a6b8f9dad971f2ec.json +++ b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/d3da73bde12a47d5a6b8f9dad971f2ec.json @@ -1 +1 @@ -{"setpoint": 15.0, "temperature": 17.1, "battery": 0.62, "valve_position": 0.0, "temperature_difference": 0.1} \ No newline at end of file +{"temperature": 17.1, "setpoint": 15.0, "battery": 0.62, "temperature_difference": 0.1, "valve_position": 0.0} \ No newline at end of file diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/df4a4a8169904cdb9c03d61a21f42140.json b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/df4a4a8169904cdb9c03d61a21f42140.json index 12947c42ce0..f27c382fc0b 100644 --- a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/df4a4a8169904cdb9c03d61a21f42140.json +++ b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/df4a4a8169904cdb9c03d61a21f42140.json @@ -1 +1 @@ -{"setpoint": 13.0, "temperature": 16.5, "battery": 0.67, "active_preset": "away", "presets": {"home": [20.0, 22.0], "away": [12.0, 25.0], "vacation": [12.0, 28.0], "no_frost": [8.0, 30.0], "asleep": [15.0, 24.0]}, "schedule_temperature": null, "available_schedules": [], "selected_schedule": null, "last_used": null} \ No newline at end of file +{"temperature": 16.5, "setpoint": 13.0, "battery": 0.67, "active_preset": "away", "presets": {"home": [20.0, 22.0], "away": [12.0, 25.0], "vacation": [12.0, 28.0], "no_frost": [8.0, 30.0], "asleep": [15.0, 24.0]}, "schedule_temperature": null, "available_schedules": [], "selected_schedule": null, "last_used": null} \ No newline at end of file diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/e7693eb9582644e5b865dba8d4447cf1.json b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/e7693eb9582644e5b865dba8d4447cf1.json index 151b4b41f70..610c019b686 100644 --- a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/e7693eb9582644e5b865dba8d4447cf1.json +++ b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/e7693eb9582644e5b865dba8d4447cf1.json @@ -1 +1 @@ -{"setpoint": 5.5, "temperature": 15.6, "battery": 0.68, "valve_position": 0.0, "temperature_difference": 0.0, "active_preset": "no_frost", "presets": {"home": [20.0, 22.0], "asleep": [17.0, 24.0], "away": [15.0, 25.0], "vacation": [15.0, 28.0], "no_frost": [10.0, 30.0]}, "schedule_temperature": null, "available_schedules": [], "selected_schedule": null, "last_used": null} \ No newline at end of file +{"temperature": 15.6, "setpoint": 5.5, "battery": 0.68, "temperature_difference": 0.0, "valve_position": 0.0, "active_preset": "no_frost", "presets": {"home": [20.0, 22.0], "asleep": [17.0, 24.0], "away": [15.0, 25.0], "vacation": [15.0, 28.0], "no_frost": [10.0, 30.0]}, "schedule_temperature": null, "available_schedules": [], "selected_schedule": null, "last_used": null} \ No newline at end of file diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/f1fee6043d3642a9b0a65297455f008e.json b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/f1fee6043d3642a9b0a65297455f008e.json index 9934e109033..c4b5769e6d1 100644 --- a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/f1fee6043d3642a9b0a65297455f008e.json +++ b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/f1fee6043d3642a9b0a65297455f008e.json @@ -1 +1 @@ -{"setpoint": 14.0, "temperature": 18.9, "battery": 0.92, "active_preset": "away", "presets": {"asleep": [17.0, 24.0], "no_frost": [10.0, 30.0], "away": [14.0, 25.0], "home": [21.0, 22.0], "vacation": [12.0, 28.0]}, "schedule_temperature": 14.0, "available_schedules": ["Badkamer Schema"], "selected_schedule": "Badkamer Schema", "last_used": "Badkamer Schema"} \ No newline at end of file +{"temperature": 18.9, "setpoint": 14.0, "battery": 0.92, "active_preset": "away", "presets": {"asleep": [17.0, 24.0], "no_frost": [10.0, 30.0], "away": [14.0, 25.0], "home": [21.0, 22.0], "vacation": [12.0, 28.0]}, "schedule_temperature": 14.0, "available_schedules": ["Badkamer Schema"], "selected_schedule": "Badkamer Schema", "last_used": "Badkamer Schema"} \ No newline at end of file diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/notifications.json b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/notifications.json new file mode 100644 index 00000000000..c229f64da04 --- /dev/null +++ b/tests/fixtures/plugwise/adam_multiple_devices_per_zone/notifications.json @@ -0,0 +1 @@ +{"af82e4ccf9c548528166d38e560662a4": {"warning": "Node Plug (with MAC address 000D6F000D13CB01, in room 'n.a.') has been unreachable since 23:03 2020-01-18. Please check the connection and restart the device."}} \ No newline at end of file diff --git a/tests/fixtures/plugwise/anna_heatpump/get_all_devices.json b/tests/fixtures/plugwise/anna_heatpump/get_all_devices.json index 4992a175b14..191f5b442b7 100644 --- a/tests/fixtures/plugwise/anna_heatpump/get_all_devices.json +++ b/tests/fixtures/plugwise/anna_heatpump/get_all_devices.json @@ -1 +1 @@ -{"1cbf783bb11e4a7c8a6843dee3a86927": {"name": "Anna", "types": {"py/set": ["temperature", "thermostat", "home"]}, "class": "heater_central", "location": "a57efe5f145f498c9be62a9b63626fbf"}, "015ae9ea3f964e668e490fa39da3870b": {"name": "Anna", "types": {"py/set": ["temperature", "thermostat", "home"]}, "class": "gateway", "location": "a57efe5f145f498c9be62a9b63626fbf"}, "3cb70739631c4d17a86b8b12e8a5161b": {"name": "Anna", "types": {"py/set": ["thermostat"]}, "class": "thermostat", "location": "c784ee9fdab44e1395b8dee7d7a497d5"}} \ No newline at end of file +{"1cbf783bb11e4a7c8a6843dee3a86927": {"name": "Anna", "types": {"py/set": ["home", "temperature", "thermostat"]}, "class": "heater_central", "location": "a57efe5f145f498c9be62a9b63626fbf"}, "015ae9ea3f964e668e490fa39da3870b": {"name": "Anna", "types": {"py/set": ["home", "temperature", "thermostat"]}, "class": "gateway", "location": "a57efe5f145f498c9be62a9b63626fbf"}, "3cb70739631c4d17a86b8b12e8a5161b": {"name": "Anna", "types": {"py/set": ["thermostat"]}, "class": "thermostat", "location": "c784ee9fdab44e1395b8dee7d7a497d5"}} \ No newline at end of file diff --git a/tests/fixtures/plugwise/anna_heatpump/get_device_data/1cbf783bb11e4a7c8a6843dee3a86927.json b/tests/fixtures/plugwise/anna_heatpump/get_device_data/1cbf783bb11e4a7c8a6843dee3a86927.json index a8aea8e1357..ddf807303a2 100644 --- a/tests/fixtures/plugwise/anna_heatpump/get_device_data/1cbf783bb11e4a7c8a6843dee3a86927.json +++ b/tests/fixtures/plugwise/anna_heatpump/get_device_data/1cbf783bb11e4a7c8a6843dee3a86927.json @@ -1 +1 @@ -{"outdoor_temperature": 18.0, "heating_state": false, "dhw_state": false, "water_temperature": 29.1, "return_temperature": 25.1, "water_pressure": 1.57, "intended_boiler_temperature": 0.0, "modulation_level": 0.52, "cooling_state": false, "slave_boiler_state": false, "compressor_state": true, "flame_state": false} \ No newline at end of file +{"water_temperature": 29.1, "dhw_state": false, "intended_boiler_temperature": 0.0, "heating_state": false, "modulation_level": 0.52, "return_temperature": 25.1, "compressor_state": true, "cooling_state": false, "slave_boiler_state": false, "flame_state": false, "water_pressure": 1.57, "outdoor_temperature": 18.0} \ No newline at end of file diff --git a/tests/fixtures/plugwise/anna_heatpump/get_device_data/3cb70739631c4d17a86b8b12e8a5161b.json b/tests/fixtures/plugwise/anna_heatpump/get_device_data/3cb70739631c4d17a86b8b12e8a5161b.json index 2a092e792d5..3177880705b 100644 --- a/tests/fixtures/plugwise/anna_heatpump/get_device_data/3cb70739631c4d17a86b8b12e8a5161b.json +++ b/tests/fixtures/plugwise/anna_heatpump/get_device_data/3cb70739631c4d17a86b8b12e8a5161b.json @@ -1 +1 @@ -{"setpoint": 21.0, "temperature": 23.3, "active_preset": "home", "presets": {"no_frost": [10.0, 30.0], "home": [21.0, 22.0], "away": [20.0, 25.0], "asleep": [20.5, 24.0], "vacation": [17.0, 28.0]}, "schedule_temperature": null, "available_schedules": ["standaard"], "selected_schedule": "standaard", "last_used": "standaard", "illuminance": 86.0} \ No newline at end of file +{"temperature": 23.3, "setpoint": 21.0, "active_preset": "home", "presets": {"no_frost": [10.0, 30.0], "home": [21.0, 22.0], "away": [20.0, 25.0], "asleep": [20.5, 24.0], "vacation": [17.0, 28.0]}, "schedule_temperature": null, "available_schedules": ["standaard"], "selected_schedule": "standaard", "last_used": "standaard", "illuminance": 86.0} \ No newline at end of file diff --git a/tests/fixtures/plugwise/anna_heatpump/notifications.json b/tests/fixtures/plugwise/anna_heatpump/notifications.json new file mode 100644 index 00000000000..9e26dfeeb6e --- /dev/null +++ b/tests/fixtures/plugwise/anna_heatpump/notifications.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/tests/fixtures/plugwise/p1v3_full_option/get_all_devices.json b/tests/fixtures/plugwise/p1v3_full_option/get_all_devices.json index e25fcb953c8..1feb33dd630 100644 --- a/tests/fixtures/plugwise/p1v3_full_option/get_all_devices.json +++ b/tests/fixtures/plugwise/p1v3_full_option/get_all_devices.json @@ -1 +1 @@ -{"e950c7d5e1ee407a858e2a8b5016c8b3": {"name": "P1", "types": {"py/set": ["power", "home"]}, "class": "gateway", "location": "cd3e822288064775a7c4afcdd70bdda2"}} \ No newline at end of file +{"e950c7d5e1ee407a858e2a8b5016c8b3": {"name": "P1", "types": {"py/set": ["home", "power"]}, "class": "gateway", "location": "cd3e822288064775a7c4afcdd70bdda2"}} \ No newline at end of file diff --git a/tests/fixtures/plugwise/p1v3_full_option/get_device_data/e950c7d5e1ee407a858e2a8b5016c8b3.json b/tests/fixtures/plugwise/p1v3_full_option/get_device_data/e950c7d5e1ee407a858e2a8b5016c8b3.json index 36cb66c7902..fcbc1bbce33 100644 --- a/tests/fixtures/plugwise/p1v3_full_option/get_device_data/e950c7d5e1ee407a858e2a8b5016c8b3.json +++ b/tests/fixtures/plugwise/p1v3_full_option/get_device_data/e950c7d5e1ee407a858e2a8b5016c8b3.json @@ -1 +1 @@ -{"net_electricity_point": -2761.0, "electricity_consumed_peak_point": 0.0, "electricity_consumed_off_peak_point": 0.0, "net_electricity_cumulative": 442972.0, "electricity_consumed_peak_cumulative": 442932.0, "electricity_consumed_off_peak_cumulative": 551090.0, "net_electricity_interval": 0.0, "electricity_consumed_peak_interval": 0.0, "electricity_consumed_off_peak_interval": 0.0, "electricity_produced_peak_point": 2761.0, "electricity_produced_off_peak_point": 0.0, "electricity_produced_peak_cumulative": 396559.0, "electricity_produced_off_peak_cumulative": 154491.0, "electricity_produced_peak_interval": 0.0, "electricity_produced_off_peak_interval": 0.0, "gas_consumed_cumulative": 584.9, "gas_consumed_interval": 0.0} \ No newline at end of file +{"net_electricity_point": -2761.0, "electricity_consumed_peak_point": 0.0, "electricity_consumed_off_peak_point": 0.0, "net_electricity_cumulative": 442972.0, "electricity_consumed_peak_cumulative": 442932.0, "electricity_consumed_off_peak_cumulative": 551090.0, "net_electricity_interval": 0.0, "electricity_consumed_peak_interval": 0.0, "electricity_consumed_off_peak_interval": 0.0, "electricity_produced_peak_point": 2761.0, "electricity_produced_off_peak_point": 0.0, "electricity_produced_peak_cumulative": 396559.0, "electricity_produced_off_peak_cumulative": 154491.0, "electricity_produced_peak_interval": 0.0, "electricity_produced_off_peak_interval": 0.0, "gas_consumed_cumulative": 584.85, "gas_consumed_interval": 0.0} \ No newline at end of file diff --git a/tests/fixtures/plugwise/p1v3_full_option/notifications.json b/tests/fixtures/plugwise/p1v3_full_option/notifications.json new file mode 100644 index 00000000000..9e26dfeeb6e --- /dev/null +++ b/tests/fixtures/plugwise/p1v3_full_option/notifications.json @@ -0,0 +1 @@ +{} \ No newline at end of file