BO1
1
I’m running across a scenario trying to access an array index, and something does not work as I need to.
I am wondering if someone can check my code and see what the problem is
TYA
{% set test_var = ['00','01','11','10'] %}
{{states('counter.aly_bed_swtich_count')}} / this outputs 1 correctly
{{test_var[2]}} //this outputs 11 correctly
{{test_var[states('counter.aly_bed_swtich_count')]}} // this outputs nothing, vs expected 01
123
(Taras)
2
{{test_var[states('counter.aly_bed_swtich_count')|int(0)]}}
You have to convert the entity’s state
value from string to integer.
BO1
3
It works, thanks.
I thought I tried that, but most likely my syntax was wrong.
1 Like