MQTT Alarm Control Panel for Raspberry Pi and Android

I have the same issue. I found the apk (thank you), and side loaded on a fire tablet. When I enter the ip in the MQTT server field, since there is no OK button, hitting the enter button on the keyboard tries to start a new line.

Thanks.

that’s exactly what i’m seeing on both devices

I am uploading new releases for both Android Things and Android with a fix for the missing save/cancel buttons for broker. I also published a new version of the Android version to Google Play. Hopefully that will get everyone back in business.

Get an update from the release section with a fix, thanks!

That was quick. Will take a look. Thanks.

Big thanks on the quick fix for the table version. Is it the same for pi?

yep, same fix both platforms, just pick up the latest in the release section of the github repository

Just a quick question, is there a way for me to change the time zone?

Those instructions are in the GitHub ReadMe. You need to use the adb tool from the command line. There is no way currently to set the timezone from Android Things. The same goes for setting up WiFi, needs to be done from tht adb tool and command line. Instructions also in ReedMe.

I have released an updated version for mobile devices that has initial support for phones as well as tablets (though in landscape). You can get the new release on GitHub or Google Play store. Links included in this post.

2 Likes

Apologies for hijacking this thread with non-HAss questions. I saw this project and thought it was exactly what I needed so I’ve ordered all the parts which arrived at the weekend.

I’m able to install Jessie or Stretch and get a picture on the screen and use the Pi successfully. But if I put iot_rpi3.img in a card and plug it in the Pi just gets stuck in a rebooting loop. I get the rainbow screen, then the screen goes grey and the red power light flashes, then this loop repeats.

I’ve tried various cards, different tools for unzipping the downloaded image and so on but i get the same result every time.

Did you come across this or happen to know where I can find an answer?

Maybe its not burning the image correctly? What are you using to burn the image to your sd card?

Let me try with the latest release image and see if I can duplicate the issue. It’s completely possible that there is a problem with the image. I usually flash the Android Things and then compile my APK from Android Studio.

@stetho maybe you can try the previous release build v1.3.3. I will test installing the current build and see if there is an issue.

Looks to me like a power supply issue. If I use a weaker power supply like and older USB charger for an Android phone, I can see the same behavior you describe. I am not sure why running Jessie didn’t also produce issues with the display, it could be the way that Android Things drives the display. Try a different cable and/or different power source.

I purchased a new SD card today and tried that - worked first time.

So I’ve got the device connected to my wireless network but now I can’t get your code to compile to an APK. As a non-Android developer (and non-Java developer) I have no idea what I’m doing.

Error:(26, 0) Could not find method android() for arguments [build_o5tcb0u7v2p49rxh2molpbij$_run_closure3@247f5644] on root project ‘androidthings-mqtt-alarm-panel’ of type org.gradle.api.Project.

Any suggestions? Is there something I need to tweak in Android Studio before I start?

Thanks for all your help

Steve

Just download the latest zip file from the release section on GitHub and flash it to an SD. It already has the application and Android Things software together. I’ve tested it myself it works fine.

Something is odd with the project in Androud Studio. You should got clone the repository and then open existing project from Android Studio options. Makes sure you have SDK O or N as they have support for Android Things. The error you have makes no sense to me. I am guessing it’s something with gradle and how imported the project.

Progress has been made. Setting up Wifi was an absolute pig but I got it working. I’m currently left with two problems.

  1. The buzzer doesn’t seem to do anything.

  2. I can’t get it to work.This doesn’t seem to be your code’s problem though. This is the config in my HAss

    alarm_control_panel:
    - platform: mqtt
    name: "House Alarm"
    payload_disarm: "DISARM"
    payload_arm_home: "ARM_HOME"
    payload_arm_away: "ARM_AWAY"
    state_topic: "home/alarm"
    command_topic: "home/alarm/set"

And mosquitto_sub -h localhost -t +/+/+ shows
ARM_HOME
DISARM
ARM_AWAY
DISARM
ARM_AWAY
DISARM
ARM_AWAY
DISARM

But HAss just constantly says DISARM

33

Is this something you’ve come across? As I mentioned the fact I can see the messages in MQTT makes me think it’s a HAss problem but you might be able to see what I’ve missed.

Thanks

Steve

PS How do I rotate the screen on AndroidThings?

There is a lot questions happening in your post. For the MQTT Manual Control Panel you need the platform to be manual_mqtt and not mqtt, here is my configuration.xml.

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

Now for the buzzer. Have you tested the buzzer previously? Have you hooked it up according to the diagram? Do you have the positive and negative correct? Here is a link to the fritzing diagram: https://github.com/androidthings/drivers-samples/blob/master/pwmspeaker/rpi3_schematics.png

To rotate the screen on Android Things you need to edit your boot config on the RPi 3, here is a discussion about how to do that. https://stackoverflow.com/questions/41558508/screen-orientation-on-raspberry-pi-3-with-android-things.

Hope that helps!

1 Like

Sorry. Wrote the post while getting the kids ready for school and trying to get ready for work. Just splurged everything out.

Yes to everything. But I’ve ordered a new one.

Ah! Misunderstood that. I’m at work but will try it tonight as it’s probably that obvious. :slight_smile:

Same as it is in Raspbian. Should have tried that first.

I think we’re there. Thanks for guiding me - I’ll update when I get home tonight and implement the changes and again when the new buzzer arrives.

Steve