Automatically activate a Yale Smart Alarm on Home exit

Do you get any errors in the logs? Also why do you turn the automation off, start a script and turn it on again after a delay?

Hi - I saw no errors in the log. The idea of the delay was about people who ring a doorbell several times so we got a lot of unnecessary photos! I can delete it if that helps.

It’s better to add a condition to only trigger the automation if the last time it was triggered was e.g. more than 30 seconds ago.
I’m not sure if the automation will continue the action part once it is turned off.
Do you see the automations in automation editor?

Hi No the automation editor always says there are no editable scripts. This immediately I have just made one and seen it present in scripts.yaml.
I am sure the configuration.yaml is reading both the automation.yaml and the scripts.yaml because if I have an error in these files then when I check the configuration file via server controls it will pick up and point to these errors in the files. So if they are activated (by pressing the doorbell) why is there no error log showing? This same problem is duplicated in the yale alarm automation that started this thread. The automation is there (in the form Dayve67 suggested) but no entity is present in Developer Tools States. It was quite a nice idea to have a Ring style doorbell based on an RPi Zero because of its small form factor and low power usage. Any ideas appreciated! I will try some more variations tomorrow. I do wonder if I have damaged my configuration.yaml file in some way.

I just noticed that the three lines automation, customize and script in your configuration.yaml are indented too far:

It should be like this:

default_config:
config:
automation: !include automations.yaml
customize: !include customize.yaml
script: !include scripts.yaml

Don’t know if this makes any difference.

1 Like

Thanks and yes I do see the automations and the scripts now. I went back to putting all the automations into the confiuration.yaml - so they are not editable in AE. The scripts is editable however - rather odd? Still thanks for spotting it. Do you think using AE is better than adding everything to my configuration file?

There’s no “better” method, just personal preference. In my opinion the AE is good for basic automations or to quickly put something together. However due to the way the AE formats the code, it’s really hard for others to help when someone faces an issue with an automation created in the AE. Also, even if you use the AE, there will still be everything written to the configuration, it’s just in automations.yaml.

Thanks. I will skip the AE and just use the configuration file. I still have not got the Yale Alarm to work. The doorbell idea also still fails. But I feel closer to a solution now! On a separate topic really, I am trying to use telegram to send a photo to HA - still have not found a good way to do this.

Ok I reread your code and found some errors. Here a suggestion you could try:

- id: '1584626326778'
  alias: Automatic_Yale_Alarm
  trigger:
    entity_id: device_tracker.feh_iphone
    from: home
    platform: state
    to: not_home
  action:
    service: alarm_control_panel.alarm_arm_home
    entity_id: alarm_control_panel.xxx #entity_id of your alarm control panel

- id: '1001'
  alias: Doorbell_pressed_automation 
  trigger: 
    platform: mqtt 
    topic: dev/test
    payload: 'Capture!' 
  condition:
    condition: template
    value_template: "{{ as_timestamp(now()) - as_timestamp(state_attr('automation.doorbell_pressed_automation', 'last_triggered')) > 300 }}"
  action: 
    service: script.doorbell_pressed_script 

Hi Thanks a lot. I have just tried the Automatic_Yale_Alarm code - I am using the configuration.yaml file so I re-labelled the id line to automation. I do get an error - invalid data for call_service at pos 1: must contain at least one of entity_id, area_id. I have not yet tried id: ‘1001’ - do I have to create a script for this? Thanks again.

Hi the Automatic_Yale_Alarm code you sent me is now giving no errors - not sure why I got an initial error. Hope to test it today! Thanks.

Hi finally able to test today and everything is working - Alarm and Doorbell! Thanks for all the advice and code!

Hi, I have recently purchased a Yale Smart Alarm and I have been searching for a way to automate turning it on/off every night and morning. So I finally came by your script. Is it something that can be used for such a purpose and how can I use it? Thanks

Hi, not sure. My usage was to give me auto home alarm on at any time based on my phone tracking. So it does not auto switch back to unarmed - I do that. You could add the extra lines to cover not home back to home. I never tried a clock time as the trigger - I guess you don’t want to switch your phone off and on to activate/deactivate the alarm. I am not expert in what triggers work best I’m afraid. But the forum is very good at helping!