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

Parse select entities as string to prevent 'invalid option for select' error #9268

Merged
merged 3 commits into from
Oct 24, 2021
Merged

Parse select entities as string to prevent 'invalid option for select' error #9268

merged 3 commits into from
Oct 24, 2021

Conversation

dvandonkelaar
Copy link
Contributor

Home Assistant logs an error in the created select entity for the Eurotronic SPZB0001 thermostat.

Logger: homeassistant.components.mqtt.select
Source: components/mqtt/select.py:133
Integration: MQTT (documentation, issues)
First occurred: 21:59:16 (11 occurrences)
Last logged: 22:12:14

Invalid option for select.thermostat_eurotronic_trv_mode: '2' (valid options: [1, 2])

The issue is resolved by publishing stringed options to the config topic.

"options": [
  "1",
  "2"
]

Home Assistant is parsing the select options as strings, so setting the available options as a string could resolve the issue.
The only problem right now is it only works for setting the option to 1. Setting the option to 2 does not work with the manually added config as above.
My knowledge about JavaScript/Zigbee2MQTT is limited, maybe someone with a little more experience could help out?

To prevent 'invalid option for select' error
@Koenkk
Copy link
Owner

Koenkk commented Oct 22, 2021

I'm wondering if this should be solved in Zigbee2MQTT, I don't see why a number values are not valid. If I look at the docs https://www.home-assistant.io/integrations/select.mqtt/ -> options I don't see any requirements on it either.

@emontnemery is this something that can be fixed @ HA?

@frenck
Copy link
Contributor

frenck commented Oct 23, 2021

@Koenkk Select options are strings, as per specification.

@Koenkk Koenkk merged commit 387378e into Koenkk:dev Oct 24, 2021
@Koenkk
Copy link
Owner

Koenkk commented Oct 24, 2021

@frenck thanks for the clarification.

@dvandonkelaar thanks for the fix! 😄

@dvandonkelaar
Copy link
Contributor Author

Thanks! Just tested it and it works as it should.

@dvandonkelaar dvandonkelaar deleted the patch-1 branch October 24, 2021 14:55
hacker-cb pushed a commit to hacker-cb/zigbee2mqtt that referenced this pull request Nov 5, 2021
…enkk#9268)

* Updated select entities to parse values as string

To prevent 'invalid option for select' error

* Update homeassistant.ts

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants