Skip to content

Commit

Permalink
limit options to enum device class
Browse files Browse the repository at this point in the history
  • Loading branch information
jblance authored Jan 14, 2025
1 parent f52e5b6 commit b126e63
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion powermon/outputformats/hass.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def format(self, command: Command, result: Result, device_info) -> list:
payload["state_class"] = state_class

# Add options
if response.definition.options is not None:
if response.definition.options is not None and device_class == "enum":
payload["options"] = list(response.definition.options.values())

payloads = js.dumps(payload)
Expand Down
2 changes: 1 addition & 1 deletion powermon/protocols/pi30max.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@
"reading_type": ReadingType.MESSAGE, "icon": "mdi:identifier",
"response_type": ResponseType.BYTES},
{"description": "Work mode",
"reading_type": ReadingType.MESSAGE,
"reading_type": ReadingType.MESSAGE, "device_class": "enum",
"response_type": ResponseType.OPTION,
"options": {
"P": "Power On Mode",
Expand Down

0 comments on commit b126e63

Please sign in to comment.