tobias.z
(Tobias Z)
February 2, 2023, 8:38pm
1
So, I got into Home Assistant and got my first Motion Sensor. Works nice with ZHA but to setup my automations I need the State e.g. 35 in a binary Sensor that gives me a true if it’s under 35.
- platform: template
sensors:
wohnzimmer_ist_dunkel:
value_template: "{{ (states.sensor.lumi_lumi_motion_ac02_illuminance.split(' ')[0] | float) < 35 }}"
friendly_name: "Wohnzimmer ist Dunkel"
The entity Wohnzimmer ist Dunkel gives back not available. What am I doing wrong?
EdwardTFN
(Edward Firmo)
February 2, 2023, 8:51pm
2
Try this:
- platform: template
sensors:
wohnzimmer_ist_dunkel:
value_template: "{{ states('sensor.lumi_lumi_motion_ac02_illuminance') | float(0) < 35 }}"
friendly_name: "Wohnzimmer ist Dunkel"
By the way, you should consider moving to the new way of creating template sensors:
template;
- binary-sensor:
- name: "Wohnzimmer ist Dunkel"
device_class: light
state: "{{ states('sensor.lumi_lumi_motion_ac02_illuminance') | float(0) < 35 }}"
tobias.z
(Tobias Z)
February 2, 2023, 9:02pm
3
Thank you Edward, you have saved my evening
1 Like