Mobile Alerts and openHAB 2

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?

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

Hey Mark,
I use the sensor: TEMPERATURSENSOR MIT WASSERDICHTER KABELSONDE (MA10101)
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)]"}

Javascript:
(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;
})(input)

Rule:
    rule "Wasser"
when
	Item MobileAlerts_Indoor_Water changed from Trocken to Feucht
then
	sendTelegram("BOT-Name", "Wasser!")
end

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

mobileAlerts.url=http://measurements.mobile-alerts.eu/Home/SensorsOverview?phoneid=xxx
mobileAlerts.updateInterval=300000

I can see in the LOG:

<div class="panel panel-default">

    <div class="panel-body">

        <div class="sensor">

<div class="sensor-header">

    <h3>

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

    </h3>

    <div class="sensor-component">

        <h5>ID</h5>

        <h4>XXXXXXXXXXXX</h4>

    </div>

</div>

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

    <div class="sensor-component">

        <h5>Zeitpunkt</h5>

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

    </div>

    <div class="sensor-component">

        <h5>Temperatur</h5>

        <h4>17,5 C</h4>

    </div>

    <div class="sensor-component">

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

        <h4>41%</h4>

    </div>

        </div>

    </div>

</div>

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]+)%.*)]"}

I DONT NO WHAT I NEED TO CHANGE by this file.

Step Three:

To convert the “,” to “.” in the temperature readings and save the values as numbers define two rules as follows:
I DONT NO IN WHICH FILE I NEED TO COPY this text

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

kind regards
goair

…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);
})(input)

this http.cfg:
mobileAlerts.url=https://measurements.mobile-alerts.eu/Home/SensorsOverview?phoneid=XXXXXXXX
mobileAlerts.updateInterval=60000

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:

Zeitpunkt

22.03.2019 20:44:13

Temperatur

15,5 C

Hallo Ansgar
kannst Du mir auflisten, wie Du vorgegangen bist?
Ich kriege keine Temperatur oder Luftfeuchtigkeitsanzeige hin.

Besten Dank
Gruss
goair

[quote=“adb76, post:1, topic:21444”]
Als erstes musst Du das “ HTTP Binding ” und die “ RegEx Transformation ” service via the Paper UI installieren.
Dann musst Du in der “http.cfg” im Ordner “services” folgendes entragen:

mobileAlerts.url=http://measurements.mobile-alerts.eu/Home/SensorsOverview?phoneid=xxx
mobileAlerts.updateInterval=300000

Anschließend musst Du die Items wie in der Beschreibung oben erstellen:
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 %%]” (Raumklima, Wohnzimmer) {http="<[mobileAlerts:300000:REGEX(.?Humidity Indoor.?\s.?([0-9]+)%.)]"}

Nach dem Post von m4rk Mark vom Jul 18 weiter oben musst Du die jeweiligen *.js Dateien anlegen.

Nach ein paar Minuten sollten die Werte angezeigt werden.

Hi Ansgar
many thanks. now they will work fine!

regards
goair

Hi together
how can I set the value wind direction with the output in text?
example: north, northeast and so on ? everything else works, temperature, wind speed, rainfall,
humidity …

my winddirection.js:
(function(i) {
var re = new RegExp('SENSORID[\s\S]?Windrichtung[\s\S]?

([0-9]+.[0-9]+) ');
var out = i.match(re)[1];
return parseFloat(out);
})(input)

my .items:
String windrichtung “Windrichtung [%s]” { http="<[sensorCache:60000:JS(winddirection.js)]" }

my .sitemaps:
Default item=windrichtung icon=“wind”

Thank you very much

Hey Marco,
did you get exact resulte as 12,4° C or just 12,0° C?
I just get rounded results.
Regards, Ansgar

Hey Ansgar
i will get the right resulte.

regards

can you post your *.js file for temperature?
I use thies on:

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

})(input)

//Badezimmer

(function(i) { var re = new RegExp('SENSORID[\\s\\S]*?Temperatur[\\s\\S]*?<h4>([0-9]+.[0-9]+) C'); var out = i.match(re)[1]; return parseFloat(out.replace(',', '.')); })(input)

Thanks,
after input tp replace ‘,’ by ‘.’ ist works exact!.:grinning:

you`re welcome!
Can you help me for the Windrichtung? they will give the name out, e.g. Norden, Ostnordost,…
regards

sorry, no. I didn’t have an mobile alerts with wind direction.