Improving the data connection for alarm monitors

Previously, the alarm monitor requested new data at fixed intervals. This normally led to a delay of a few seconds between updates. The monitor reloaded itself completely every minute to update layout changes. With this change, we improve this behavior so that data is loaded when it changes and layout changes are applied directly. With this update, the periodic “flickering” of the monitor also disappears.

Note for users of our Raspberry Pi image

The monitor currently reloads completely every three hours - this setting is no longer required. You can either use the new, updated image (article in German) or remove this setting manually. To do this, connect to the Raspberry Pi via SSH, for example, or connect a keyboard.

Edit the settings of the recurring tasks:

1
pi@groupalarm:~$ sudo crontab -e

You will see the following:

1
2
3
@reboot /root/update_wifi_password.sh
0 5 * * 3 /sbin/shutdown -r now
* 1,4,7,10,13,16,19,22 * * * sudo -u pi /home/pi/chromium_key.sh Shift+F5

Comment out the last line:

1
2
3
@reboot /root/update_wifi_password.sh
0 5 * * 3 /sbin/shutdown -r now
# * 1,4,7,10,13,16,19,22 * * * sudo -u pi /home/pi/chromium_key.sh Shift+F5

Close with Ctrl+X and confirm with Y.

If you also want to adjust the restart of the Raspberry Pi every Wednesday night, change the second to last line. Use * instead of 3 to restart every night at five or comment out this line to avoid a restart completely.

1
2
3
@reboot /root/update_wifi_password.sh
0 5 * * * /sbin/shutdown -r now
# * 1,4,7,10,13,16,19,22 * * * sudo -u pi /home/pi/chromium_key.sh Shift+F5

How it works

Using Server Sent Events (SSE), we enable our servers to communicate directly with the monitor without the monitor having to request the data repeatedly. The monitor authenticates itself using a token when it opens an SSE stream to the server. From then on, the server can send event messages to the monitor.

Is this secure?

Yes, the token is only sent once, instead of with every request. In addition, GroupAlarm uses strict TLS guidelines: once the SSE connection has been established, only our server can communicate with the monitor; both the IP address and the TLS certificate must match. If either of these conditions is not met, the monitor immediately terminates the connection and tries to establish a new (secure) connection.

What happens if the connection is interrupted?

If your Internet connection is interrupted or the GroupAlarm servers are not accessible, the monitor will try to establish a new connection at 10 second intervals. As long as the connection is interrupted, the status of the monitor remains static. As soon as the connection is re-established, the monitor synchronizes with the server, displays the current data and reacts to changes again. You can recognize an interrupted connection by a message at the bottom of the screen.

Which hardware is supported?

The connection was tested on the following devices:

  • Raspberry Pi 3 with our image
  • Raspberry Pi 4 with our image
  • Windows 10 PC
  • MacBook Pro

As long as your device supports a current browser (Chrome, Firefox, Safari), the connection will also work on your device.

Are there additional costs for metered connections?

No, on the contrary, by only querying changed data, we were able to significantly reduce the amount of data when is sent to your device.

Here is an example:

In a small fire department around 150kB of data will be sent per incident. With 50 incidents per year, that corresponds less than 10MB per year. Prior to this update, the same fire department would receive more than a gigabyte of data per year.

What happens to existing monitors?

You don’t have to make any changes. The monitor has already updated itself to use the new data connection. If you are bothered by the “flickering” of the monitor caused by the regular reloading of the browser, please update the image of the Raspberry Pi.

What are the advantages of the update?

  • Real-time updates
  • No “flickering” of the monitor
  • Less data consumption
  • Less server load
  • Faster response to layout changes
Thomas Düren
Thomas Düren | Software Engineer
Jason Songhurst
Jason Songhurst
view changelog