This is one of the last items, I cannot understand whatās going. Just never seems to trigger. Overall I want it to trigger on any of these three entiys are a value ot 16, 17, or 18. I figure Iād use a condition. I commented out the condition for testing, and it still did not run, so I figure there is something wrong with my trigger
- alias: Keypad clear code after one time use code is used for 16 through 18
trigger:
- platform: state
entity_id:
- sensor.lock_front_door_deadbolt_alarm_level
- sensor.lock_back_door_deadbolt_alarm_level
- sensor.lock_garage_door_lock_alarm_level
condition:
- condition: template
value_template: "{{ states.trigger.to_state.state in ['16', '17', '18'] }}"
action:
- service: script.turn_on
data_template:
entity_id: >
{% set code_slot = states.trigger.to_state.state %}
{{ 'script.door_keypad_' ~ code_slot ~ '_delete' }}
This is a similiar automation, and itās working
- alias: Keypad clear code after one time use is set to disabled for 16 through 18
trigger:
- platform: state
to: 'Disabled'
entity_id:
- input_select.door_keypad_16_access_schedule
- input_select.door_keypad_17_access_schedule
- input_select.door_keypad_18_access_schedule
action:
- service: script.turn_on
data_template:
entity_id: >
{% set object_id = trigger.to_state.entity_id %}
{% set code_slot = "_".join(object_id.split("_")[3:-2]) %}
{% set script_to_run = 'script.door_keypad_' ~ code_slot ~ '_delete' %}
{{ script_to_run }}
Also Iām not seeing any errors in the logs,
Iāve looked at the state of these
- sensor.lock_front_door_deadbolt_alarm_level
- sensor.lock_back_door_deadbolt_alarm_level
- sensor.lock_garage_door_lock_alarm_level
and they are changing to 16. Not sure if the condition could use some work, but like I said for now, Iāve commented it out just to make sure that was not my problem and it made no difference, so I can come back to that.
- alias: Keypad clear code after one time use code is used for 16 through 18
trigger:
- platform: state
entity_id:
- sensor.lock_front_door_deadbolt_alarm_level
- sensor.lock_back_door_deadbolt_alarm_level
- sensor.lock_garage_door_lock_alarm_level
to: '16'
- platform: state
entity_id:
- sensor.lock_front_door_deadbolt_alarm_level
- sensor.lock_back_door_deadbolt_alarm_level
- sensor.lock_garage_door_lock_alarm_level
to: '17'
- platform: state
entity_id:
- sensor.lock_front_door_deadbolt_alarm_level
- sensor.lock_back_door_deadbolt_alarm_level
- sensor.lock_garage_door_lock_alarm_level
to: '18'
action:
- service: script.turn_on
data_template:
entity_id: >
{% set code_slot = states.trigger.to_state.state %}
{{ 'script.door_keypad_' ~ code_slot ~ '_delete' }}
This is getting annoying, I can verify the value is changing to 16, but cannot see any evidince of this automation recoginizing it. Typos somewhere??
EDIT: Now that Iām looking at your other non-working automation, it appears the problem is most likey the word āstatesā before both your triggers. Triggers are not in your states. So when you use states first, you are saying I want the state from the trigger domain. Trigger domian doesnāt exist, trigger is an event.
Thatās what I thought. Thatās why I was working on the condition, but when I could not get it to fire, I just removed the condition, and still nothing. I confirmed that the value of the senors changed, and there were no errors, it just never ran. Iāll do some logging testing as suggested above.
OK, I feel like Iām being lazy for asking, but either Iām tired, or this is just not coming to me. This really is the last part of the script, which I hope to post tonight, I realized I missed one part.
here is what I have
- alias: Notify who unlocked door with timestamp
trigger:
- platform: state
entity_id:
- sensor.frontdoor_action
- sensor.backdoor_action
to: 'Keypad Unlock'
# This is for an FE599 Schalge lock, they handle events differntly, this will only trigger if a differnt code is used to unlock the door.
- platform: state
entity_id:
- sensor.garagedoor_code
# condition:
# - condition: state
# entity_id: input_select.house_mode
# state: 'Away'
condition:
- condition: numeric_state
entity_id: sensor.ha_runtime_in_minutes
above: 1
action:
- delay:
seconds: 2
- service: notify.pushbullet_notifications
data_template:
message: " At {{ as_timestamp (now()) | timestamp_custom('%I:%M %p') }} on {{ now().strftime('%d %b %Y') }} "
target:
- email/[email protected]
title: "{{ trigger.to_state.attributes.friendly_name }} unlocked by {{ states.sensor.backdoor_code.state }}"
Problem is with this
title: "{{ trigger.to_state.attributes.friendly_name }} unlocked by {{ states.sensor.backdoor_code.state }}"
I need it to be backdoor code if sensor.backdoor_action was the triger, and frontdoor_code if sensor.frontdoor_action was the trigger, for garage the trigger IS sensor.garagedoor_code, so I guess I could just use the state of the trigger for that one. I feel like I need a template in a template in a tempalte, haha.
Iād think so, but cannot say 100%. I cannot think of any reason why it would not work, there are no special installs needed, just standard zwave sensors, etc.