Skip to content

Commit 5a70306

Browse files
authored
Merge pull request #77 from plugwise/less_complex
Lower complexity further
2 parents 0d5e5c7 + 886fa1d commit 5a70306

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
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.9.4a8"
3+
__version__ = "0.9.4a9"
44

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

plugwise/helper.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ def __init__(self):
138138
self._locations = None
139139
self._modules = None
140140

141-
self.active_device_present = False
142141
self.appl_data = {}
143142
self.gateway_id = None
144143
self.heater_id = None
@@ -434,8 +433,9 @@ def all_appliances(self):
434433
)
435434
fl_state = self._appliances.find(".//logs/point_log[type='flame_state']")
436435
bl_state = self._appliances.find(".//services/boiler_state")
437-
if self._cp_state or fl_state or bl_state:
438-
self.active_device_present = True
436+
self.active_device_present = (
437+
self._cp_state is not None or fl_state is not None or bl_state is not None
438+
)
439439

440440
for appliance in self._appliances:
441441
appl = Munch()
@@ -932,13 +932,11 @@ def schemas(self, loc_id):
932932
return available, selected, schedule_temperature
933933

934934
for rule_id, dummy in rule_ids.items():
935-
active = False
936935
name = self._domain_objects.find(f'rule[@id="{rule_id}"]/name').text
937-
if (
936+
active = (
938937
self._domain_objects.find(f'rule[@id="{rule_id}"]/active').text
939938
== "true"
940-
):
941-
active = True
939+
)
942940
schemas[name] = active
943941
schedules = {}
944942
locator = f'rule[@id="{rule_id}"]/directives'

0 commit comments

Comments
 (0)