Arm/Disarm Alarm Automation

Hi All,

I setup my first automation to auto arm/disarm a simplisafe alarm I have installed at a vacant property. I am currently trying to sell the property so I could potentially have realtors showing the house during the day. Instead of having them have to remember to arm the alarm when they’re done. I just want the alarm to be off during the day, auto arming at night and auto disarming in the morning.

Below is what I came up with. The triggers haven’t occurred yet but one thing that made me suspect there might be a problem is that Automation shows up on the front page but Automation2 doesn’t. Unfortunately being new to HA I’m not sure what the expected behavior is and couldn’t find any info specific to “Automation rules not showing on the frontend.”

Also if anyone has any suggestions on a better or more efficient way to do this i’d appreciate the feedback.

Thanks,
Mike

# Simplisafe Control Panel
alarm_control_panel:
  platform: simplisafe
  username: __redacted__
  password: __redacted__
  
automation:
  alias: Disable Alarm
  trigger:
    platform: sun
    event: sunrise
  condition:
    condition: state
    entity_id: alarm_control_panel.simplisafe
    state: 'armed_away'
  action:
    service: alarm_control_panel.alarm_disarm
    entity_id: alarm_control_panel.simplisafe
    
automation2:
  alias: Enable Alarm
  trigger:
    platform: time
    after: '22:00:00'
  condition:
    condition: state
    entity_id: alarm_control_panel.simplisafe
    state: 'disarmed'
  action:
    service: alarm_control_panel.alarm_arm_away
    entity_id: alarm_control_panel.simplisafe

automation: gets populated with a list. So you want:

automation:
  - alias: Disable Alarm
    trigger:
      platform: sun
      event: sunrise
    condition:
      condition: state
      entity_id: alarm_control_panel.simplisafe
      state: 'armed_away'
    action:
      service: alarm_control_panel.alarm_disarm
      entity_id: alarm_control_panel.simplisafe
    

  - alias: Enable Alarm
    trigger:
      platform: time
      after: '22:00:00'
    condition:
      condition: state
      entity_id: alarm_control_panel.simplisafe
      state: 'disarmed'
    action:
      service: alarm_control_panel.alarm_arm_away
      entity_id: alarm_control_panel.simplisafe

You should be able to open each of these in the web interface and click “trigger” to see them happen outside of the timed triggers.

Perfect. Thanks.

Is there a way to edit the text of the “state” circle on the front page?

When the alarm is disarmed the circle shows “disarm”. Not a big deal but my OCD would prefer that it read "disarmed’. Character limit maybe?

Might be. Check the actual state on the dev states panel.

state in dev states shows as “disarmed”

Then it’s a truncation of the characters in the “shield”. You’ll have to add it to a group card to see the whole thing.

Just looked up state cards. I think that will work. Thanks for the help.

No worries! Love the fam pic in your avatar BTW. Just makes me smile!

Thanks. Definitely got blessed with those two beautiful girls.

I know you’re asking about displayed values, but, FYI, you can also customize the names of things by using a customize: block. It’s a child of homeassistant:

And if you want fine-grained control over the values that display, you can create template sensors that reflect the value of other sensors:

Will take a look. Thanks for the help and the info.

So I found this bit of code in the ha-state-label-badge.html file. Is this file on my RP3 somewhere or is HA calling back to github? Still pretty new to linux, github, and HA. So still figuring out how everything ties together.

Code Snippet

  computeLabel: function (state) {
    if (state.state === 'unavailable') {
      return 'unavai';
    }
    switch (state.domain) {
      case 'device_tracker':
        return state.state === 'not_home' ? 'Away' : state.state;
      case 'alarm_control_panel':
        if (state.state === 'pending') {
          return 'pend';
        } else if (state.state === 'armed_away' || state.state === 'armed_home') {
          return 'armed';
        } else if (state.state === 'triggered') {
          return 'trig';
        }
        // state == 'disarmed'
        return 'disarm'; #<----Here is where the badge text is being defined
      default:
        return state.attributes.unit_of_measurement || null;
    }
  },

File on github:
https://github.com/home-assistant/home-assistant-polymer/blob/master/src/components/entity/ha-state-label-badge.html

As an extension of what @ih8gates was mentioning, here’s how I reformatted the display of some sensors to make more sense in the front end. Templates are extremely powerful!

#
# Sensor Value Templating
#
#
-  platform: template
   sensors:
     epsonprinter:
       value_template: "{% if is_state('device_tracker.epson3e7694fiosrouterhome', 'home') %}on{% else %}off{% endif %}"
     brotherprinter:
       value_template: "{% if is_state('device_tracker.19216819', 'home') %}on{% else %}off{% endif %}"
     satori:
       value_template: "{% if is_state('sensor.satori_snmp', 'SATORI') %}System Up{% else %}System Offline{% endif %}"
     nirvana:
       value_template: "{% if is_state('device_tracker.1921681195', 'home') %}System Up{% else %}System Offline{% endif %}"
     zen:
       value_template: "{% if is_state('sensor.zen_snmp', 'ZEN') %}System Up{% else %}System Offline{% endif %}"
     acurite_wx:
       value_template: "{% if is_state('device_tracker.1921681163', 'home') %}transmitting{% else %}down{% endif %}"
     ex3700:
       value_template: "{% if is_state('device_tracker.ex3700fiosrouterhome', 'home') %}TX/RX Up{% else %}down{% endif %}"

