Water level river Waal

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Water level river Waal

Post by Jan Jansen »

The various water levels in the Netherlands can be viewed on the basis of this link (https://waterinfo.rws.nl/#!/kaart/waterhoog/). Is it possible to display the water level of the Nijmegen haven measuring point in Domoticz?

Thanks in advance!
Jan
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Water level river Waal

Post by FireWizard »

Hello @Jan Jansen,

Good afternoon Jan,
Is it possible to display the water level of the Nijmegen haven measuring point in Domoticz?
Yes, that is possible.

If you inspect the map, displayed at: https://waterinfo.rws.nl/#!/kaart/waterhoogte/ and click on the desired measuring point, you will move on to the details. As an example we will use the measuring point "Nijmegen haven". (click on it and go to More details)
By default you will get all data from 2 days back to 2 days ahead. You can change that to 6 hours back to 3 hours ahead. Also 2 other time windows are possible, but not interesting for now.

If you use the following URL: https://waterinfo.rws.nl/api/chart?mapT ... alues=-6,3,
you will get a JSON response with the required data for that location.

Keep in mind that the time is noted in UTC (Zulu time zone) and that the data is updated every 10 minutes.

You have used Node Red before and if you insert that URL in a http request node, you will get the following:

Screenshot_waterstanden.png
Screenshot_waterstanden.png (58.62 KiB) Viewed 2388 times

The last data measured is always in the last object of the array. Currently, as you can see, the water height is 961 cm, measured at 16:00 h CET.
After that array you will get the predictions.

If you need some support in pushing it to a Domoticz virtual sensor, let me know.

Best regards
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Water level river Waal

Post by waaren »

FireWizard wrote: Sunday 31 January 2021 16:42 If you use the following URL: https://waterinfo.rws.nl/api/chart?mapT ... alues=-6,3,
you will get a JSON response with the required data for that location.
For some reason I only get an XML result when I use this URL in chrome.
Spoiler: show

Code: Select all

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Chart xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/RWS.WaterInfo.API.Models.Details">
<ExtremesY>
<Max>996.0</Max>
<Min>921.0</Min>
</ExtremesY>
<Limits>
<LimitJSON>
<Color>#8B572A</Color>
<From i:nil="true"/>
<IsNormal>false</IsNormal>
<Label>Laagwater (< 535cm)</Label>
<LocationCode i:nil="true"/>
<Period i:nil="true"/>
<QuantityCode i:nil="true"/>
<SoftColor>#F5F1F0</SoftColor>
<To>535</To>
</LimitJSON>
<LimitJSON>
<Color>#39870C</Color>
<From>535</From>
<IsNormal>true</IsNormal>
<Label>Normaal (> 535cm)</Label>
<LocationCode i:nil="true"/>
<Period i:nil="true"/>
<QuantityCode i:nil="true"/>
<SoftColor>#F2F7EE</SoftColor>
<To>965</To>
</LimitJSON>
<LimitJSON>
<Color>#CDDC39</Color>
<From>965</From>
<IsNormal>false</IsNormal>
<Label>Licht verhoogd (>965cm)</Label>
<LocationCode i:nil="true"/>
<Period i:nil="true"/>
<QuantityCode i:nil="true"/>
<SoftColor>#F7F8EE</SoftColor>
<To>1055</To>
</LimitJSON>
<LimitJSON>
<Color>#FFB612</Color>
<From>1055</From>
<IsNormal>false</IsNormal>
<Label>Verhoogde waterstand (> 1055cm)</Label>
<LocationCode i:nil="true"/>
<Period i:nil="true"/>
<QuantityCode i:nil="true"/>
<SoftColor>#FFFAEF</SoftColor>
<To>1220</To>
</LimitJSON>
<LimitJSON>
<Color>#E17000</Color>
<From>1220</From>
<IsNormal>false</IsNormal>
<Label>Hoogwater (> 1220cm)</Label>
<LocationCode i:nil="true"/>
<Period i:nil="true"/>
<QuantityCode i:nil="true"/>
<SoftColor>#FDF5ED</SoftColor>
<To>1340</To>
</LimitJSON>
<LimitJSON>
<Color>#D52B1E</Color>
<From>1340</From>
<IsNormal>false</IsNormal>
<Label>Extreem hoogwater (> 1340cm)</Label>
<LocationCode i:nil="true"/>
<Period i:nil="true"/>
<QuantityCode i:nil="true"/>
<SoftColor>#FDF1F0</SoftColor>
<To i:nil="true"/>
</LimitJSON>
</Limits>
<Series>
<Series>
<Color>#0178ca</Color>
<Data xmlns:d4p1="http://schemas.datacontract.org/2004/07/RWS.WaterInfo.DataAccessLayer.DistributionLayer">
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T10:00:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>941.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T10:10:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>942.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T10:20:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>942.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T10:30:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>943.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T10:40:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>944.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T10:50:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>944.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T11:00:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>944.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T11:10:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>945.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T11:20:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>946.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T11:30:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>947.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T11:40:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>948.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T11:50:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>948.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T12:00:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>950.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T12:10:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>949.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T12:20:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>951.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T12:30:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>951.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T12:40:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>951.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T12:50:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>952.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T13:00:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>953.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T13:10:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>953.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T13:20:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>953.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T13:30:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>955.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T13:40:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>956.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T13:50:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>957.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T14:00:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>957.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T14:10:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>958.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T14:20:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>957.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T14:30:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>958.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T14:40:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>959.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T14:50:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>960.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T15:00:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>961.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T15:10:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>961.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T15:20:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>962.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T15:30:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>963.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
</Data>
<Extremes xmlns:d4p1="http://schemas.datacontract.org/2004/07/RWS.WaterInfo.DataAccessLayer.DistributionLayer" i:nil="true"/>
<IsWindDirection>false</IsWindDirection>
<Mooncycle xmlns:d4p1="http://schemas.datacontract.org/2004/07/RWS.WaterInfo.DataAccessLayer.DistributionLayer" i:nil="true"/>
<Name>Waterhoogte Oppervlaktewater t.o.v. Normaal Amsterdams Peil in cm</Name>
<Unit>cm</Unit>
</Series>
<Series>
<Color>#b90101</Color>
<Data xmlns:d4p1="http://schemas.datacontract.org/2004/07/RWS.WaterInfo.DataAccessLayer.DistributionLayer">
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T14:50:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>961.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T15:00:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>961.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T15:10:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>962.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T15:20:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>963.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T15:30:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>963.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T15:40:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>964.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T15:50:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>965.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T16:00:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>965.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T16:10:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>966.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T16:20:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>966.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T16:30:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>967.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T16:40:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>968.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T16:50:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>968.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T17:00:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>969.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T17:10:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>970.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T17:20:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>970.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T17:30:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>971.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T17:40:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>972.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T17:50:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>972.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T18:00:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>973.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T18:10:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>973.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T18:20:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>974.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T18:30:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>975.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T18:40:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>975.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
<d4p1:Measurement>
<d4p1:_x003C_DateTime_x003E_k__BackingField>2021-01-31T18:50:00Z</d4p1:_x003C_DateTime_x003E_k__BackingField>
<d4p1:_x003C_Sign_x003E_k__BackingField i:nil="true"/>
<d4p1:_x003C_Value_x003E_k__BackingField>976.0</d4p1:_x003C_Value_x003E_k__BackingField>
</d4p1:Measurement>
</Data>
<Extremes xmlns:d4p1="http://schemas.datacontract.org/2004/07/RWS.WaterInfo.DataAccessLayer.DistributionLayer" i:nil="true"/>
<IsWindDirection>false</IsWindDirection>
<Mooncycle xmlns:d4p1="http://schemas.datacontract.org/2004/07/RWS.WaterInfo.DataAccessLayer.DistributionLayer" i:nil="true"/>
<Name>Waterhoogte verwacht Oppervlaktewater t.o.v. Normaal Amsterdams Peil in cm</Name>
<Unit>cm</Unit>
</Series>
</Series>
<T0>2021-01-31T15:30:00Z</T0>
</Chart>
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Water level river Waal

Post by FireWizard »

Hello @waaren

I have to confess, that I have seen that as well, if I use Chrome.
You can normally browse with Chrome to that page, but if you try to inspect that page, you will see an error.
DevTools failed to load SourceMap: Could not load content for https://waterinfo.rws.nl/scripts/ol.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
and also
Error: Unexpected end of JSON input
I found the URL with the Inspector of Firefox. In Firefox it functions. However if I open in Firefox another tab and I copy the URL to that tab I also see XML code. No idea why.
I inserted the URL in the http request node of Node Red and it works fine. See the picture.

I'm sure that there is something in the webpage, but I do not see, what it is.

Regards
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: Water level river Waal

Post by Jan Jansen »

@ FireWizard; @Waaren,

I found some more information:
https://github.com/Rijkswaterstaat/wm-ws-dl
https://github.com/tomkr/waterstanden
http://www.weerstation-nijmegen-lent.nl ... -Rijn-Waal

I can't handle it myself, far beyond my own skills.

Regards,
Jan
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Water level river Waal

Post by waaren »

Jan Jansen wrote: Sunday 31 January 2021 19:30 I can't handle it myself, far beyond my own skills.
It is up to you if you want this to be handled completely internal in domoticz with dzVents or if you prefer nodered.

For dzvents:

The loglines of below dzVents script shows what the link @fireWizard shared does return to domoticz.

To what type of device you would like to see which of below result(s)?

Code: Select all

scriptvar = 'waterpeilNijmegen' 

return 
{
	on = 
	{
		timer = 
		{
			'every 1 minutes' -- just an example to trigger the request
		},
		httpResponses = 
		{
			scriptVar, -- must match with the callback passed to the openURL command
		},
	},
	
	logging =
	{
	       level = domoticz.LOG_DEBUG,
	       marker = 'waterstand',
	},
	
	execute = function(dz, item)

		if item.isTimer or item.isDevice then
			dz.openURL(
	        {
				url = 'https://waterinfo.rws.nl/api/chart?mapType=waterhoogte&locationCode=Nijmegen-haven%28NIJM%29&values=-6,3',
				callback = scriptVar, -- see httpResponses above.
			})
		elseif item.isHTTPResponse and item.ok then
            dz.utils.dumpTable(item.json)
        else
            dz.log(item, domoticz.LOG_DEBUG)
		end
    end
}
Result
Spoiler: show

Code: Select all

2021-01-31 20:02:00.674  Status: dzVents: Info: waterstand: ------ Start internal script: Script #2: HTTPResponse: "trigger"
2021-01-31 20:02:00.677  Status: dzVents: > t0: 2021-01-31T18:40:00Z
2021-01-31 20:02:00.677  Status: dzVents: > limits:
2021-01-31 20:02:00.677  Status: dzVents: >     1:
2021-01-31 20:02:00.677  Status: dzVents: >             color: #8B572A
2021-01-31 20:02:00.677  Status: dzVents: >             isNormal: false
2021-01-31 20:02:00.677  Status: dzVents: >             label: Laagwater (< 535cm)
2021-01-31 20:02:00.677  Status: dzVents: >             softColor: #F5F1F0
2021-01-31 20:02:00.677  Status: dzVents: >             to: 535.0
2021-01-31 20:02:00.677  Status: dzVents: >     2:
2021-01-31 20:02:00.677  Status: dzVents: >             softColor: #F2F7EE
2021-01-31 20:02:00.677  Status: dzVents: >             isNormal: true
2021-01-31 20:02:00.677  Status: dzVents: >             label: Normaal (> 535cm)
2021-01-31 20:02:00.677  Status: dzVents: >             color: #39870C
2021-01-31 20:02:00.677  Status: dzVents: >             from: 535.0
2021-01-31 20:02:00.677  Status: dzVents: >             to: 965.0
2021-01-31 20:02:00.677  Status: dzVents: >     3:
2021-01-31 20:02:00.677  Status: dzVents: >             softColor: #F7F8EE
2021-01-31 20:02:00.677  Status: dzVents: >             isNormal: false
2021-01-31 20:02:00.677  Status: dzVents: >             label: Licht verhoogd (>965cm)
2021-01-31 20:02:00.677  Status: dzVents: >             color: #CDDC39
2021-01-31 20:02:00.677  Status: dzVents: >             from: 965.0
2021-01-31 20:02:00.677  Status: dzVents: >             to: 1055.0
2021-01-31 20:02:00.677  Status: dzVents: >     4:
2021-01-31 20:02:00.677  Status: dzVents: >             softColor: #FFFAEF
2021-01-31 20:02:00.677  Status: dzVents: >             isNormal: false
2021-01-31 20:02:00.677  Status: dzVents: >             label: Verhoogde waterstand (> 1055cm)
2021-01-31 20:02:00.677  Status: dzVents: >             color: #FFB612
2021-01-31 20:02:00.677  Status: dzVents: >             from: 1055.0
2021-01-31 20:02:00.677  Status: dzVents: >             to: 1220.0
2021-01-31 20:02:00.677  Status: dzVents: >     5:
2021-01-31 20:02:00.677  Status: dzVents: >             softColor: #FDF5ED
2021-01-31 20:02:00.677  Status: dzVents: >             isNormal: false
2021-01-31 20:02:00.677  Status: dzVents: >             label: Hoogwater (> 1220cm)
2021-01-31 20:02:00.677  Status: dzVents: >             color: #E17000
2021-01-31 20:02:00.677  Status: dzVents: >             from: 1220.0
2021-01-31 20:02:00.677  Status: dzVents: >             to: 1340.0
2021-01-31 20:02:00.677  Status: dzVents: >     6:
2021-01-31 20:02:00.677  Status: dzVents: >             softColor: #FDF1F0
2021-01-31 20:02:00.677  Status: dzVents: >             isNormal: false
2021-01-31 20:02:00.678  Status: dzVents: >             label: Extreem hoogwater (> 1340cm)
2021-01-31 20:02:00.678  Status: dzVents: >             from: 1340.0
2021-01-31 20:02:00.678  Status: dzVents: >             color: #D52B1E
2021-01-31 20:02:00.678  Status: dzVents: > series:
2021-01-31 20:02:00.678  Status: dzVents: >     1:
2021-01-31 20:02:00.678  Status: dzVents: >             isWindDirection: false
2021-01-31 20:02:00.678  Status: dzVents: >             color: #0178ca
2021-01-31 20:02:00.678  Status: dzVents: >             data:
2021-01-31 20:02:00.678  Status: dzVents: >                     1:
2021-01-31 20:02:00.678  Status: dzVents: >                             value: 953.0
2021-01-31 20:02:00.678  Status: dzVents: >                             dateTime: 2021-01-31T13:10:00Z
2021-01-31 20:02:00.678  Status: dzVents: >                     2:
2021-01-31 20:02:00.678  Status: dzVents: >                             value: 953.0
2021-01-31 20:02:00.678  Status: dzVents: >                             dateTime: 2021-01-31T13:20:00Z
2021-01-31 20:02:00.678  Status: dzVents: >                     3:
2021-01-31 20:02:00.678  Status: dzVents: >                             value: 955.0
2021-01-31 20:02:00.678  Status: dzVents: >                             dateTime: 2021-01-31T13:30:00Z
2021-01-31 20:02:00.678  Status: dzVents: >                     4:
2021-01-31 20:02:00.678  Status: dzVents: >                             value: 956.0
2021-01-31 20:02:00.678  Status: dzVents: >                             dateTime: 2021-01-31T13:40:00Z
2021-01-31 20:02:00.678  Status: dzVents: >                     5:
2021-01-31 20:02:00.678  Status: dzVents: >                             value: 957.0
2021-01-31 20:02:00.678  Status: dzVents: >                             dateTime: 2021-01-31T13:50:00Z
2021-01-31 20:02:00.678  Status: dzVents: >                     6:
2021-01-31 20:02:00.678  Status: dzVents: >                             value: 957.0
2021-01-31 20:02:00.678  Status: dzVents: >                             dateTime: 2021-01-31T14:00:00Z
2021-01-31 20:02:00.678  Status: dzVents: >                     7:
2021-01-31 20:02:00.678  Status: dzVents: >                             value: 958.0
2021-01-31 20:02:00.678  Status: dzVents: >                             dateTime: 2021-01-31T14:10:00Z
2021-01-31 20:02:00.678  Status: dzVents: >                     8:
2021-01-31 20:02:00.678  Status: dzVents: >                             value: 957.0
2021-01-31 20:02:00.678  Status: dzVents: >                             dateTime: 2021-01-31T14:20:00Z
2021-01-31 20:02:00.678  Status: dzVents: >                     9:
2021-01-31 20:02:00.678  Status: dzVents: >                             value: 958.0
2021-01-31 20:02:00.678  Status: dzVents: >                             dateTime: 2021-01-31T14:30:00Z
2021-01-31 20:02:00.678  Status: dzVents: >                     10:
2021-01-31 20:02:00.678  Status: dzVents: >                             value: 959.0
2021-01-31 20:02:00.678  Status: dzVents: >                             dateTime: 2021-01-31T14:40:00Z
2021-01-31 20:02:00.678  Status: dzVents: >                     11:
2021-01-31 20:02:00.678  Status: dzVents: >                             value: 960.0
2021-01-31 20:02:00.678  Status: dzVents: >                             dateTime: 2021-01-31T14:50:00Z
2021-01-31 20:02:00.678  Status: dzVents: >                     12:
2021-01-31 20:02:00.678  Status: dzVents: >                             value: 961.0
2021-01-31 20:02:00.678  Status: dzVents: >                             dateTime: 2021-01-31T15:00:00Z
2021-01-31 20:02:00.678  Status: dzVents: >                     13:
2021-01-31 20:02:00.678  Status: dzVents: >                             value: 961.0
2021-01-31 20:02:00.678  Status: dzVents: >                             dateTime: 2021-01-31T15:10:00Z
2021-01-31 20:02:00.678  Status: dzVents: >                     14:
2021-01-31 20:02:00.678  Status: dzVents: >                             value: 962.0
2021-01-31 20:02:00.679  Status: dzVents: >                             dateTime: 2021-01-31T15:20:00Z
2021-01-31 20:02:00.679  Status: dzVents: >                     15:
2021-01-31 20:02:00.679  Status: dzVents: >                             value: 963.0
2021-01-31 20:02:00.679  Status: dzVents: >                             dateTime: 2021-01-31T15:30:00Z
2021-01-31 20:02:00.679  Status: dzVents: >                     16:
2021-01-31 20:02:00.679  Status: dzVents: >                             value: 964.0
2021-01-31 20:02:00.679  Status: dzVents: >                             dateTime: 2021-01-31T15:40:00Z
2021-01-31 20:02:00.679  Status: dzVents: >                     17:
2021-01-31 20:02:00.679  Status: dzVents: >                             value: 964.0
2021-01-31 20:02:00.679  Status: dzVents: >                             dateTime: 2021-01-31T15:50:00Z
2021-01-31 20:02:00.679  Status: dzVents: >                     18:
2021-01-31 20:02:00.679  Status: dzVents: >                             value: 965.0
2021-01-31 20:02:00.679  Status: dzVents: >                             dateTime: 2021-01-31T16:00:00Z
2021-01-31 20:02:00.679  Status: dzVents: >                     19:
2021-01-31 20:02:00.679  Status: dzVents: >                             value: 966.0
2021-01-31 20:02:00.679  Status: dzVents: >                             dateTime: 2021-01-31T16:10:00Z
2021-01-31 20:02:00.679  Status: dzVents: >                     20:
2021-01-31 20:02:00.679  Status: dzVents: >                             value: 966.0
2021-01-31 20:02:00.679  Status: dzVents: >                             dateTime: 2021-01-31T16:20:00Z
2021-01-31 20:02:00.679  Status: dzVents: >                     21:
2021-01-31 20:02:00.679  Status: dzVents: >                             value: 965.0
2021-01-31 20:02:00.679  Status: dzVents: >                             dateTime: 2021-01-31T16:30:00Z
2021-01-31 20:02:00.679  Status: dzVents: >                     22:
2021-01-31 20:02:00.679  Status: dzVents: >                             value: 966.0
2021-01-31 20:02:00.679  Status: dzVents: >                             dateTime: 2021-01-31T16:40:00Z
2021-01-31 20:02:00.679  Status: dzVents: >                     23:
2021-01-31 20:02:00.679  Status: dzVents: >                             value: 968.0
2021-01-31 20:02:00.679  Status: dzVents: >                             dateTime: 2021-01-31T16:50:00Z
2021-01-31 20:02:00.679  Status: dzVents: >                     24:
2021-01-31 20:02:00.679  Status: dzVents: >                             value: 968.0
2021-01-31 20:02:00.679  Status: dzVents: >                             dateTime: 2021-01-31T17:00:00Z
2021-01-31 20:02:00.679  Status: dzVents: >                     25:
2021-01-31 20:02:00.679  Status: dzVents: >                             value: 969.0
2021-01-31 20:02:00.679  Status: dzVents: >                             dateTime: 2021-01-31T17:10:00Z
2021-01-31 20:02:00.679  Status: dzVents: >                     26:
2021-01-31 20:02:00.679  Status: dzVents: >                             value: 969.0
2021-01-31 20:02:00.679  Status: dzVents: >                             dateTime: 2021-01-31T17:20:00Z
2021-01-31 20:02:00.679  Status: dzVents: >                     27:
2021-01-31 20:02:00.679  Status: dzVents: >                             value: 970.0
2021-01-31 20:02:00.679  Status: dzVents: >                             dateTime: 2021-01-31T17:30:00Z
2021-01-31 20:02:00.679  Status: dzVents: >                     28:
2021-01-31 20:02:00.679  Status: dzVents: >                             value: 970.0
2021-01-31 20:02:00.679  Status: dzVents: >                             dateTime: 2021-01-31T17:40:00Z
2021-01-31 20:02:00.679  Status: dzVents: >                     29:
2021-01-31 20:02:00.679  Status: dzVents: >                             value: 972.0
2021-01-31 20:02:00.679  Status: dzVents: >                             dateTime: 2021-01-31T17:50:00Z
2021-01-31 20:02:00.680  Status: dzVents: >                     30:
2021-01-31 20:02:00.680  Status: dzVents: >                             value: 971.0
2021-01-31 20:02:00.680  Status: dzVents: >                             dateTime: 2021-01-31T18:00:00Z
2021-01-31 20:02:00.680  Status: dzVents: >                     31:
2021-01-31 20:02:00.680  Status: dzVents: >                             value: 973.0
2021-01-31 20:02:00.680  Status: dzVents: >                             dateTime: 2021-01-31T18:10:00Z
2021-01-31 20:02:00.680  Status: dzVents: >                     32:
2021-01-31 20:02:00.680  Status: dzVents: >                             value: 973.0
2021-01-31 20:02:00.680  Status: dzVents: >                             dateTime: 2021-01-31T18:20:00Z
2021-01-31 20:02:00.680  Status: dzVents: >                     33:
2021-01-31 20:02:00.680  Status: dzVents: >                             value: 974.0
2021-01-31 20:02:00.680  Status: dzVents: >                             dateTime: 2021-01-31T18:30:00Z
2021-01-31 20:02:00.680  Status: dzVents: >                     34:
2021-01-31 20:02:00.680  Status: dzVents: >                             value: 974.0
2021-01-31 20:02:00.680  Status: dzVents: >                             dateTime: 2021-01-31T18:40:00Z
2021-01-31 20:02:00.680  Status: dzVents: >             name: Waterhoogte Oppervlaktewater t.o.v. Normaal Amsterdams Peil in cm
2021-01-31 20:02:00.680  Status: dzVents: >             unit: cm
2021-01-31 20:02:00.680  Status: dzVents: >     2:
2021-01-31 20:02:00.680  Status: dzVents: >             isWindDirection: false
2021-01-31 20:02:00.680  Status: dzVents: >             color: #b90101
2021-01-31 20:02:00.680  Status: dzVents: >             data:
2021-01-31 20:02:00.680  Status: dzVents: >                     1:
2021-01-31 20:02:00.680  Status: dzVents: >                             value: 973.0
2021-01-31 20:02:00.680  Status: dzVents: >                             dateTime: 2021-01-31T18:00:00Z
2021-01-31 20:02:00.680  Status: dzVents: >                     2:
2021-01-31 20:02:00.680  Status: dzVents: >                             value: 974.0
2021-01-31 20:02:00.680  Status: dzVents: >                             dateTime: 2021-01-31T18:10:00Z
2021-01-31 20:02:00.680  Status: dzVents: >                     3:
2021-01-31 20:02:00.680  Status: dzVents: >                             value: 974.0
2021-01-31 20:02:00.680  Status: dzVents: >                             dateTime: 2021-01-31T18:20:00Z
2021-01-31 20:02:00.680  Status: dzVents: >                     4:
2021-01-31 20:02:00.680  Status: dzVents: >                             value: 975.0
2021-01-31 20:02:00.680  Status: dzVents: >                             dateTime: 2021-01-31T18:30:00Z
2021-01-31 20:02:00.680  Status: dzVents: >                     5:
2021-01-31 20:02:00.680  Status: dzVents: >                             value: 975.0
2021-01-31 20:02:00.680  Status: dzVents: >                             dateTime: 2021-01-31T18:40:00Z
2021-01-31 20:02:00.680  Status: dzVents: >                     6:
2021-01-31 20:02:00.680  Status: dzVents: >                             value: 976.0
2021-01-31 20:02:00.680  Status: dzVents: >                             dateTime: 2021-01-31T18:50:00Z
2021-01-31 20:02:00.680  Status: dzVents: >                     7:
2021-01-31 20:02:00.680  Status: dzVents: >                             value: 977.0
2021-01-31 20:02:00.680  Status: dzVents: >                             dateTime: 2021-01-31T19:00:00Z
2021-01-31 20:02:00.680  Status: dzVents: >                     8:
2021-01-31 20:02:00.680  Status: dzVents: >                             value: 977.0
2021-01-31 20:02:00.680  Status: dzVents: >                             dateTime: 2021-01-31T19:10:00Z
2021-01-31 20:02:00.680  Status: dzVents: >                     9:
2021-01-31 20:02:00.680  Status: dzVents: >                             value: 978.0
2021-01-31 20:02:00.680  Status: dzVents: >                             dateTime: 2021-01-31T19:20:00Z
2021-01-31 20:02:00.680  Status: dzVents: >                     10:
2021-01-31 20:02:00.680  Status: dzVents: >                             value: 979.0
2021-01-31 20:02:00.680  Status: dzVents: >                             dateTime: 2021-01-31T19:30:00Z
2021-01-31 20:02:00.680  Status: dzVents: >                     11:
2021-01-31 20:02:00.681  Status: dzVents: >                             value: 979.0
2021-01-31 20:02:00.681  Status: dzVents: >                             dateTime: 2021-01-31T19:40:00Z
2021-01-31 20:02:00.681  Status: dzVents: >                     12:
2021-01-31 20:02:00.681  Status: dzVents: >                             value: 980.0
2021-01-31 20:02:00.681  Status: dzVents: >                             dateTime: 2021-01-31T19:50:00Z
2021-01-31 20:02:00.681  Status: dzVents: >                     13:
2021-01-31 20:02:00.681  Status: dzVents: >                             value: 980.0
2021-01-31 20:02:00.681  Status: dzVents: >                             dateTime: 2021-01-31T20:00:00Z
2021-01-31 20:02:00.681  Status: dzVents: >                     14:
2021-01-31 20:02:00.681  Status: dzVents: >                             value: 981.0
2021-01-31 20:02:00.681  Status: dzVents: >                             dateTime: 2021-01-31T20:10:00Z
2021-01-31 20:02:00.681  Status: dzVents: >                     15:
2021-01-31 20:02:00.681  Status: dzVents: >                             value: 982.0
2021-01-31 20:02:00.681  Status: dzVents: >                             dateTime: 2021-01-31T20:20:00Z
2021-01-31 20:02:00.681  Status: dzVents: >                     16:
2021-01-31 20:02:00.681  Status: dzVents: >                             value: 982.0
2021-01-31 20:02:00.681  Status: dzVents: >                             dateTime: 2021-01-31T20:30:00Z
2021-01-31 20:02:00.681  Status: dzVents: >                     17:
2021-01-31 20:02:00.681  Status: dzVents: >                             value: 983.0
2021-01-31 20:02:00.681  Status: dzVents: >                             dateTime: 2021-01-31T20:40:00Z
2021-01-31 20:02:00.681  Status: dzVents: >                     18:
2021-01-31 20:02:00.681  Status: dzVents: >                             value: 984.0
2021-01-31 20:02:00.681  Status: dzVents: >                             dateTime: 2021-01-31T20:50:00Z
2021-01-31 20:02:00.681  Status: dzVents: >                     19:
2021-01-31 20:02:00.681  Status: dzVents: >                             value: 984.0
2021-01-31 20:02:00.681  Status: dzVents: >                             dateTime: 2021-01-31T21:00:00Z
2021-01-31 20:02:00.681  Status: dzVents: >                     20:
2021-01-31 20:02:00.681  Status: dzVents: >                             value: 985.0
2021-01-31 20:02:00.681  Status: dzVents: >                             dateTime: 2021-01-31T21:10:00Z
2021-01-31 20:02:00.681  Status: dzVents: >                     21:
2021-01-31 20:02:00.681  Status: dzVents: >                             value: 986.0
2021-01-31 20:02:00.681  Status: dzVents: >                             dateTime: 2021-01-31T21:20:00Z
2021-01-31 20:02:00.681  Status: dzVents: >                     22:
2021-01-31 20:02:00.681  Status: dzVents: >                             value: 986.0
2021-01-31 20:02:00.681  Status: dzVents: >                             dateTime: 2021-01-31T21:30:00Z
2021-01-31 20:02:00.681  Status: dzVents: >                     23:
2021-01-31 20:02:00.681  Status: dzVents: >                             value: 987.0
2021-01-31 20:02:00.681  Status: dzVents: >                             dateTime: 2021-01-31T21:40:00Z
2021-01-31 20:02:00.681  Status: dzVents: >                     24:
2021-01-31 20:02:00.681  Status: dzVents: >                             value: 988.0
2021-01-31 20:02:00.681  Status: dzVents: >                             dateTime: 2021-01-31T21:50:00Z
2021-01-31 20:02:00.681  Status: dzVents: >                     25:
2021-01-31 20:02:00.681  Status: dzVents: >                             value: 988.0
2021-01-31 20:02:00.681  Status: dzVents: >                             dateTime: 2021-01-31T22:00:00Z
2021-01-31 20:02:00.681  Status: dzVents: >             name: Waterhoogte verwacht Oppervlaktewater t.o.v. Normaal Amsterdams Peil in cm
2021-01-31 20:02:00.681  Status: dzVents: >             unit: cm
2021-01-31 20:02:00.681  Status: dzVents: > extremesY:
2021-01-31 20:02:00.681  Status: dzVents: >     max: 1008.0
2021-01-31 20:02:00.681  Status: dzVents: >     min: 933.0
2021-01-31 20:02:00.682  Status: dzVents: Info: waterstand: ------ Finished Script #2
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Water level river Waal

Post by FireWizard »

Hello @Jan Jansen,

As @waaren already said, it is up to you whether you choose the solution with dzVents, which is quite compact, or if you choose to implement the solution with Node Red.

As @waaren already presented his solution, I cannot stay behind.

Please find below the Node Red solution.

Screenshot_Waterstand Nijmegen_haven.png
Screenshot_Waterstand Nijmegen_haven.png (20.83 KiB) Viewed 2334 times

Flow:

Code: Select all

[{"id":"f1324d44.f6688","type":"tab","label":"Waterstanden","disabled":false,"info":""},{"id":"c0e85807.57038","type":"http request","z":"f1324d44.f6688","name":"Waterstand Nijmegen haven","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://waterinfo.rws.nl/api/chart?mapType=waterhoogte&locationCode=Nijmegen-haven(NIJM)&values=-6,3","tls":"","persist":false,"proxy":"","authType":"","x":460,"y":140,"wires":[["85ee7f6b.fcb8e"]]},{"id":"bb820068.b3cc58","type":"inject","z":"f1324d44.f6688","name":"10 Minute Inject","props":[{"p":"payload"}],"repeat":"600","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":140,"wires":[["c0e85807.57038"]]},{"id":"a54daffb.02255","type":"function","z":"f1324d44.f6688","name":"","func":"var time = msg.payload.t0;\nvar height = msg.payload.series[0].data[msg.payload.series[0].data.length - 1].value;\nmsg.payload = {\"command\":\"udevice\", \"idx\":11, \"svalue\":\"Meettijdstip: \" + time +\"\\n\" + \"Waterstand: \" + height + \" cm\"};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":960,"y":140,"wires":[["995c142.98c27e8","90315b4d.41f05"]]},{"id":"995c142.98c27e8","type":"debug","z":"f1324d44.f6688","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1150,"y":200,"wires":[]},{"id":"85ee7f6b.fcb8e","type":"moment","z":"f1324d44.f6688","name":"","topic":"","input":"payload.t0","inputType":"msg","inTz":"ETC/UTC","adjAmount":0,"adjType":"days","adjDir":"add","format":"DD-MM-YYYY/HH:mm:ss","locale":"nl-NL","output":"payload.t0","outputType":"msg","outTz":"Europe/Amsterdam","x":740,"y":140,"wires":[["a54daffb.02255"]]},{"id":"90315b4d.41f05","type":"mqtt out","z":"f1324d44.f6688","name":"To Domoticz","topic":"domoticz/in","qos":"","retain":"","broker":"f9f13036.e28b58","x":1150,"y":140,"wires":[]},{"id":"f9f13036.e28b58","type":"mqtt-broker","name":"localhost","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

As I have chosen to put the data in a "Text" sensor, you will see the following result:

Screenshot_Waterstand_Nijmegen_Domoticz.png
Screenshot_Waterstand_Nijmegen_Domoticz.png (43.87 KiB) Viewed 2334 times

If you want another sensor, I can adapt the flow, quite easily.
Do not forget to change the IDX number (currently 11).

Best regards
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: Water level river Waal

Post by Jan Jansen »

@Waaren and @FireWizard,

First of all, thank you both for your time and attention!
waaren wrote: Sunday 31 January 2021 20:11 It is up to you if you want this to be handled completely internal in domoticz / dzVents or if you prefer nodered.

To what type of device you would like to see which of below result(s)?
I use NodeRed and DZVents interchangeably so I don't really have a preference. My choice is determined by the available or provided examples. I can't judge which of the 2 takes the most system load. The NodeRed flow is ready and working. The content of the text sensor used meets my wishes.

@Waaren,
Hopefully you will find some time to show me how to fill the text sensor from DZVents.

Regards,
Jan
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Water level river Waal

Post by waaren »

Jan Jansen wrote: Monday 01 February 2021 14:23 Hopefully you will find some time to show me how to fill the text sensor from DZVents.
the method is updateText
Some extra functions are included to extract latest available value and to convert utc to local time.


See below:

Code: Select all

scriptVar = 'waterpeilNijmegen'

return
{
    on =
    {
        timer =
        {
            'every 10 minutes',
        },

        httpResponses =
        {
            scriptVar,
        },
    },

    logging =
    {
           level = domoticz.LOG_DEBUG,
           marker = 'waterstand',
    },

    execute = function(dz, item)

        local waterpeil = dz.devices('Waterpeil Nijmegen haven')

        local function utcToLocal( tStr )
            local utcDelta = os.difftime(os.time(), os.time(os.date("!*t" )) )
            return (dz.time.makeTime(tStr:gsub('T',' ')).addSeconds(utcDelta)).raw
        end

        local function makeText(t)
            for _, st in ipairs(t) do
                if st.name == 'Waterhoogte Oppervlaktewater t.o.v. Normaal Amsterdams Peil in cm' then
                    local text = 'Meettijdstip: ' .. utcToLocal(st.data[#st.data].dateTime) .. '\n'
                    text = text .. 'Waterstand: ' .. dz.utils.round(st.data[#st.data].value) .. ' cm'
                    return text
                end
            end
        end

        if item.isTimer or item.isDevice then
            dz.openURL(
            {
                url = 'https://waterinfo.rws.nl/api/chart?mapType=waterhoogte&locationCode=Nijmegen-haven%28NIJM%29&values=-6,3',
                callback = scriptVar, -- see httpResponses above.
            })
        elseif item.isHTTPResponse and item.ok then
            waterpeil.updateText(makeText( item.json.series ))
        else
            dz.log('Problem with httpResponse status: ' .. item.statusCode, domoticz.LOG_ERROR)
            dz.log(item, domoticz.LOG_DEBUG)
        end
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Water level river Waal

Post by FireWizard »

Hi all,

I published (a part of) the available data to a "Text" sensor. As users may want to see a little bit more, I extended the flow with some extra (dynamic) information, which is published to an "Alert" sensor.

See the example below and compared with the previous sensor:

Screenshot_Waterstand_Lobith_Domoticz.png
Screenshot_Waterstand_Lobith_Domoticz.png (95 KiB) Viewed 2282 times
The limits (in this example for "Verhoogd" (1300 -1500)) depends on the measuring location.

The modified "Function" node looks as follow:

Code: Select all

var label = {};
var level;

var time = msg.payload.t0;
var height = msg.payload.series[0].data[msg.payload.series[0].data.length - 1].value;

if (height > msg.payload.limits[5].from) {
  level = 4;
  label = msg.payload.limits[5].label
} else if (height > msg.payload.limits[4].from) {
  level = 3;
  label = msg.payload.limits[4].label
} else if (height > msg.payload.limits[3].from) {
  level = 2;
  label = msg.payload.limits[3].label
} else if (height > msg.payload.limits[1].from) {
  level = 1;
  label = msg.payload.limits[1].label
} else {
  level = 0;
  label = msg.payload.limits[0].label
}

msg.payload = {"command":"udevice", "idx":17, "nvalue":level, "svalue":"Meettijdstip: " + time + "\n" + "Waterstand: " + height + " cm" + "\n" + label};
return msg;
What ever you may prefer, a "Text" sensor or an "Alert" sensor, that goes from "Low water" (grey) to "Extreme high water" (red).

Best regards
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Water level river Waal

Post by EddyG »

Nice scripts. :D Maybe an idea to use a device as distance just to get the water height and have a history.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Water level river Waal

Post by waaren »

EddyG wrote: Tuesday 02 February 2021 9:42 Nice scripts. :D Maybe an idea to use a device as distance just to get the water height and have a history.
My choice would be a custom sensor and use the internal domoticz notification system in the device notification tab to receive notifications at the various levels.

Code: Select all

scriptVar = 'waterpeilNijmegen'

return
{
    on =
    {
        timer =
        {
            'every 10 minutes',
        },

        httpResponses =
        {
            scriptVar,
        },
    },

    logging =
    {
           level = domoticz.LOG_DEBUG,
           marker = 'waterstand',
    },

    execute = function(dz, item)

        local waterpeilText = dz.devices(834) -- change to ID or 'name' of your text device
        local waterpeilCustom = dz.devices(835) -- change to ID or 'name' of your custom sensor
        
        local function utcToLocal( tStr )
            local utcDelta = os.difftime(os.time(), os.time(os.date("!*t" )) )
            return (dz.time.makeTime(tStr:gsub('T',' ')).addSeconds(utcDelta)).raw
        end

        local function makeValues(t)
            for _, st in ipairs(t) do
                if st.name == 'Waterhoogte verwacht Oppervlaktewater t.o.v. Normaal Amsterdams Peil in cm' then
                    local dateString = utcToLocal(st.data[#st.data].dateTime)
                    local height = dz.utils.round(st.data[#st.data].value)
                    local text = 'Verwacht om: ' .. dateString .. '\n' .. 'Waterstand: ' .. height .. ' cm'
                    -- dz.utils.dumpTable(st.data) -- When debugging
                    return text, height
                end
            end
        end

        if item.isTimer or item.isDevice then
            dz.openURL(
            {
                url = 'https://waterinfo.rws.nl/api/chart?mapType=waterhoogte&locationCode=Nijmegen-haven%28NIJM%29&values=-6,3',
                callback = scriptVar, 
            })
        elseif item.isHTTPResponse and item.ok then
            local text, level = makeValues( item.json.series )
            waterpeilText.updateText(text)
            waterpeilCustom.updateCustomSensor(level)
        else
            dz.log('Problem with httpResponse status: ' .. item.statusCode, dz.LOG_ERROR)
            dz.log(item, dz.LOG_DEBUG)
        end
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
EddyG
Posts: 1042
Joined: Monday 02 November 2015 5:54
Target OS: -
Domoticz version:

Re: Water level river Waal

Post by EddyG »

Why do you prefer the Custom sensor?
B.t.w. small typo in the script. You mix "domoticz" and "dz" ;)
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Water level river Waal

Post by FireWizard »

Hi all,

I started this small project, because of the question from Jan Jansen.

Although the scripts are functioning quite right, I noticed some inaccuracy of the data provided by Rijkswaterstaat.
For example the water height at Lobith went even negative and dropped from over 13 m to approx 1.5 m. I'm sure that this was not correct.

See the graph below.

Screenshot_Lobith.png
Screenshot_Lobith.png (26.98 KiB) Viewed 2224 times

I do not notice that in the graph of 2 days back and 2 days forward.
To check, I have updated my URL from -6,3 to -48,48 at the end. (I will report back)

Another discussion is of course, what type of sensor to choose.

1. I started with a "Text" sensor. Beside the actual water height, you can also insert the time of measurement. Mostly you will see the value that is approx. 20-30 minutes behind the time of the sensor. And you can change the icon.

2. I used also an "Alert"sensor. Advantage is that I can play with some levels and colors, although the scale of Rijkswaterstaat is different from the Alert level scale (6 colors compared to 5). So I merged the dark green with the light green ("Normaal (720 - 1200cm)" and "Licht verhoogd (>1200cm)").

In today's modification the text has been corrected and is now also indicating "Licht verhoogd (>1200cm)".

3. "Distance" sensor has the advantage that you can log the historical values. The disadvantage is that you can not change the x-axis, with is always cm.
In this case it is not a problem as Rijkswaterstaat provides the data in cm. Strange is, however that I see sensors who indicate km (visibility).

4. "Custom" sensor is more flexible and you can insert your own x-axis and also the custom icon.

The good thing is that every user can select the solution he likes most and can even combine multiple sensors.

As said I modified (again) the "Function" node, to correct the additional text. See below.

Code: Select all

var label = {};
var level;

var time = msg.payload.t0;
var height = msg.payload.series[0].data[msg.payload.series[0].data.length - 1].value;

switch (true) {

    case (height >= msg.payload.limits[5].from):
    level = 4;
    label = msg.payload.limits[5].label
    break;

    case (height >= msg.payload.limits[4].from):
    level = 3;
    label = msg.payload.limits[4].label
    break;

    case (height >= msg.payload.limits[3].from):
    level = 2;
    label = msg.payload.limits[3].label
    break;

    case (height >= msg.payload.limits[2].from):
    level = 1;
    label = msg.payload.limits[2].label
    break;

    case (height >= msg.payload.limits[1].from):
    level = 1;
    label = msg.payload.limits[1].label
    break;

    case (height < msg.payload.limits[0].to):
    level = 0;
    label = msg.payload.limits[0].label
    break;
}


msg.payload = {"command":"udevice", "idx":17, "nvalue":level, "svalue":"Meettijdstip: " + time + "\n" + "Waterstand: " + height + " cm" + "\n" + label};
return msg;
Best regards
Last edited by FireWizard on Tuesday 02 February 2021 18:35, edited 1 time in total.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Water level river Waal

Post by waaren »

EddyG wrote: Tuesday 02 February 2021 14:06 Why do you prefer the Custom sensor?
No functional reason. It's not distance but level.
btw. found a small issue with the distance sensor. The edit window does not come up when clicking the edit button on the device in the utility tab.
Fixed in next build (12902) but also need to clear browser cache.
B.t.w. small typo in the script. You mix "domoticz" and "dz" ;)
Thx. I updated the post.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Water level river Waal

Post by waaren »

FireWizard wrote: Tuesday 02 February 2021 15:10 3. "Distance" sensor has the advantage that you can log the historical values. The disadvantage is that you can not change the x-axis, with is always cm.
Distance sensor can be changed to display the value in inches but because of a bug preventing to access the edit window you need build >= 12902 to edit the device from the GUI
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Water level river Waal

Post by FireWizard »

Thanks @waaren for fixing this. I saw in the Wiki, that it should be possible, but I was not interested in having that option, and I think, except the UK, that not many people will use inches. I never used that type of sensor, as it is limited to cm (and inches).

I saw with a visibility sensor (Darksky) that km is used. This was possible to change to miles.

I think for the continent more units, like mm, m, km would be nice, for the UK we can use inches, feet, yards, miles.

Your thoughts?

Regards
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Water level river Waal

Post by waaren »

FireWizard wrote: Tuesday 02 February 2021 18:03 I think for the continent more units, like mm, m, km would be nice, for the UK we can use inches, feet, yards, miles.
Your thoughts?
Indeed would be nice but it has to be implemented in many different places in the code. I see these quantities and units in various xml, cpp, js, html and header files.

So quite a ambitious project to tackle.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Water level river Waal

Post by FireWizard »

The URL has been changed since January 2023.

With thanks to @Jan Jansen a new URL has been provided.

Change the URL to: https://waterinfo.rws.nl/api/chart/Get? ... alues=-6,3

Regards
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: Water level river Waal

Post by Jan Jansen »

Things have changed again. The response is now in csv format instead of the previous JSON format. After some experimentation, I think I can get useful values with the following flow. However, I am unable to get the last measured value with corresponding time in Domoticz.

Code: Select all

[
    {
        "id": "f1324d44.f6688",
        "type": "tab",
        "label": "Waterstand Nijmegen haven",
        "disabled": false,
        "info": ""
    },
    {
        "id": "c0e85807.57038",
        "type": "http request",
        "z": "f1324d44.f6688",
        "name": "Waterstand Nijmegen haven",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "body",
        "url": "https://waterinfo.rws.nl/api/chart/Get?mapType=waterhoogte&locationCode=Nijmegen-haven(NIJM)&values=-6,3",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 260,
        "y": 140,
        "wires": [
            [
                "8559f35430d62e66"
            ]
        ]
    },
    {
        "id": "bb820068.b3cc58",
        "type": "inject",
        "z": "f1324d44.f6688",
        "name": "1 hour inject",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "3600",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 140,
        "y": 240,
        "wires": [
            [
                "c0e85807.57038"
            ]
        ]
    },
    {
        "id": "90315b4d.41f05",
        "type": "mqtt out",
        "z": "f1324d44.f6688",
        "name": "To Domoticz",
        "topic": "domoticz/in",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "fbb02111.25ba88",
        "x": 930,
        "y": 140,
        "wires": []
    },
    {
        "id": "20627e81d052eb33",
        "type": "debug",
        "z": "f1324d44.f6688",
        "name": "debug 3",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 760,
        "y": 240,
        "wires": []
    },
    
    {
        "id": "8559f35430d62e66",
        "type": "csv",
        "z": "f1324d44.f6688",
        "name": "",
        "sep": ",",
        "hdrin": "",
        "hdrout": "all",
        "multi": "one",
        "ret": "\\n",
        "temp": "",
        "skip": "0",
        "strings": true,
        "include_empty_strings": "",
        "include_null_values": "",
        "x": 510,
        "y": 160,
        "wires": [
            [
                "20627e81d052eb33"
            ]
        ]
    },
    {
        "id": "fbb02111.25ba88",
        "type": "mqtt-broker",
        "name": "MQTT",
        "broker": "127.0.0.1",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": 4,
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "willTopic": "",
        "willQos": "0",
        "willPayload": ""
    }
]
Thanks in advance for any help
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests