mag1024 / bosch-alarm-homeassistant

Integration for Bosch Alarm panels that use the mode2 protocol: Solution, B/G series, AMAX
26 stars 4 forks source link

Resolve issues with options flow #4

Closed sanjay900 closed 1 year ago

sanjay900 commented 1 year ago

When I changed to using the CONF_CODE const, i missed updating the translations file.

sanjay900 commented 1 year ago

@mag1024 Unfortunately, it seems like optional and the options config flow just don't play nice with each other.

Home assistants docs tell you to use the default value for making it so that when the options flow loads, it shows the previously set values, but when you do that, that value also gets used if you don't fill in the box, meaning you no longer are able to make it optional

sanjay900 commented 1 year ago

Weirdly though, i see people doing exactly what im doing in other integrations when i search on github, so now im just confused

sanjay900 commented 1 year ago

Ah, figured it out. Theres a different method you can use to provide the default value, and that seems to work perfectly.

Ive also changed the option to support strings, so a user can either use a passcode or just a password, and then the code input will reflect what they choose.

sanjay900 commented 1 year ago

Nice thing is this lets us break out the schema too, which cleans things up as well. Not sure why they don't document this on the page about options flows

mag1024 commented 1 year ago

Nice!