Hi, I am trying to develop a custom component and I wanto to use an ObjectSelector to store some values in a key-value format (yaml).
In the config_flow i defined the field
VALUES is a const that store the string “values” (the field name).
When I start HA in dev mode, I can choose my custom helper in “Settings > Helpers”, but when I click on it, no popup appear and I don’t have any error in debug terminal inside Visual Studio Code.
I searched and there are at least 2 integration that use ObjectSelector (androidtv and scrape).
I tried to mimic the config_flow based on scrape, with no success.
So, I don’t know if this is a bug in the HA frontend or designed functionality but it is loading your helper form (as the screen dims to the background) but you get a console error saying:
Uncaught (in promise) Error: Selector not supported in initial form data
a compute-initial-ha-form-data.ts:86
a compute-initial-ha-form-data.ts:8
value step-flow-form.ts:115
value step-flow-form.ts:47
update lit-element.ts:160
performUpdate reactive-element.ts:1331
scheduleUpdate reactive-element.ts:1263
_$Ej reactive-element.ts:1235
The only way I could get this to load your form is to set it to vol.Optional instead of vol.Required. You may then have to have a validation function that this field is not blank.
It maybe worth raising an issue on the HA github about this or in the discord to see if a developer can tell you if it is intended - I’m thinking maybe not as it is not handled well with any UI error message.
EDIT: Actually, if you add an empty dict default value, this will also load. Ie:
Thank you, both the solutions you mentioned work.
Now I have to decide which of the two to use, the one that best fits my needs.
About opening an issue on github or discord, i think i will; as you say, the error is not handled as feedback to the user (my bad not to watch chrome console ), and might be useful to someone else.