Documente Academic
Documente Profesional
Documente Cultură
hackster.io /thanksmister/mqtt-alarm-control-panel-for-home-assistant-a206cc
Made by Michael
Ritchie
Hardware components:
1
Raspberry Pi 3 Model B
1
7" Touchscreen Display for Raspberry Pi
1/9
1
Adafruit Piezo Buzzer
1
Jumper wires (generic)
Home Assistant
3D Printer (generic)
Story
Overview
This project is a MQTT Alarm Control Panel for use with Home Assistant's Manual Alarm Control Panel component.
This project was built using a Raspberry Pi 3 and a 7" touch screen display running Android Things.
Home Assistant
Home Assistant is an open source home automation platform with the ability to integrate with many hardware
components as well as offer custom features for automation. Recently, contributor Colin O'Dell added a MQTT
Manual Control Panel which allows for communication between a custom alarm panel and the manual alarm panel
with MQTT.
I wanted an alarm panel which interfaces for Home Assistant's alarm control panel component and gives me the
functionality to control my alarm as well as be mounted near the front door. Using Android Things allowed me to
make a rich user interface and also add additional software features.
In my home I have several Z-Wave door sensors, a motion detector, and siren hooked up to Home Assistant. With
the manual alarm control panel and some automation, I can activate the siren as well send a notification using
IFTTT whenever the alarm is triggered. From my control panel I can arm/disarm the alarm through the interface as I
2/9
enter or leave.
Hardware
Touchscreen display, I used a 7" screen but any touch screen compatible with Android Things would work.
You should be using Home Assistant (v.0.50 or above) which adds the new MQTT Manual Control Panel as well as
having a MQTT component setup and running. I won't go into detail about how to setup Home Assistant or MQTT
because the documentation provided by Home Assistant is better than I could provide. Just be sure you have the
the alarm control panel and MQTT running first, also connect any sensors you might need.
Raspberry Pi Setup
Make sure you properly setup the RPi3 with the 7" Touchscreen Display. You won't need any special software setup
if you use the The Raspberry Pi Foundation 7" Touchscreen as it's compatible with Android Things. Other
compatible touch screens may require additional configuration for Android Things.
There are two ways to setup Android Things and also load the alarm control panel application.
1) The first option is to download the latest build (zip file) from the project's Github release sectionwhich includes
Android Things Preview 0.4.1 with the application already pre-installed. This option also allows you to receive future
OTA updates.
2) The second option is to setup your RPi3 to use Android Things 0.4.1-devpreview for Raspberry Pi 3 and then
build and install the application manually using Android Studio.
Clone the repository and compile the APK using Android Studio, then sideload the APK file onto your device
using the ADB tool.
Be sure to set up network access either using WiFi or ethernet. If you setup WiFi be sure to unplug the Ethernet
cable, at this time Android Things can't use both.
3/9
# Use the adb tool to connect over ethernet to the
device
adb connect Android.local
# Then set your your WiFi SSID and password
adb shell am startservice \
-n com.google.wifisetup/.WifiSetupService \
-a WifiSetupService.Connect \
-e ssid <Network_SSID> \
-e passphrase <Network_Passcode>
You probably also want to set the time and timezone of the device:
Now connect the buzzer as shown in the sample diagram from the Android Things drivers repository. This part is
optional if you want to have sound feedback.
The complete code for the application running on Android Things can be found in my GitHub repository:
https://github.com/thanksmister/androidthings-mqtt-alarm-panel.
4/9
When you first start the application you will be asked to go to the setting screen and enter your pin code. You also
need to enter the MQTT information that you configured in Home Assistant for your MQTT service. Be sure you
adjust the time intervals to match those set in the Home Assistant MQTT alarm control panel.
Application Settings
The application should then connect to your MQTT broker and display the current state of the alarm control panel in
Home Assistant.
Whenever the state of the alarm control panel in Home Assistant changes, the alarm control panel will reflect those
changes via MQTT communication. In order to deactivate the alarm, you will need to enter you pin code within the
time allowed.
A small countdown will appear to indicate the time remaining before the alarm is activated.
If you choose to get weather updates, enter your DarkSky API key and current latitude and longitude in the weather
setting screen. You can get your lat/lon by using maps.google.com and copy them from the url (they look like -
34.6156624,-58.5035102)
To use a Instagram screensaver rather than the digital clock, turn this feature on using screen saver settings. You
6/9
can load other Instagram images by changing the Instagram profile name in the settings.
Enclosure
I used an enclosure to give the alarm a small profile and also to make it wall mountable:
https://www.thingiverse.com/thing:1082431. However, be aware that this case may require extra screws as well as a
longer flex cable. There are plenty of other case options for the RPi 3 / 7" Touchscreen option available.
3D Printed Case
Notes
At this time there is an issue dimming the brightness of the backlight for the display. So for now I have included a
screen saver feature as a short-term fix until the bug is addressed by the Android Things development team. I will
update the application once this feature is working.
There have been multiple display issues using Android Things 0.5.0 and 0.5.1, therefore this application runs best
under Android Things 0.4.1.
It's important that the alarm control panel settings reflect the settings of those used in the alarm control panel
component. Initially the hardware control panel is set to the default settings of the alarm control panel component.
I also created an Android tablet version of the same project that is available on Google Play and as a downloadable
APK file for side loading.
Schematics
Download
Connecting your buzzer to the Raspberry Pi 3
Code
This is a repository with the latest code and release APK and Android Things project files.
thanksmister / androidthings-mqtt-alarm-panel
11
8/9
Android Things Alarm Control Panel for Home Assistant Read More
Download as zip
Credits
Michael Ritchie
Contact
Thanks to Colin O'Dell.
Replications
Did you replicate this project? Share it!
I made one
Love this project? Think it could be improved? Tell us what you think!
Give feedback
9/9