Skip to content

Commit 72353f6

Browse files
authored
Merge pull request #7 from plugwise/smilep125values
Fix tariff structure presence
2 parents 8e640a8 + d6edf95 commit 72353f6

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

custom_components/plugwise-beta/sensor.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,17 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
161161
if data[sensor] is not None:
162162
if "power" in device["types"]:
163163
if "off" in sensor:
164-
if api._power_tariff is None:
165-
continue
166-
elif (
167-
api._power_tariff[
168-
"electricity_consumption_tariff_structure"
169-
]
170-
== "single"
171-
):
164+
tariff="electricity_consumption_tariff_structure"
165+
if not tariff in api._power_tariff:
172166
continue
167+
else:
168+
if (
169+
api._power_tariff[
170+
"electricity_consumption_tariff_structure"
171+
]
172+
== "single"
173+
):
174+
continue
173175
devices.append(
174176
PwPowerSensor(
175177
api,

0 commit comments

Comments
 (0)