partofthething/next-holiday-sensor

"today_is_holiday" attribute shown as number in HA?

Protoncek opened this issue · 2 comments

Hi!
I have an odd case:
I have installed your sensor and i use attribute "today_is_holiday" as trigger condition in my automation: it will trigger only if it's false (so automation doesn't trigger when it's holiday).
I entered automation via UI interface, and it never triggers. The cause is that automation assumes that result "false" is a string and creates this:

because this doesn't work:
condition: state
entity_id: sensor.next_holiday
state: 'false'
attribute: today_is_holiday

which doesn't work - automation ends with:

result: false state: false 
wanted_state: 'false'

If i correct it manually in YAML editor to this (note that false is without quotes):

condition: state
entity_id: sensor.next_holiday
state: false
attribute: today_is_holiday

Then it works.
The point is that FIRST example is created by UI automation, while second is corrected in YAML editor. Of course with corrected automation HA complains with this error:
The provided value for 'state' is not supported by the visual editor. We support (string) but received (false)
Do you have any explanation for this behaviour or is it normal?

Hmm I'm not entirely sure. I know YAML will interpret state: false to be a Boolean False rather than the string 'false' so that's part of it.

Ok, thanks for comment. It's kinda weird, though that original HA's UI automation interface creates this wrong...