And here is the result:

Is that in the configuration.yaml?

I use a split configuration setup, so that’s why your not seeing it like you may be used to. (I’ll link to that at the end). What your seeing in the code example is part of my sensors.yaml file. It’s included in the configuration file like this:

####################################################
#                                                  #
#                     Includes                     #
#                                                  #
####################################################
zone: !include zones.yaml
group: !include groups.yaml
sensor: !include devices/sensors.yaml
camera: !include devices/cameras.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
automation: !include automation.yaml
input_boolean: !include input_boolean.yaml
switch: !include switches.yaml

Also, the icons and names are part of my customize.yaml file.

Once you read the article below, it’ll make more sense, I promise!

I can’t seem to get this to work. I started off with something that would seem simple. Something that I already know is working. Zone. I created a zone for work. So I cut the zone from config.yaml and patsed it into a new yaml file named zones. Saved that in the same dir as the config.yaml. After making this change I can’t log back into HA. I get an “Unexpected result from API” error. Checked for any indent errors. Also ran tab to space in notepad++ just to make sure.

Configuration.yaml

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: __redacted__
  longitude: __redacted__
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 139
  # metric for Metric, imperial for Imperial
  unit_system: imperial
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: America/New_York

# Show links to resources in log and frontend
introduction:

# Enables the frontend
frontend:

http:
  # Uncomment this to add a password (recommended!)
  api_password: __redacted__
  ssl_certificate: __redacted__
  ssl_key: __redacted__

  
zone: !include zones.yaml

 # Checks for available updates
updater:

# Discover some devices automatically
discovery:

# Allows you to issue voice commands from the frontend in enabled browsers
conversation:

# Enables support for tracking state changes over time.
history:

# View all events in a logbook
logbook:

# Track the sun
sun:

# Weather Prediction
sensor:
  platform: yr

mqtt:
  broker: __redacted__
  port: 18857
  client_id: home-assistant-1
  keepalive: 60
  username: __redacted__
  password: __redacted__
  birth_message:
    topic: 'hass/status'
    payload: 'online'
    qos: 1
    retain: true
  will_message:
    topic: 'hass/status'
    payload: 'offline'
    qos: 1
    retain: true

device_tracker:
  - platform: owntracks
  
# Simplisafe Control Panel
alarm_control_panel:
  platform: simplisafe
  username: __redacted__
  password: __redacted__
  
automation:
  - alias: Disable Alarm
    trigger:
      platform: sun
      event: sunrise
    condition:
      condition: state
      entity_id: alarm_control_panel.simplisafe
      state: 'armed_away'
    action:
      service: alarm_control_panel.alarm_disarm
      entity_id: alarm_control_panel.simplisafe
    
  - alias: Enable Alarm
    trigger:
      platform: time
      after: '22:00:00'
    condition:
      condition: state
      entity_id: alarm_control_panel.simplisafe
      state: 'disarmed'
    action:
      service: alarm_control_panel.alarm_arm_away
      entity_id: alarm_control_panel.simplisafe

zones.yaml

- name: Work
    latitude: __redacted__
    longitude: __redacted__
    radius: 250
    icon: mdi:briefcase

also tried:
- name: Work
  latitude: __redacted__
  longitude: __redacted__
  radius: 250
  icon: mdi:briefcase

Believe it was permissions issue. I have a samba share setup and I created the yaml file in Notepad++ on windows and saved it to the HA config directory. After doing an ls -la though putty i noticed all dir/files were owned by hass except zones.yaml, it was owned by root. Fixed that and after what seemed like forever I’m now able to get back in.

Nope. Just tried to add a sensors.yaml and include. Back to api error. Frustrating to say the least.

If you look at home-assistant.log in the same folder as your YAML, you’ll get a hint to what’s going awry.

Keep in mind the formatting for the platform you’re using. Some use lists (things that start with a hyphen/minus). But zones (like scripts and groups and others) don’t. So inside zones.yaml, you’d want:

zone:
  name: Work
  latitude: __redacted__
  longitude: __redacted__
  radius: 250
  icon: mdi:briefcase

zone 2: 
  name: Home
  etc...

Look to the components instructions for syntax. And when you split your config, the text usually starts at the left margin.

Here’s what I’m using and I have no errors and my zones are showing up in the map so I’m not sure that’s correct. (Nothing redacted becuase they are all public places)

#
# Zones
#
- name: Somerset Shopping Center
  latitude: 40.577232
  longitude: -74.627472
  radius: 25
  icon: mdi:store

- name: Watchung Shopping Center
  latitude: 40.639901
  longitude: -74.423001
  radius: 25
  icon: mdi:store
  
- name: Blue Star Shopping Center
  latitude: 40.6511783
  longitude: -74.4087588
  radius: 25
  icon: mdi:cart-outline

- name: Wilson Borough
  latitude: 40.677898
  longitude: -75.243573
  radius: 100
  icon: mdi:home-variant