Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix consumption types error #35

Merged
merged 1 commit into from
Feb 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions python_scripts/shellies_discovery_gen2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,15 +1014,11 @@ def configure_device():
config[topic] = payload

for relay_id in range(relays):
relay_type = (
ATTR_LIGHT
if ATTR_LIGHT
in device_config["sys"]["ui_data"]
.get("consumption_types", {})
.get(relay_id, "switch")
.lower()
else ATTR_SWITCH
)
consumption_types = [
item.lower()
for item in device_config["sys"]["device"].get("consumption_types", [])
]
relay_type = ATTR_LIGHT if ATTR_LIGHT in consumption_types else ATTR_SWITCH

topic, payload = get_switch(relay_id, relay_type, profile)
config[topic] = payload
Expand Down