Hi, here is a little yaml automation. I hope that someone can translate it in Node-Red to best understand how it works.
The automation notify once a day via Telegram if the tablet battery is below a minimal value.
Furthermore, the automation work only if is set to ‘on’ the flag “enabled-notification”.
In Home Assistant I have defined the follow input:
- input_number.minlevelbattery
- last_notify
- enabled_notification
- alias: "Low tabet battery"
trigger:
platform: template
value_template: '{{ states.sensor.battery_tablet.state | float < (states.input_number.minlevelbattery.state | float) }}'
condition:
- condition: template
value_template: "{{ states.input_datetime.last_notify.state != states.sensor.date.state }}"
- condition: numeric_state
entity_id: sensor.battery_tablet
above: 10
- condition: state
entity_id: input_boolean.enabled_notification
state: 'on'
action:
- service: input_datetime.set_datetime
entity_id: input_datetime.last_notify
data_template:
date: "{{ states.sensor.date.state | timestamp_custom('%Y-%m-%d') }}"
- service: notify.telegram
data:
message: "Tablet battery low: {{ states.sensor.battery_tablet.state }} %"