FutureTense / keymaster

Home Assistant integration for managing Z-Wave enabled locks
MIT License
239 stars 45 forks source link

Fix autolock defaults #276

Closed KevinCathcart closed 2 years ago

KevinCathcart commented 2 years ago

Proposed change

The current approach yields errors on startup if autolock times have already been set, because the service_template evaluates to an empty string.

But it also simply fails to work properly. For some reason (on my system) newly defined input_text entities start with a value of 'unknown'. LLooking into it more, it looks like this is intentional, as it is explicitly tested for in the unit tests.

To fix this, I unconditionally set these input_texts on startup, but conditionally choose the value. If it is not 'unknown' or the empty string, set it to its own current value, otherwise set the default.

Lastly, I've added an id to the automation, so it can be viewed in the tracer properly.

Type of change