Home Assistant – notifications on iOS

Home Assistant has a nice iOS integration with the Home Assistant for iOS app. In this post I will describe how I have used the notify platform in Home Assistant to get notifications on my iOS devices when the front door of our house is opened.

Home Assistant

I have been using Home Assistant for about 10 months now and my initial steps with HA are described in these posts:

Home Assistant – getting started and using MQTT sensors

Home Assistant – integrating RESTful switches

Owntracks, Mosquitto and Home Assistant

The HA community does a great job and I try to stay updated with the new releases of Home Assistant. I’m currently on version 0.57.2 and I am hosting my Home Assistant on a Raspberry Pi 2.

The ios component

If you configure Home Assistant to use the ios component, the companion iOS app will have additional functionality for device tracking and notifications. To load the ios component, you simply add one row to your configuration.yaml file on your Home Assistant server:

This will also load the notify-, device_tracker and zero_conf platforms.

Basic notifications

With the ios component active in Home Assistant, you can use the States developer tool in HA to check that your device has been tracked via the iOS app:

iphone_tracked.png

With the device name found by Home Assistant, you can test to send a notification to the device with the Service developer tool. Use “ios_” + the device name for the service:

call_notify_service.png

If everything was setup correctly, a notification should appear on your iOS device after pressing the Call Service button:

push_test2.jpg

Automation rules for notifications

I have a home-made open door detector for our front door. It is described in this post:

A low energy open door detector with radio signals and MQTT

Every time the door is opened, it broadcasts a new sequential value via 433MHz and an ESP8266 board detects this and transforms the value to an MQTT message on the local LAN. My Home Assistant instance subscribes to these MQTT messages and it is recorded as a state change within Home Assistant.

I want to have notifications on my iPhone when the door is opened. This can be achieved with an automation rule. It will be triggered when the state of the door sensor is changed. The action that should be executed is sending a notification to my iPhone with the notify platform:

Now, when I open my front door, voilà, I get a notification on my phone:

hasbeenopened

As getting lots of these notifications while at home can be annoying, the automation rule can be modified with a condition so that the action is only executed when I’m not at home (or actually when my iPhone is not at home):

More on notifications

You can send notifications to several devices or a group:

https://home-assistant.io/docs/ecosystem/ios/notifications/basic/

Adding sounds

You can use a built-in or a custom sound for a notification:

https://home-assistant.io/docs/ecosystem/ios/notifications/sounds/

There is a built-in sound that fits my event perfectly. By adding this:

I get a notification with a speech recording “The front door has been opened” when the door is opened. Nice!

Actionable notifications

With Actionable notifications, you can make Home Assistant act on feedback from how the user handles the notification on the devices. I have not tested it yet, but it might be useful.

https://home-assistant.io/docs/ecosystem/ios/notifications/actions/

Attachments and dynamic content

With iOS10 you can send notifications with attachments and dynamic content:

https://home-assistant.io/docs/ecosystem/ios/notifications/attachments/

https://home-assistant.io/docs/ecosystem/ios/notifications/content_extensions/

This can be useful for sending a snapshot or a live stream from a security camera when a motion is detected. I have not tried it yet, but it will be an upcoming experiment for my Home Assistant-connected cameras.

Privacy, limits and security

https://home-assistant.io/docs/ecosystem/ios/notifications/privacy_security_rate_limits/

My Home Assistant configuration

My Home Assistant configuration is available on GitHub:

https://github.com/LarsBergqvist/Home-Assistant_configuration

 

 

 

 

Advertisements

2 Comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s