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.
I have been using Home Assistant for about 10 months now and my initial steps with HA are described in these posts:
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.
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:
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:
If everything was setup correctly, a notification should appear on your iOS device after pressing the Call Service button:
Automation rules for notifications
I have a home-made open door detector for our front door. It is described in this post:
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:
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:
You can use a built-in or a custom sound for a notification:
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!
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.
Attachments and dynamic content
With iOS10 you can send notifications with attachments and dynamic content:
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
My Home Assistant configuration
My Home Assistant configuration is available on GitHub: