Skip to content

Commit c451058

Browse files
author
Khole Jones
committed
Update add mode/battery
1 parent 439d198 commit c451058

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

pyhiveapi/apyhiveapi/session.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,10 @@ async def createDevices(self):
288288
for code in product_list:
289289
eval("self." + code)
290290

291-
if self.data.products[aProduct]["type"] in HIVE_TYPES["Heating"]:
292-
self.config.mode.append(p["id"])
293-
294-
if self.data.products[aProduct]["type"] in HIVE_TYPES["Switch"]:
295-
self.config.mode.append(p["id"])
296-
297-
if self.data.products[aProduct]["type"] in HIVE_TYPES["Light"]:
291+
hive_type = (
292+
HIVE_TYPES["Heating"] + HIVE_TYPES["Switch"] + HIVE_TYPES["Light"]
293+
)
294+
if self.data.products[aProduct]["type"] in hive_type:
298295
self.config.mode.append(p["id"])
299296

300297
for aDevice in self.data["devices"]:
@@ -304,10 +301,8 @@ async def createDevices(self):
304301
for code in device_list:
305302
eval("self." + code)
306303

307-
if (
308-
self.data["devices"][aDevice]["type"] in HIVE_TYPES["Thermo"]
309-
or self.data["devices"][aDevice]["type"] in HIVE_TYPES["Sensor"]
310-
):
304+
hive_type = HIVE_TYPES["Thermo"] + HIVE_TYPES["Sensor"]
305+
if self.data["devices"][aDevice]["type"] in hive_type:
311306
self.config.battery.append(d["id"])
312307

313308
if "action" in HIVE_TYPES["Switch"]:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def requirements_from_file(filename="requirements.txt"):
1515

1616

1717
setup(
18-
version="0.3.8",
18+
version="0.3.9",
1919
package_data={"data": ["*.json"]},
2020
include_package_data=True,
2121
cmdclass={

0 commit comments

Comments
 (0)