Mobile Alerts and openHAB 2

Hi Stefan,

I also have:

MA10100 Temperature sensor
MA10001 Temperature probe
MA10421 Temperature/Humidity station

I have them all in Openhab and charted with Grafana using either web page caching or API call and then using Regex to extract the relevant data. With the API you also get the low battery information and loss of connection.

I wish they did a barometer but they dont so now I am building one from RPi and sensor :slight_smile:

edit… Update I did build my barometer and it works great. Stepper motors drive the dials for pressure and rate of change. No need to tap this barometer to see which way its going :slight_smile: It sends data via MQTT to Openhab and then on to Influx and Grafana. In the meantime Mobile Alerts updated the app to accomodate a barometer. I have not yet seen it for sale.

Hey Mark,

sounds nice.

I haven’t checked the battery messages by now.
My last state of information was that the rest API only works on pro devices and not for the non pros?

Would you mind of sharing your sensor ids with me for testing purposes?

Hi folks,

i've read and reread all post, but i don't get into it...
I have multiple MA-Sensors. I got one Sensor working - the first in the list by using


But i don’t get the way to implement all the other sensors from the list…
Can anyone provide me a step by step tutorial for getting all Temp/Hum sensors to work?
(actually i don’t now where to put all the above listet codeings…)


Hi, Sorry forgot about your question re sharing. What are the risks if any?

Also, I recently notified mobile alerts of an issue over the Christmas period. Non pro devices were not showing latest data in the App from 2 to 8am. Also, the sensor overview web page was unavailbale during this time. Later in the day the App caught up with the data. So, the data wasn’t lost but delayed. Annoying that the app and website both showed the last bit of the data in the history as the current data with the current time… even though it wasn’t.

Mobile alerts aknowledged there was an issue and have now said they have fixed it…

Maybe only I noticed it but in your charts you might see an unusually stable period in the early hours or even time slipped data.

ps Got my barometer built: Bosch sensor + MQTT for openhab input + stepper motor dials for fun display. RPi to the rescue again :slight_smile:

I wish I had the time but…

In a nutshell…cache the sensor page (and or use API call if you have pro devices) and the use transform file and regex to extract the data. I identify each sensor with its id. That way when I want to add a new sensor I just copy paste the regex and only need change the sensor id part for new sensors…

Hi, first of all I want to thank everybody for the good information in this thread.
I tried the examples but have encountered a problem.
I create an item that should display the status of 2 garage door contacts, the channels are defined like this

Group gGaragenDiiren
String	garagenDiirAnnette
	"GaragenDiir Annette [%s]"
	{ http="<[mobileAlerts:60000:JS(getGaragendiirAnnette.js)]" }
String garagenDiirMarc
	"GaragenDiir Marc [%s]"
	{ http="<[mobileAlerts:60000:JS(getGaragendiirMarc.js)]" }

the problem is that i only get one item displayed, and where the second should be, I see de complete HTML code of the page.

The transformation is done like this

