MQTT Alarm Control Panel for Raspberry Pi and Android

I was able to do more tests tonight:

  • after a reboot I can send notification/speak without issue.
  • if the inactiviy timer kicks in, notifications are a hit or miss after it, mostly miss however.
  • I got one crash when the app switched to night mode
  • every time I start/restart the app, I can see 3 to 5 ALARM/disarmed records in the log while I see no activity in Mosquitto.


I restarted the app at 19:45


same time on mqtt broker

Let me know if I can help you in any way.

Sounds like the application is being killed or the WiFi is being disconnected . What are you using for keeping you device awake?

You need to be running some type of device level screensaver with the device unlocked. Otherwise the application will stop working and you won’t have internet or communication with your MQTT broker.

I can’t emphasize this enough, if your device goes into deep sleep mode, the application will stop working. Some devices also turn off WiFi if they are partially asleep and usually have an option to keep the connection active. Depends on the device.

I recommend using the Android Daydream if you have it. If not, you can use the “prevent sleep” option in the settings along with the built-int screen saver.

I have crash tracking within the application so if you tell me the specific device and the OS version I can check the logs for the crash. I think you are just seeing the subscription connecting which seems to be adding to the logs, but its not flooding the logs.

This isn’t an application solution, this is a solution based on using the developer options of Android, which most users wouldn’t know how to use. It would be the same as just preventing the application from sleeping, which there is already an option in the settings.

Wow thank you!! I love this one and it was so easy to set up. Very nice layout and all the options that I would like to have are there. For now I’m using a cheap tablet with the Android app, later on I might build it with an Rpi tough.

The only tiny little thing that I would like to see different is to have the clock in 24h format (or have the option). Because now it’s in PM/AM. The general android settings already are in 24h format so that doesn’t do the trick.

Try restarting your device or application. The application will follow the device format but on some devices it just doesn’t initially work after installation.

Already did that and I even reinstalled the app, but doesn’t help.

There is no magic involved with displaying the time in your locale. If you have 24 hour clock set, then the application adheres to that. I can’t manually make it work. Which device do have and which version of Android?

Ok… well I don’t seem to be the only one. To be honest I have no idea what brand this tablet is, I got it years ago from AliExpress for a super cheap price. The Android version is 4.4.4

I thought you might be able to force the time format to 24h or something, but if this problem isn’t for the most people I gues you shouldn’t put to much effort in it. :slight_smile:

Well, you would be the only one who couldn’t change the application to 24 hour clock. Everyone who has had an issue so far as managed to fix it by just restarting the device.

Which language or region do you use? It could be some compatibility issue with your region. There should also be a setting on your device to make the device 24 hour clock as well. Just check that setting.

Do you see a change in the date format?

I have the same problem. Took a look at the code but couldn’t figure out what is happening. But definitely there is something going on as all my phones/tablets are in 24h format (Spanish locale) and this is the only app that sometimes doesn’t follow the 24h format. I say sometimes as my Nexus 6p phone (also in 24h) does show this app in 24h but my Samsung Galaxy tablet does not. Funny thing I tested with an ancient Samsung Galaxy phone running a version of CyanogenMod and it also didn’t show time in 24h.

I’ll see if I have some time to recheck the code to see if I can find anything. Maybe a workaround is to place an option in app to select 12h/24h…

Regards

The code is simple, its located in just one spot, here is the GitHub file:

The code is as follows:

val currentDateString = DateFormat.getDateInstance(DateFormat.LONG, Locale.getDefault()).format(Date())
        val currentTimeString = DateFormat.getTimeInstance(DateFormat.DEFAULT, Locale.getDefault()).format(Date())
        dateText.text = currentDateString
        timeText.text = currentTimeString

That sets the date and time based on the devices default locale. The only way to work around this is to force a locale for the application or a format for the time/date. That’s not what I wanted to do because I want the application to follow the device. It also should just work. I am in Argentina and I am running everything on all my test devices in 24 hour format, but I did have to set 24 format in the device settings. However, since my language is set to English, I had to set my device to actually display 24 hour clock in the settings:

Are you dates also backwards? Like instead of 22/11/2018 you are seeing 11/22/2018? That would be strange as well because it should also adhere to your current locale setting. I have a mixed locale, so selecting the English language on my device displays 11/22/2018 as it does in North America, but I deliberately put my phone in 24 hour mode to display 18:36 instead of 6:36 p.m.

Ok, I created a bug in the issue that you can follow (https://github.com/thanksmister/android-mqtt-alarm-panel/issues/69). It seems that on some devices there is an Android bug that does not follow the devices 12/24 set format. There are workarounds that need to be added to the application to fix the issue. As a last resort we can add a 24 hour clock setting to the settings and force that format for displaying the time.

The date at the right top is “November 23, 2018”

Is this the date you expected? Is it the same format as your phone? I pushed out a new update today to see if I could get the 24 hour clock set to the device clock. Let me know if you update and see any difference.

Yes after the update it works great! Thanks a lot!

I can also confirm the latest version shows 24h format on the top right. Many thanks @thanksmister for looking into this. The clock screensaver still shows 12h format so maybe it should be updated as well?

Thanks again…

Yeah, I forgot to update the code in the screensaver. Next release.

1 Like