From the remote side, I get the Select updated as expected. However, when an option is selected on HA side, the value that was set before it has been changed by the dropdown menu gets published whereas it is expected that the new value gets published. In developer/template, I checked that the template provides the expected result.
Could someone help me to spot the error?
Thank you
@ondras12345 : thank you you so much for your help. I confirm your guess, state is not yet defined, which is BTW disturbing, passing the value is the solution. And setting a dictionnary is much more elegant.
May I ask a side question? I’m wondering whether options of the select menu can be dynamically defined. I read a few things on this matter without having found the solution.
I think you would have to use MQTT discovery to redefine the entity each time you want to change the options. There seems to be no other easy way to do it.
I prefer not to use MQTT AD in order to keep control on what is created and how. I guess I’ll have to define an automation and use the set_options service, isnt’it?
I find very hard to understand the difference between select and input_select. I must admit I’m lost at this point. Any insight that could be helpfull?
I believe the set_options service is only available for input_select.
The difference between input select and MQTT select is that input select is a helper. That means it’s value is purely virtual and does not represent the state of real hardware. MQTT select, on the other hand, gets its state from MQTT messages and sends them when it is requested to change state. The MQTT messages can then control a real hardware device.
If MQTT select does not support what you need, you might have to implement its functionality using an input select and create an automation that sends MQTT messages when its state changes.