MQTT Alarm Control Panel for Raspberry Pi and Android

Hey @thanksmister, I appreciate your hard work on such an awesome app. I’m a little stumped as to why my alarm won’t connect to my MQTT broker. I use HASS.io with the local MQTT broker plugin, and my broker works great for a lot of other devices. By default that broker listens on ports 1883 and 8883 on TCP. For some reason, when I try to connect with the MQTT Alarm Panel, it says “Couldn’t subscribe to the MQTT topics”. I’ve tried on multiple devices to make sure.

BTW I’m happy to provide snippets of logs and config files if that would be helpful.

I got it to connect for a minute but then has the same error.

This is the error i get: “couldnt subscribe to the mqtt topics, check the mqtt broker settings or your connection”

Using cloudmqtt with standard settings

It’s not able to connect to your address, make sure you use the fully qualified address (192.168.1.1) with the proper port, this could be a domain name as well. Enter your username/password if needed in the settings as well. I don’t use cloudmqtt but some others have used it with success. I am looking for the discussion I had with one person using CloudMQTT to connect to see what he did.

@thanksmister So it looks like if I turn the device off and back on again, then it works for like a minute. But as soon as a few minutes pass, if I try to do something on the alarm panel it gives me the “Couldn’t subscribe to the MQTT topics” error.

Then it’s probably your MQTT broker that is breaking the connection. I am not sure. I use the component Manual Alarm Panel with MQTT support with built-in MQTT service for HASS (using the defaults). In my configuration I use the following:

alarm_control_panel:
  - platform: manual_mqtt
    state_topic: home/alarm
    command_topic: home/alarm/set
    pending_time: 60
    trigger_time: 1800
    disarm_after_trigger: false
    delay_time: 30
    disarmed:
      trigger_time: 0
    armed_home:
      pending_time: 0
      delay_time: 0
    armed_away:
      pending_time: 60
      delay_time: 30

In my application I set the broker and port using the IP address of my MQTT broker for HASS with the following settings:

Broker: 192.168.86.228 (without the http:// or https://)
Port: 1883
Command: home/alarm/set
Topic: home/alarm

You need to enter your own IP address, not http://hassio.local:8123/ because that won’t work. I didn’t do anything else to get my setup working, no username or password, etc.

Try restarting your HASS or uninstalling and reinstalling your MQTT broker add-on. It’s not an application issue, so there is nothing I can really do to guide you on how to fix it. Also try on another device, maybe there is something that is preventing the device from keeping the connection, like turning off WiFi, sleep mode, background data, etc…

@thanksmister it is working fine on my phone, so I think it’s the Fire Tablet that I was using. I’m going to just purchase a device to be dedicated to the alarm panel. Do you recommend the Pi 3 with touch screen or is there an android tablet that you would recommend?

I usually recommend the fire tablet over the RPi with touchscreen due to the price. It’s unfortunate you’re having connection issues with the fire tablet. I use a RPi and been pretty happy though. I have the official 7" touchscreen and the Pi Camera V2.

My fire tablet is pretty old so maybe it just needs a wipe or I need to get the newer version. I appreciate the help! Do you have a place where you accept donations?

No donation needed its just my hobby making home automation applications. Glad to share.

3 Likes

I have tried to run IP Cam on the same device, but it says that it could not use the camera when the panel is running.

Is it because you have the camera option turned on for the device? I don’t see why it would be a problem, but maybe there is something to it.

Yes, I have it enabled in the panel to send notifications through Telegram.
It would be nice that booth apps could share the camera. IP Cam has some nice features to be usted in HA.

Well, I don’t think I can help with this issue. It might be a limitation with Android or IP Cam. I am only using the camera to take photos, not continuously capturing video. First test if turning off the camera makes any difference and also look for other options besides IP Cam. I assume IP cam runs continuously.

My guess is if you want to use IP Cam, you’ll have to trigger motions from there.

It won’t be as exact as to do it from the alarm panel, but on the other hand, you get a motion sensor, camera, lux sensor and audio sensor on your device that’s already there.

For people trying to connect to Cloudmqtt with the alarm panel, I have that working perfectly here. I use the fully qualified domain name as the address for the broker (mXX.cloudmqtt.com) with the SSL port and make sure to enable SSL on the panel as well.

I create a user on my cloudmqtt broker, give it read/write access on the broker and use that username and password on the panel. Not the username and password from the first screenshot.

I’ve got this up and running on two panels now with a RPi3 and the official 7" touchscreen, works like a charm.

1 Like

@warbringer thanks for posting that, big help!!

You might also try Motion Detector Pro, but you have to pay to use all the features. I was wondering if this would be a good job for OpenCV face detection but then there is the issue with low light.

Is it possible to post something to the MQTT broker and have the alarm panel use that as a trigger to snap a camera snapshot and send it off via the configured options (eg. mail or telegram?). I say this because the camera on my alarm panel is aimed at my front door. The front door has a Z-wave doorsensor, so I can have home assistant publish a message on the broker when that happens. If the alarm panel picks this up, snaps a picture and telegrams it to me, I will always have a picture of anyone who comes into my house instead of only when they successfully disarm the alarm.