Mattie
(Mattias)
August 4, 2018, 9:58am
1
Hi
I can’t get my template sensor to work with my vacuum.roomba, it seems to be a pretty basic thing but I just cant do it
I got the code below and whatever i try it always says “offline” even though the “bin_full” actually says ‘true’ if I check the attribute in the states section.
- platform: template
sensors:
roomba_bin_state_template:
friendly_name: 'Cleos behållare'
value_template: >-
{% if is_state('states.vacuum.roomba.attributes.bin_full', 'false') %}
OK
{% elif is_state('states.vacuum.roomba.attributes.bin_full', 'true') %}
Full
{% else %}
Offline
{% endif %}
ludeeus
(Ludeeus)
August 4, 2018, 10:09am
2
Should be: is_state_attr('states.vacuum.roomba','bin_full', 'true')
1 Like
Mattie
(Mattias)
August 4, 2018, 11:11am
3
still only showing “offline”
now it looks like this
- platform: template
sensors:
roomba_bin_state_template:
friendly_name: 'Cleos behållare'
value_template: >-
{% if is_state_attr('states.vacuum.roomba','bin_full', 'true') %}
Full
{% elif is_state_attr('states.vacuum.roomba','bin_full', 'false') %}
OK
{% else %}
Offline
{% endif %}
1 Like
ludeeus
(Ludeeus)
August 4, 2018, 11:27am
4
Sorry about that
Did not have enough coffee before my reply
is_state_attr('vacuum.roomba','bin_full', 'true')
will work better
Mattie
(Mattias)
August 4, 2018, 11:44am
5
sorry but it does not work, feels like we are so close!
now the code looks like this
- platform: template
sensors:
roomba_bin_state_template:
friendly_name: 'Cleos behållare'
value_template: >-
{% if is_state_attr('vacuum.roomba','bin_full', 'true') %}
Full
{% elif is_state_attr('vacuum.roomba','bin_full', 'false') %}
OK
{% else %}
Offline
{% endif %}
Get more coffee
Mattie
(Mattias)
August 4, 2018, 12:30pm
6
is there some way to run the command to check if it works directly?
somehing like this: echo is_state_attr(‘vacuum.roomba’,‘bin_full’)
totally wrong but you get the idea
I got the original code from here: https://github.com/jtscott/hass-config/blob/master/sensor/roomba.yaml
but it seems that code doesn’t work anymore
ludeeus
(Ludeeus)
August 4, 2018, 12:57pm
7
Yes paste it in dev-templates
It could be the attribute is a boolean, not a string. So maybe:
is_state_attr('vacuum.roomba','bin_full',true)
You can see if this works if you put this in the template editor:
{{ is_state_attr('vacuum.roomba','bin_full',true) }}
2 Likes
Mattie
(Mattias)
August 4, 2018, 9:35pm
9
That was the problem! THANKS to both of you, I finally got it working!
Also the dev-templates are pretty nifty Damn I love hassio!
1 Like