Hey all, I have a template sensor that i use to track when the kid is asleep and then wakes up, but the issue im facing is the sensor updates the last triggered and timestamp when the home assistant restarts or when I have update template sensors. is there a way to add some code in the template to ignore these types of triggers?
Yes, probably. Share your current sensor configuration.
yeah that would have been good
- platform: template
sensors:
beau_sleeping:
friendly_name: Beau Sleeping
unique_id: Beau Sleeping
icon_template: mdi:sleep
value_template: >-
{% if is_state('binary_sensor.beaus_bedroom_door_group', 'off') and
is_state('switch.nodiee_sleep_machine_music_switch', 'on') and
is_state('binary_sensor.beaus_bedroom_window_blind_contact_sensor', 'off') and
is_state('light.beaus_bedroom_lights_group', 'off') and
is_state('select.nodiee_sleep_machine_scene_select', 'Shusher') %}
Is Sleeping
{% else %}
Woke Up
{% endif %}
attribute_templates:
timestamp: "{{ now().strftime('%d-%m-%y %H:%M:%S') }}"
last_triggered: "{{ now().strftime('%d-%m-%y %H:%M:%S') }}"
Off topic: do you have the Nodiee devices integrated into Home Assistant?
I’ve got some for my kids but never been able to get HA to see them.
yeah i do they use Tuya, so im using the TuyaLocal integration
1 Like