I’m trying to make the light flash RED if a contact has been opened and the “Security” entity is turned on.
When I turn off the “Security” - I want the bulb to reset to the default colour (using the scene) then turn off the light.
The below works, but only flashes once then the light turns off but doesn’t reset (still red when I turn it back on)
alias: '[GS 5 Opened] - Security Mode On'
description: ''
trigger:
- platform: state
entity_id: binary_sensor.aqara_contact1_contact
to: 'on'
condition:
- condition: state
entity_id: input_boolean.security
state: 'on'
action:
- service: notify.mobile_app_jj
data:
title: 5 ALERT ! [{{ states('binary_sensor.aqara_contact1_contact' ) }}]
message: |-
{% if is_state("binary_sensor.aqara_contact1_contact", "on") -%}
The {{ trigger.to_state.attributes.friendly_name }} has been opened at {{ now().strftime("%H:%M") }} !
{%- else -%}
False message? 7 Contact: [{{trigger.to_state.state }}]
{%- endif %}
data:
color: '#d40000'
actions:
- action: Sec_TurnOff
title: Turn Off Sec
- repeat:
until:
- condition: state
state: 'off'
entity_id: input_boolean.security
sequence:
- service: light.toggle
target:
entity_id:
- light.j_bedroom
data:
color_name: red
brightness_pct: 100
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 500
- scene: scene.j_bedroom_relax
- service: light.turn_off
target:
entity_id: light.j_bedroom
data: {}
mode: single