Fix deConz thermostat integration (#26267)

* Fixed logger name to allow selective logging

* Fixed thermostat mode ('off' and 'heat' modes were not consistent with Eurotronic Spirit Zigbee Thermostat state) and added 'auto' to supported mode

* Added required blank lines in code

* Black formatting

* Revert logging code added to each files. Instead, only replaced "." by __package__ in const.py

* Added a test on self._device.state_on to determine hvac_mode

* Black formatting

* Added debug message when unsupported hvac_mode is encountered

* Applied formatting recommandations

* Updated tests for 'auto' hvac_mode
This commit is contained in:
5mauggy authored and Pascal Vizeli committed 2019-08-30 14:28:39 +02:00
1 parent ad6ede9ef7
commit 62338dd28e
3 files changed
+23 -8

No files matched your search

+14 -4
View File
@@ -118,13 +118,23 @@ async def test_climate_devices(hass):
await hass.services.async_call(
"climate",
"set_hvac_mode",
{"entity_id": "climate.climate_1_name", "hvac_mode": "heat"},
{"entity_id": "climate.climate_1_name", "hvac_mode": "auto"},
blocking=True,
)
gateway.api.session.put.assert_called_with(
"http://1.2.3.4:80/api/ABCDEF/sensors/1/config", data='{"mode": "auto"}'
)
await hass.services.async_call(
"climate",
"set_hvac_mode",
{"entity_id": "climate.climate_1_name", "hvac_mode": "heat"},
blocking=True,
)
gateway.api.session.put.assert_called_with(
"http://1.2.3.4:80/api/ABCDEF/sensors/1/config", data='{"mode": "heat"}'
)
await hass.services.async_call(
"climate",
"set_hvac_mode",
@@ -145,7 +155,7 @@ async def test_climate_devices(hass):
"http://1.2.3.4:80/api/ABCDEF/sensors/1/config", data='{"heatsetpoint": 2000.0}'
)
assert len(gateway.api.session.put.mock_calls) == 3
assert len(gateway.api.session.put.mock_calls) == 4
async def test_verify_state_update(hass):
@@ -154,7 +164,7 @@ async def test_verify_state_update(hass):
assert "climate.climate_1_name" in gateway.deconz_ids
thermostat = hass.states.get("climate.climate_1_name")
assert thermostat.state == "off"
assert thermostat.state == "auto"
state_update = {
"t": "event",
@@ -169,7 +179,7 @@ async def test_verify_state_update(hass):
assert len(hass.states.async_all()) == 1
thermostat = hass.states.get("climate.climate_1_name")
assert thermostat.state == "off"
assert thermostat.state == "auto"
assert gateway.api.sensors["1"].changed_keys == {"state", "r", "t", "on", "e", "id"}