bluerai / ioBroker.mobile-alerts

Mobile Alerts for ioBroker - an adapter to download data from the Mobile Alerts server
MIT License
7 stars 5 forks source link

Rain measurement #20

Closed grex1975 closed 11 months ago

grex1975 commented 2 years ago

Hello thanks for this adapter, I use it for several sensors of technoline. I just have a problem with the rain sensor. On the overview page, where this adapter grabs the values from, an average of the last hours (I think 12 hours) is displayed, and not the current total. This value is useless since I want to store it with "history" and do calculation with "statistics". Is it possible that you get the total from the sensor specific page? BR, Gregor

bluerai commented 2 years ago

Hi Gregor! I'm pleased that you found this adapter useful! Sorry, the adapter is currently for grabbing data from the overview page but not from other pages. Maybe later ... Maybe I will use the Mobile Alerts REST API which is available now. Best regards Rai

grex1975 commented 2 years ago

Hello Rai, REST API sounds good, and it works: curl -d deviceids=xxx,yyy https://www.data199.com/api/pv1/device/lastmeasurement { "devices": [ { "deviceid": "xxx", "lastseen": 1649327170, "lowbattery": false, "measurement": { "idx": 2886829, "ts": 1649327164, "c": 1649327170, "lb": false, "t1": 23.3, "t2": 23.5, "h": 41.0 } }, { "deviceid": "yyy", "lastseen": 1649323977, "lowbattery": false } ], "success": true }

the first one shows temp, temp on cable sensor and humidity. the second is a rain sensor - it seems to show no value when it is not raining. will poor in some water and check again in the evening ;-)

br, Gregor

grex1975 commented 2 years ago

After pooring in some water I got a measurement result:

curl -d deviceids=xxx https://www.data199.com/api/pv1/device/lastmeasurement { "devices": [ { "deviceid": "xxx", "lastseen": 1649343593, "lowbattery": false, "measurement": { "idx": 202, "ts": 1649343587, "c": 1649343593, "lb": false, "sc": true, "t1": 24.9, "r": 33.54, "rf": 130, "rr": 0.258 } } ], "success": true }

t1: temperature in celsius. That's interesting, because the temperature is not shown on my mobile phone and not on the web page of mobile-alerts.eu, so I didn't even know that the rains sensor is capable of measuring temperature... r: the total sum of rain in mm. That's the value I need. From this I can calculate differences and per day values using the statistics adapter.

grex1975 commented 2 years ago

Using the REST API it's so simple that I've done it with a blockly script :-)

NoPlayBack commented 1 year ago

Any plans to get the rain adapter running so that it shows values which could be used to display a weather-dashboard? Have reviewed the data i have collected so far in the last days, but they do not make sense, and so i found this thread here. Would be great to have the rain-data as well.

bluerai commented 1 year ago

@NoPlayBack: This adapter is grabbing the data from the overview page. Is there data on your overview page which is not passed to the ioBroker? In this case I hope I can help you. Please tell me what is exactly missing (and don't forget the units).

NoPlayBack commented 1 year ago

Not sure, will review behaviour of the data while it is raining, which should be today ;-). Have never checked what it looks like on that page. One level deeper in the detail page of that sensor, where you can download the csv-data, there is always one line, means one dataset, which shows timestamp and accumulated rain-volume. The difference is always 0,258. Means that always, every time the seesaw in the sensor tilts, the sensor sends data. I will check behaviour of the data on the overview page once it starts raining ...

NoPlayBack commented 1 year ago

ok, now i know what data is visible on the overview page. The detail page shows each message from the rain sensor, and each message means that there was a toggle of the seesaw which means 0,258 mm. The value is accumulated over time, means in the meantime i see the last value is 1935,3 mm since this sensor is running already since several months. The overview page simply shows the accumulated rain from the last 24 hours. So the value is updated each time a toggle appears.... and if it stops raining, then, after 24 hours, the value is shrinking down to 0 when the measurables start to phase out of the 24 hour window. So no way to get data from that page except exactly that one value: Rain-Volume in mm within the last 24 hours.

bluerai commented 1 year ago

Look at the comments of grex1975 in this thread. He fetches rain data via mobile alerts' REST API. Maybe this is what you want.

NoPlayBack commented 1 year ago

Hi bluerai, did try but my level of knowledge is not sufficient to get that up and running. Meanwhile i have found your "ioBroker.mobile-alerts2"... is that up and running already? Is it worth to take a look? Another question from my side.... what is the function of the tick-box "Counter" in the settings for an object?

grex1975 commented 1 year ago

Hi NoPlayBack, here are some further hints how to use Blockly and the mobile-alerts API to get the last value periodically.

Description of the API: https://mobile-alerts.eu/info/public_server_api_documentation.pdf Page 2 shows an example to get the last measurement.

The following image is a screenshot of my Blockly script. There's a lot of debug output in it which may be removed. grafik The script is executed every 5 minutes, gets the json result for a device id using curl, uses "JSON to object" to read the parameter "r", and stores it in a variable.

the url for the curl command is https://www.data199.com/api/pv1/device/lastmeasurement "RainTotal" is a temporary variable defined in blockly. "RainSum" is a user-defined variable in iobroker/objects/0_userdata on "RainSum" I activated the "history" function of iobroker.

If you want help, feel free to ask.

Br, Grex