Only reset cough meds notification on wakeup if it's been 4 hours #130

This commit is contained in:
2023-09-18 21:10:17 -04:00
parent b199c57348
commit b6b4477fdb

View File

@ -1053,9 +1053,12 @@ script:
- variables: - variables:
brightness: "{{ state_attr('switch.adaptive_lighting_emma_bedroom','brightness_pct') | int }}" brightness: "{{ state_attr('switch.adaptive_lighting_emma_bedroom','brightness_pct') | int }}"
- if: - if:
- condition: state - condition: template
entity_id: input_boolean.emma_cough_meds_active value_template: >
state: 'on' {% set current = as_timestamp(now()) | int %}
{% set lastdose = state_attr('input_datetime.emma_cough_meds','timestamp') | int %}
{% set diff = current - lastdose %}
{{ is_state('input_boolean.emma_cough_meds_active','on') and diff > 14400 }}
then: then:
- service: input_datetime.set_datetime - service: input_datetime.set_datetime
target: target: