Skip to content

Commit 4d40544

Browse files
authored
Merge pull request #44 from plugwise/revert-names
Revert some sensor-name changes
2 parents 84855c1 + d374599 commit 4d40544

File tree

4 files changed

+59
-41
lines changed

4 files changed

+59
-41
lines changed

plugwise/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Plugwise module."""
22

3-
__version__ = "0.8.2a6"
3+
__version__ = "0.8.2a7"
44

55
from plugwise.smile import Smile
66
from plugwise.stick import stick

plugwise/constants.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,22 +314,34 @@
314314
# Excluded:
315315
# zone_thermosstat 'temperature_offset'
316316
# radiator_valve 'uncorrected_temperature', 'temperature_offset'
317+
318+
317319
DEVICE_MEASUREMENTS = {
318320
# HA Core current_temperature
319321
"temperature": {ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS},
320322
# HA Core setpoint
321-
"thermostat": {ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS},
323+
"thermostat": {ATTR_NAME: "setpoint", ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS},
322324
# Anna/Adam
323-
"boiler_temperature": {ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS},
324-
"domestic_hot_water_state": {ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS},
325+
"boiler_temperature": {
326+
ATTR_NAME: "water_temperature",
327+
ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS,
328+
},
329+
"domestic_hot_water_state": {
330+
ATTR_NAME: "dhw_state",
331+
ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS,
332+
},
325333
"intended_boiler_temperature": {
326334
ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS
327335
}, # non-zero when heating, zero when dhw-heating
328336
"intended_central_heating_state": {
329-
ATTR_UNIT_OF_MEASUREMENT: None
337+
ATTR_NAME: "heating_state",
338+
ATTR_UNIT_OF_MEASUREMENT: None,
330339
}, # use intended_c_h_state, this key shows the heating-behavior better than c-h_state
331340
"modulation_level": {ATTR_UNIT_OF_MEASUREMENT: PERCENTAGE},
332-
"return_water_temperature": {ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS},
341+
"return_water_temperature": {
342+
ATTR_NAME: "return_temperature",
343+
ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS,
344+
},
333345
# Used with the Elga heatpump - marcelveldt
334346
"compressor_state": {ATTR_UNIT_OF_MEASUREMENT: None},
335347
"cooling_state": {ATTR_UNIT_OF_MEASUREMENT: None},
@@ -339,7 +351,10 @@
339351
ATTR_UNIT_OF_MEASUREMENT: None
340352
}, # also present when there is a single gas-heater
341353
# Anna only
342-
"central_heater_water_pressure": {ATTR_UNIT_OF_MEASUREMENT: PRESSURE_BAR},
354+
"central_heater_water_pressure": {
355+
ATTR_NAME: "water_pressure",
356+
ATTR_UNIT_OF_MEASUREMENT: PRESSURE_BAR,
357+
},
343358
"outdoor_temperature": {
344359
ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS
345360
}, # Outdoor temp as reported on the Anna, in the App

plugwise/smile.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -732,25 +732,23 @@ def get_device_data(self, dev_id):
732732

733733
device_data = self.get_appliance_data(dev_id)
734734

735-
# Legacy_anna: create intended_central_heating_state and leave out domestic_hot_water_state
735+
# Legacy_anna: create heating_state and leave out domestic_hot_water_state
736736
if "boiler_state" in device_data:
737-
device_data["intended_central_heating_state"] = device_data[
738-
"intended_boiler_state"
739-
]
737+
device_data["heating_state"] = device_data["intended_boiler_state"]
740738
device_data.pop("boiler_state", None)
741739
device_data.pop("intended_boiler_state", None)
742740

743-
# Fix for Adam + Anna: intended_central_heating_state also present under Anna, remove
741+
# Fix for Adam + Anna: heating_state also present under Anna, remove
744742
if "thermostat" in device_data:
745-
device_data.pop("intended_central_heating_state", None)
743+
device_data.pop("heating_state", None)
746744

747-
# Adam: indicate intended_central_heating_state based on valves being open in case of city-provided heating
745+
# Adam: indicate heating_state based on valves being open in case of city-provided heating
748746
if self.smile_name == "Adam":
749747
if details["class"] == "heater_central":
750748
if not self.active_device_present:
751-
device_data["intended_central_heating_state"] = True
749+
device_data["heating_state"] = True
752750
if self.get_open_valves() == 0:
753-
device_data["intended_central_heating_state"] = False
751+
device_data["heating_state"] = False
754752

755753
# Anna, Lisa, Tom/Floor
756754
if details["class"] in thermostat_classes:
@@ -843,6 +841,11 @@ def get_appliance_data(self, dev_id):
843841
if measurement in ["compressor_state", "flame_state"]:
844842
self.active_device_present = True
845843

844+
try:
845+
measurement = attrs[ATTR_NAME]
846+
except KeyError:
847+
measurement = measurement
848+
846849
data[measurement] = format_measure(
847850
measure, attrs[ATTR_UNIT_OF_MEASUREMENT]
848851
)

tests/test_smile.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -444,16 +444,16 @@ async def test_connect_legacy_anna(self):
444444
testdata = {
445445
# Anna
446446
"0d266432d64443e283b5d708ae98b455": {
447-
"thermostat": 20.5,
447+
"setpoint": 20.5,
448448
"temperature": 20.4,
449449
"illuminance": 151,
450450
},
451451
# Central
452452
"04e4cbfe7f4340f090f85ec3b9e6a950": {
453-
"boiler_temperature": 23.6,
454-
"central_heater_water_pressure": 1.2,
453+
"water_temperature": 23.6,
454+
"water_pressure": 1.2,
455455
"modulation_level": 0,
456-
"intended_central_heating_state": True,
456+
"heating_state": True,
457457
},
458458
}
459459

@@ -508,13 +508,13 @@ async def test_connect_legacy_anna_2(self):
508508
testdata = {
509509
# Anna
510510
"9e7377867dc24e51b8098a5ba02bd89d": {
511-
"thermostat": 15.0,
511+
"setpoint": 15.0,
512512
"temperature": 21.4,
513513
"illuminance": 19.5,
514514
},
515515
# Central
516516
"ea5d8a7177e541b0a4b52da815166de4": {
517-
"central_heater_water_pressure": 1.7,
517+
"water_pressure": 1.7,
518518
},
519519
}
520520

@@ -646,9 +646,9 @@ async def test_connect_anna_v4(self):
646646
},
647647
# Central
648648
"cd0e6156b1f04d5f952349ffbe397481": {
649-
"intended_central_heating_state": True,
650-
"central_heater_water_pressure": 2.1,
651-
"boiler_temperature": 52.0,
649+
"heating_state": True,
650+
"water_pressure": 2.1,
651+
"water_temperature": 52.0,
652652
},
653653
"0466eae8520144c78afb29628384edeb": {
654654
"outdoor_temperature": 7.44,
@@ -745,7 +745,7 @@ async def test_connect_anna_without_boiler_fw3(self):
745745
},
746746
# Central
747747
"c46b4794d28149699eacf053deedd003": {
748-
"intended_central_heating_state": False,
748+
"heating_state": False,
749749
},
750750
}
751751

@@ -802,7 +802,7 @@ async def test_connect_anna_without_boiler_fw4(self):
802802
},
803803
# Central
804804
"c46b4794d28149699eacf053deedd003": {
805-
"intended_central_heating_state": True,
805+
"heating_state": True,
806806
},
807807
}
808808

@@ -885,12 +885,12 @@ async def test_connect_adam_plus_anna(self):
885885
"selected_schedule": "Weekschema",
886886
"last_used": "Weekschema",
887887
"active_preset": "home",
888-
"thermostat": 20.5, # HA setpoint_temp
888+
"setpoint": 20.5, # HA setpoint_temp
889889
"temperature": 20.5, # HA current_temp
890890
},
891891
# Central
892892
"2743216f626f43948deec1f7ab3b3d70": {
893-
"intended_central_heating_state": False,
893+
"heating_state": False,
894894
},
895895
"b128b4bbbd1f47e9bf4d756e8fb5ee94": {
896896
"outdoor_temperature": 11.9,
@@ -974,13 +974,13 @@ async def test_connect_adam_zone_per_device(self):
974974
testdata = {
975975
# Lisa WK
976976
"b59bcebaf94b499ea7d46e4a66fb62d8": {
977-
"thermostat": 21.5,
977+
"setpoint": 21.5,
978978
"temperature": 21.1,
979979
"battery": 34,
980980
},
981981
# Floor WK
982982
"b310b72a0e354bfab43089919b9a88bf": {
983-
"thermostat": 21.5,
983+
"setpoint": 21.5,
984984
"temperature": 26.2,
985985
"valve_position": 100,
986986
},
@@ -991,7 +991,7 @@ async def test_connect_adam_zone_per_device(self):
991991
},
992992
# Lisa Bios
993993
"df4a4a8169904cdb9c03d61a21f42140": {
994-
"thermostat": 13.0,
994+
"setpoint": 13.0,
995995
"temperature": 16.5,
996996
"battery": 67,
997997
},
@@ -1057,13 +1057,13 @@ async def test_connect_adam_multiple_devices_per_zone(self):
10571057
testdata = {
10581058
# Lisa WK
10591059
"b59bcebaf94b499ea7d46e4a66fb62d8": {
1060-
"thermostat": 21.5,
1060+
"setpoint": 21.5,
10611061
"temperature": 20.9,
10621062
"battery": 34,
10631063
},
10641064
# Floor WK
10651065
"b310b72a0e354bfab43089919b9a88bf": {
1066-
"thermostat": 21.5,
1066+
"setpoint": 21.5,
10671067
"temperature": 26.0,
10681068
"valve_position": 100,
10691069
},
@@ -1074,7 +1074,7 @@ async def test_connect_adam_multiple_devices_per_zone(self):
10741074
},
10751075
# Lisa Bios
10761076
"df4a4a8169904cdb9c03d61a21f42140": {
1077-
"thermostat": 13.0,
1077+
"setpoint": 13.0,
10781078
"temperature": 16.5,
10791079
"battery": 67,
10801080
},
@@ -1248,9 +1248,9 @@ async def test_connect_anna_heatpump(self):
12481248
},
12491249
# Central
12501250
"1cbf783bb11e4a7c8a6843dee3a86927": {
1251-
"domestic_hot_water_state": False,
1252-
"boiler_temperature": 29.1,
1253-
"central_heater_water_pressure": 1.57,
1251+
"dhw_state": False,
1252+
"water_temperature": 29.1,
1253+
"water_pressure": 1.57,
12541254
},
12551255
"015ae9ea3f964e668e490fa39da3870b": {
12561256
"outdoor_temperature": 20.2,
@@ -1290,9 +1290,9 @@ async def test_connect_anna_heatpump_cooling(self):
12901290
},
12911291
# Central
12921292
"1cbf783bb11e4a7c8a6843dee3a86927": {
1293-
"domestic_hot_water_state": False,
1294-
"boiler_temperature": 24.7,
1295-
"central_heater_water_pressure": 1.61,
1293+
"dhw_state": False,
1294+
"water_temperature": 24.7,
1295+
"water_pressure": 1.61,
12961296
},
12971297
"015ae9ea3f964e668e490fa39da3870b": {
12981298
"outdoor_temperature": 22.0,

0 commit comments

Comments
 (0)