MQTT Alarm Control Panel for Raspberry Pi and Android

Interesting, guess they made a change then. I remember at one time I was trying to run two different services through the same bot/API key and it wouldn’t let me.

I will investigate it, maybe there is something different about the API setup.

Very excited about this project, I purchased a Pi Screen and new Pi (I realised it doesn’t work with the new B+) so i’ve got a spare Pi now…

I got it all setup on the Pi and and Android phone too (love it works on both!) the MQTT server is setup (hass.io) and i’ve got it to connect to the broker (at least it doesn’t come up with any errors)

When it first loads I can arm the system, but then I can’t seem to disarm it, I can type the code and it accepts it, but then shows SYSTEM ARM AWAY on the screen after…

I’ve looked in the MQTT logs and I noticed home/alarm has nothing in the channel, I then tested arming/disarming from HASS dashboard, seems I can get a disarm message in MQTT home/alarm/set channel and nothing else (arm commands don’t post)

I’ve been playing with HASS for years now, but just got back into it and MQTT is still a bit new to me, what would be next steps for me to try and debug what is going on?

What’s your configuration yaml look like? Since the disarm command comes back from HASS, it just not be receiving the disarm command from HASS either because it’s different or the component for mqtt isn’t correct. Does the alarm panel in HASS show the system as armed when you arm the system with the Android or Pi devices?

I think some people have been able to get Android Things working on RPi B+ but I’ll have to investigate. I do have an update in the works that updates the Android Things version to the new release but i didn’t see any indication that they made changes to support RPi B+. Mainly I’m working on day/night mode and support for portraits or landscape modes.

Thanks @thanksmister for your prompt reply! Don’t worry about the B+ I’m going to use it for a dakboard.com :slight_smile: B+ isn’t even supported by hass.io yet and its easy to source the old boards. (I bought it for the POE hat but they are not even out yet and I found the $7 ebay POE adapters work fine with pi+touchscreen even though they are only 2.4a)

Code is like this: (added code so I could use it on the hass dashboard)

alarm_control_panel:
  - platform: manual_mqtt
    state_topic: home/alarm
    command_topic: home/alarm/set
    code: 1234

MQTT: (Just what I setup to get multi sensor working) (192.168.0.10 = localhost)

mqtt:
  broker: 192.168.0.10
  client_id: homeassistant
  discovery: true
  discovery_prefix: homeassistant

It seems like now when I arm or disarm the system in the dashboard the status isn’t updated on the alarm panel (or via mqtt) & when I arm the system via the android panel it also doesn’t update mqtt or hass dashboard.

The big thing for me that is strong (obivously besides it not working) is when the android panel is armed when i enter the code and it is accepted is still displays ‘armed’

Any recommended MQTT listeners for Mac? I just setup MQTTbox - might be something better I can use to see what is going on.

Also just wondering if the sound works on android phones? Wondering if it just my broken configuration that is stopping sound (I just ordered a buzzer for the Pi so I wont know on that device for a month…)

Are you using hass.io? I don’t have any configuration for mqtt in my yaml file just the alarm control panel. I have just the mosquito add-on with default settings. Maybe a port issue or mqtt issue within HASS itself. I am not familiar with mqtt listeners for Mac. The Android device will use haptic feedback for buttons if active on your phone. It will also use your default alarm sound for beeping when the alarm needs the code. For when the alarm is triggered you need a separate siren hooked to HASS. I have a a Zwave one.

I think this is an issue with your mqtt setup and not the applications. It seems they connect but your HASS isn’t sending or receiving mqtt messages.

The Pi version no longer uses a buzzer and now uses a powered usb speaker. I don’t think the code is there to support a buzzer because it was just not loud enough.

Yep - hass.io & Mosquitto broker (autoboot on, update off)

Here is the config for MQTT. (all default settings except attempted to turn on ssl after it didn’t work, I haven’t setup any cert / key / pem files

{
  "plain": true,
  "ssl": true,
  "anonymous": true,
  "logins": [],
  "customize": {
    "active": false,
    "folder": "mosquitto"
  },
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"
}

Yep - I’m going to investigate alarms / sirens, might just use my sonos speakers for the time being to play with it. Good to know the phone will make sound as I might setup a second device near the bedroom once I get it working.

Sorry, must have read an old tutorial on it that mentioned the buzzer.

any recommendations from anywhere here on cheapish powered USB speaker that don’t use too much power? (or non-powered ones) It will all be sharing POE (pi, screen + speaker)

Anyone here got any ideas why my hass.io MQTT Mosquitto broker with default settings isn’t working with the alarm?

I’ve setup the cloudmqtt server just to test it and the app seems responsive now (e.g. goes from armed to disarmed fine)

I’ve reset to default settings, I am using it without login? Could that be causing issues?

No without login isn’t an issue. The mqtt doesn’t pass any code either. But what did seem odd is the way you setup your mqtt. That should be HASS add-on and just leave the default settings also be sure to restart HASS. The config for the manual alarm seems to be fine. Check how you have mqtt setup for HASS.

Your MQTT looks like mine, nothing odd there.

Strangely, since i’ve added user/pass to hass.io broker it seems to have started working…

Now I have at least got the states updating time to play with more things :slight_smile: time to dive back into automations

This is my configuration yaml file:

# Manual Alarm
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

Thanks again for your help and your efforts you put into this project @thanksmister

I’m looking forward to getting these wall mounted! I’ve already run the ethernet cable through the walls right next to the front door :smile:

Have you tried it without the code? MQTT doesn’t pass a code to HASS, just wondering if this could be some problem. But also be sure you are on the same Wifi as your home assistant, just throwing out stuff at this point.

Got it working, and syncing across HASS dashboard, PI device & Android phone app :sunglasses:

My only feedback for the moment is the language

Would we change the copy to read once the alarm has been activated:

System Armed Home from System Arm Home &
System Armed Away from System Arm Away when the alarm is activated?

It’s a minor thing - but confused me a little, and for wife approval it will help her understand better :blush:

Also verify that you are using the correct port and IP address (you need the actual address for the MQTT broker) I have something like 192.168.86.228 and port1883 for my MQTT broker in the alarm application.

Oh man… haha. I will make those changes just for you buddy. Hey, how did you get it working after all?