Status Update Noification

Hi All,

Hoping to get a little help. I am trying to setup a notification that updates me on the status of my house when the alarm is set in either the armed home or armed away mode. I would like to receive a text that provides the following:

Front Door: (Front Door Status) locked or unlocked
Back Door: (Back Door Status) locked or unlocked

I am guessing once I get the idea, I can just use the boiler plate with any sensor I want notification on.

Also, Things take a little bit of time to work after the security system is armed so a “delay” of like a minute before it checks the status and sends the notification would be cool.

I tried and got no where. Been googling for a couple hours.

Any help, greatly appreciated.

Thanks

what did you try? do you have any yaml examples of your attempts?

I did sit down and try. Unfortunately I didn’t get much of anything. I tried using the Json editor and I could even get a valid json

The automation docs are here - you should take a read through so you understand how it all works.

Yours will look something like (replacing all the entities with your actual ones):

automation:
  - alias: 'Rule 1 Light on in the evening'
    trigger:
      - platform: state
        entity_id: lock.YOUR_LOCK_FRONT
      - platform: state
        entity_id: lock.YOUR_LOCK_BACK
    condition:
      - condition: state
        entity_id: group.YOUR_DEVICES
        state: 'not_home'
    action:
      - service: notify.YOUR_NOTIFIER
        data_template:
          message: "Hey, the {{ trigger.entity_id }} is {{ trigger.to_state }}"

I’m using templating so that you can do it all with a single automation.

You’ll need to set up a group that has the devices you want to track, and obviously a device tracker to track them (possibly multiple trackers). You’ll also need to set up a notifier.

Multiple device trackers

I talk about it more here, but modern mobiles will put WiFi to sleep when they’re idle. To avoid false aways you need to mix in WiFi based and Bluetooth based, and optionally GPS based (but that tends to be inaccurate when indoors). You can also follow this guide to smooth some of that out.

Since switching to a combined view across multiple trackers I’ve had no false away events.

I think I read your requirements slightly differently to @Tinkerer so I’ll add my take on it and hopefully somewhere between his answer and mine is what you want…

automation:
  alias: Check door status when alarm set
  initial_state: on
  trigger: #Trigger when alarm is armed home/away
    - platform: state
      entity_id: alarm. YOUR_ALARM
      to: 'armed_home'
    - platform: state
      entity_id: alarm. YOUR_ALARM
      to: 'armed_home'
  action: #Send message with status of front and back door
    service: notify.YOUR_NOTIFICATION_SERVICE
    data_template:
      message: "The alarm has just been set to {{ trigger.to_state }}.

        The front door is {{ states('lock.YOUR_FRONT_LOCK') }}.

        The back door is {{ state('lock.YOUR_BACK_LOCK') }}."

Personally I’d template that more so that the message would read more like: “Alarm is set and all is secure” or “Warning! The alarm is set but the back door is unlocked”, but the general gist is there.

This is exactly what I am trying to do. I set it up and got an error upon configuration checks. The error was

mapping values are not allowed here
in “/home/homeassistant/.homeassistant/automations.yaml”, line 665, column 106

What’s line 665?

It was a formatting error. I figured it out. Thank you very much.

Now I am down to cleaning it up formatting wise. Right now it reads, " blah blah blah. blah blah blah.blah blah blah.blah blah blah."

is there a way to make it read

"blah blah blah.:
(indent) blah blah blah.
(indent) blah blah blah.

I am trying to make it more like a list than a paragraph.

Just play around with the spacings in the message block, or physically build the message with a template and get it to spit out the result in the format you want :+1:

Every time I put a space in the automation editor, the block turns red indicating I have an error.

Right now I have:

{
“message”: “My message blah blah blah, My message blah blah blah. My message blah blah blah.”

How would I input a space? or a return?

… By not using the editor and changing the code by hand :wink:

Sounds like somebody needs to give the devs a nudge to make the automation editor play ball.

Some message platforms will interpret \n or \r to start a new line.

\n did it. Thank you to the both of you (@Tinkerer and @anon43302295)