I have some Mobile Alerts sensors in the house. I originally wanted to read them out with the RaspberryPi via the Mobile Alerts Rest API. But since only certain sensors work there (mine unfortunately don’t), I tried a slightly different method. This variant is not as reliable and also a bit complicated, but at least it works.

Hint: There is another method

Preparations

The sensors should already be connected to the gateway and integrated into the Mobile Alerts App. In the app settings you will find the phone ID relatively far down. This will be needed later.

Then visit the page https://measurements.mobile-alerts.eu/Home/SensorsOverview?phoneid=XXXXXXXXXXXX

At the end, the phone ID must be added. You should now see all the sensors there.

Creating the script

Now we need some lines from the source code. This is how the Python script that reads out the data will work later. To do this, right-click on the page and select “Show page source” (this may vary depending on the browser).

Here, for example, I see that the temperature of the bathroom (“Badezimmer” in German) is in line 66. The humidity is in line 70, and this is also the weak point of the script. If the temperature of the bathroom is no longer in line 66, the script no longer works and must be adapted. As a rule, such a change only occurs when another sensor is added or removed.

This is already the script. For the time being, it only reads out the data.

Line 4: The source text of the web page is downloaded here. It is saved in /home/pi/sensors.txt. (don’t forget to replace the phone ID) (Update: Since 15.4.21 the download via wget is blocked by Mobilealerts. The additional option “-U firefox” makes the website think that it is a firefox browser. I hope that this will continue to work).

Lines 5 and 6: Here a variable is set to the corresponding lines (66 and 70) and then everything is removed except for the number. In the case of temperature, the comma must be replaced by a dot.

Lines 8 and 9: The read data is output here. Of course, something completely different can be written here. For example, the data could be written to a database or processed in some other way (e.g. if it is too hot in the bedroom but colder outside, the window should be opened).

Line 10: The source text is deleted. It is no longer needed.

I hope I could help you with this short tutorial 😉