(function(i) {
	    var re = new RegExp('xxxxxxxxxx[\\s\\S]*?Contact Sensor[\\s\\S]*?<h4>([a-zA-Z]+)');
	    var out = i.match(re)[1];
	    return out;

they are both identical, only the ID in the regex does change

Any ideas concerning this problem ? I also would like to find where the syntax of the channel line is documented, as I do not understand why it starts with a < tag

For testing that the regex works as expected I extracted the source code from sensor web page and then used one of the free regex test sites to test my expression. You may need to remove on the \ from double \ in your expression to work with the rest site.


For those that are interested

I now have all Mobile Alert sensors as items in Opemhab and charted via Influx and Grafana. What was missing was some indication when a sensor had stopped working.

I could have used API call for the ‘Pro’ devices but wanted something that would work for ALL my devices. So, I used web caching (need HTTP binding for this) to extract each sensor time stamp and a rule to check the time since a sensor was last seen. It took quite a bit of work determining the best method to do the task and then more wok in getting the types correct.

Details are below:

Time stamp Item…
String HeatPumpReturnTemperatureTimestamp "Heat Pump return sensor time stamp [%s]" { http="<[sensorCache:60000:JS(getTimestamp.js)]" }

JS transform with REGEX to extract the time stamp…

(function(i) {
    var re = new RegExp('Sensor_ID_goes_here[\\s\\S]*?Timestamp[\\s\\S]*?<h4>([0-9]+/[0-9]+/[0-9]+ [0-9]+:[0-9]+:[0-9]+ [A|P]M)</h4>');
    var out = i.match(re)[1];
    return out;

Rule to check when a sensor was last seen…

import java.text.SimpleDateFormat

rule "Heat pump return temperature time stamp check"
    Item HeatPumpReturnTemperatureTimestamp received update
    val String timestamp_str = HeatPumpReturnTemperatureTimestamp.state.toString //from http cache and REGEX transform

    val SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss a")
    val DateTime timestamp = new DateTime(formatter.parse(timestamp_str))          
    val Number elapsedtime = (now.millis - timestamp.millis)/60000

    if (elapsedtime > 30) { // 30mins since last seen
        sendNotification('your email address','Heat pump return sensor not seen for  ' + elapsedtime + 'minutes')
        logInfo("Mobile Alerts" , "Time now = " + now)
        logInfo("Mobile Alerts" , "Heat pump return sensor time stamp = " + timestamp)
        logWarn("Mobile Alerts" , "Heat pump return sensor not seen for " + elapsedtime + " minutes")

Hey Mark,
I tried to go your way. But it didn´t work.

My item:
Number MobileAlerts_Outside_Temperature “Temperatur Balkon [%.1f °C]” (mobilealerts) {http="<[mobileAlerts:60000:JS(getTemperatureout.js)]" }

My getTemperatureout.js
(function(i) {
var re = new RegExp(‘Sensor-ID[\s\S]?Temperature[\s\S]?

([0-9]+.[0-9]+) C’);
var out = i.match(re)[1];
return parseFloat(out);

My addons.cfg:
transformation = javascript,map

My http.cfg:

at HABpanel it only shows NULL

at Basic UI it only shows - °C

at paper UI - Transfomations I installed Javasript Transformation und Map Transformation.

with all is shown correctly.

where did I made a mistake or what could missed?

Greetings, Ansgar

I see one problem so far

For checking regex on websites [\s\S] works but for Openhab it should be [\\s\\S]

Its easier to read if you enclose your posted in code in code fences. Button on far right after the smilie.

Any errors in the log?

Cheers Mark

(function(i) {
    var re = new RegExp('02512688AC27[\\s\\S]*?Temperature[\\s\\S]*?<h4>([0-9]+.[0-9]+) C');
    var out = i.match(re)[1];
    return parseFloat(out);

Message at openhab.log:

org.openhab.core.transform.TransformationException: An error occurred while executing script.
at org.openhab.core.transform.TransformationHelper$TransformationServiceDelegate.transform( ~[210:org.openhab.core.compat1x:2.4.0]
at org.openhab.binding.http.internal.HttpBinding.execute( [246:org.openhab.binding.http:1.13.0]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute( [210:org.openhab.core.compat1x:2.4.0]
at org.openhab.core.service.AbstractActiveService$ [210:org.openhab.core.compat1x:2.4.0]
2019-03-12 19:12:52.924 [WARN ] [ab.binding.http.internal.HttpBinding] - Transformation ‘JS(getTemperatureout.js)’ threw an exception. [response=

did you test the regex on the sensor web page? eg regex101. Goto sensor web page , view source and copy the code. Paste into regex101. The regex expression will need the double backslash changing to one backslash. You can play around with the regex and you should see it match something.

sorry, I not really expert.
Where can I test this?
where do i find regex101?

I am not an expert either. I just learnt enough to get the job done.

This will test if your regex is working as expected and returning a number.

Or post the html and I can try for you

I see a possible problem. The regex should have an OR condition | to allow for + and - temperatures :

<h4>([0-9]+.[0-9]+|-[0-9]+.[0-9]+) C'

Was the outside temperature minus C when you tested?

now I use https: and not http: at http.cfg an I find the correct names at the *.js files.

Hey Mark,
I tried to get the info “Trocken” or “Nass” with js-file.

Did everyone test it and can help?

Hello to everyone,
I found the solution for the sensor MA10101:

The item:

string		MobileAlerts_Indoor_Water	 				"Wassersensor Küche [%s]"										<water> 				(mobilealerts) 				{http="<[mobileAlerts:60000:JS(gettrockenin.js)]"}

(function(i) {
    var re = new RegExp('SENSOR-ID[\\s\\S]*?Wassersensor[\\s\\S]*?<h4>([a-zA-Z]+)');
    var out = i.match(re)[1];
    return out;

    rule "Wasser"
	Item MobileAlerts_Indoor_Water changed from Trocken to Feucht
	sendTelegram("BOT-Name", "Wasser!")

Hi togehther
I`m brand new with the openhab2 system and I need help to integrate my MobileAlert things.
what I had do:

Step One:
Add the following lines in http.cfg in the folder services . Please replace the xxx with your phoneid from the Mobile Alerts App


I can see in the LOG:

<div class="panel panel-default">

    <div class="panel-body">

        <div class="sensor">

<div class="sensor-header">


        <a href="/Home/MeasurementDetails?deviceid=XXXXXXXXXXXX&amp;vendorid=XXXXXXXX-9XXX-XXXX-XXXX-XXXXXXXXXXXX&amp;appbundle=de.synertronixx.remotemonitor">Zimmer EG</a>


    <div class="sensor-component">





<div class="nofloat"></div>

    <div class="sensor-component">


        <h4>25.03.2019 15:04:38</h4>


    <div class="sensor-component">


        <h4>17,5 C</h4>


    <div class="sensor-component">

        <h5>Luftfeuchte</h5> <!-- Luftfeuchtigkeit -->






Step Two:

Create a new or edit your existing items file and add the following items:

Number MobileAlerts_AirQuality "Air Quality[%d ppm]" { http="<[mobileAlerts:300000:REGEX(.*?([0-9]+) ppm.*)]" }

String MobileAlerts_Outside_TemperatureString "Outside Temperature [%s]"  { http="<[mobileAlerts:300000:REGEX(.*?Temperature Outdoor.*?\\s.*?(-*[0-9]+,[0-9]+) C.*)]" }
Number MobileAlerts_Outside_Temperature "Outside Temperature [%.1f °C]" 

String MobileAlerts_Indoor_TemperatureString "Indoor Temperature [%s]"  { http="<[mobileAlerts:300000:REGEX(.*?Temperature Indoor.*?\\s.*?(-*[0-9]+,[0-9]+) C.*)]" }
Number MobileAlerts_Indoor_Temperature "Indoor Temperature [%.1f °C]" 

Number MobileAlerts_Indoor_Humidity  "Indoor Humidity [%d %%]" <humidity> (Raumklima, Wohnzimmer) {http="<[mobileAlerts:300000:REGEX(.*?Humidity Indoor.*?\\s.*?([0-9]+)%.*)]"}


Step Three:

To convert the “,” to “.” in the temperature readings and save the values as numbers define two rules as follows:

I hope someone can help me.
also how I can build a lot of sensors. Badroom, kitchen,…

kind regards

…and sorry for my bad english

Hey Mark,
thanks for your answer.
I use this item:
Group mobilealerts
“Mobile Alerts Sensoren”

Number mobileAlerts_Outside_Temperature “Temperatur Balkon [%.1f °C]” (mobilealerts) {http="<[mobileAlerts:60000:JS(getTemperatureout.js)]" }
Number mobileAlerts_Outside_Rain “Regen letzte 24 h [%.1f mm]” (mobilealerts) {http="<[mobileAlerts:60000:JS(getrain.js)]" }
Number MobileAlerts_Indoor_Temperature “Temperatur Küche [%.1f °C]” (mobilealerts) {http="<[mobileAlerts:60000:JS(getTemperaturein.js)]" }
Number MobileAlerts_Indoor_Humidity “Luftfeuchtigkeit Küche [%d %%]” (mobilealerts) {http="<[mobileAlerts:60000:JS(getHumidityin.js)]"}
String MobileAlerts_Indoor_Water “Wassersensor Küche [%s]” (mobilealerts) {http="<[mobileAlerts:60000:JS(gettrockenin.js)]"}

this js-file for temperature:
(function(i) {
var re = new RegExp(‘SENSOR ID[\s\S]?Temperatur[\s\S]?

([0-9]+.[0-9]+) C’);
var out = i.match(re)[1];
return parseFloat(out);

this http.cfg:

and only get rounded results

at events.log I found:
2019-03-25 18:57:46.924 [vent.ItemStateChangedEvent] - mobileAlerts_Outside_Temperature changed from 7.0 to 6.0

at openhab.log I found:


22.03.2019 20:44:13


15,5 C