Get weather data from LAN based ObserverIP PWS  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

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

Re: Get weather data from LAN based ObserverIP PWS

Post by waaren »

Doudy wrote: Thursday 17 October 2019 16:48 It's going slowly. I have modified the rain devices at custom sensors
Found a typo in the key-names of the table. Fixed it and updated script in my post of Friday 06 September 2019 15:40 in this topic.
Hope it will solve your problem.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Doudy
Posts: 246
Joined: Tuesday 09 August 2016 9:09
Target OS: -
Domoticz version:
Contact:

Re: Get weather data from LAN based ObserverIP PWS

Post by Doudy »

For the rain it works.
Thank you. ;)
But I have not yet understood the philosophy of the different variables :
E.g. local wind = dz.devices('AWindDir') and windir='windDirection'

I still have a problem with:

Image

Log file :

Code: Select all

2019-10-18 08:27:01.038 Status: dzVents: Debug: ObserverIP_4-0.201910171900: Processing device-adapter for AWindDir: Wind device adapter
2019-10-18 08:27:01.040 Status: dzVents: Debug: ObserverIP_4-0.201910171900: Processing device-adapter for AvgWind: Wind device adapter
2019-10-18 08:27:01.041 Status: dzVents: Debug: ObserverIP_4-0.201910171900: Processing device-adapter for AGustSpeed: Wind device adapter
2019-10-18 08:27:01.045 Status: dzVents: Debug: ObserverIP_4-0.201910171900: Processing device-adapter for AinTemp: Temperature device adapter
2019-10-18 08:27:01.048 Status: dzVents: Debug: ObserverIP_4-0.201910171900: Processing device-adapter for AinTempHum: Temperature+humidity device adapter
2019-10-18 08:27:01.051 Status: dzVents: Debug: ObserverIP_4-0.201910171900: Processing device-adapter for AoutTemp: Temperature device adapter
2019-10-18 08:27:01.053 Status: dzVents: Debug: ObserverIP_4-0.201910171900: Processing device-adapter for AoutTempHum: Temperature+humidity device adapter
2019-10-18 08:27:01.055 Status: dzVents: Debug: ObserverIP_4-0.201910171900: Processing device-adapter for ASolarRad: Solar radiation device adapter
2019-10-18 08:27:01.057 Status: dzVents: Debug: ObserverIP_4-0.201910171900: Processing device-adapter for AUvi: UV device adapter
2019-10-18 08:27:01.058 Status: dzVents: Debug: ObserverIP_4-0.201910171900: Processing device-adapter for ARain: Rain device
2019-10-18 08:27:01.060 Status: dzVents: Debug: ObserverIP_4-0.201910171900: Processing device-adapter for ARelPress: Barometer device adapter
2019-10-18 08:27:01.062 Status: dzVents: Debug: ObserverIP_4-0.201910171900: Processing device-adapter for ARainDaily: Custom sensor device adapter
2019-10-18 08:27:01.063 Status: dzVents: Debug: ObserverIP_4-0.201910171900: Processing device-adapter for ARainWeekly: Custom sensor device adapter
2019-10-18 08:27:01.065 Status: dzVents: Debug: ObserverIP_4-0.201910171900: Processing device-adapter for ARainMonthly: Custom sensor device adapter
2019-10-18 08:27:01.066 Status: dzVents: Debug: ObserverIP_4-0.201910171900: Processing device-adapter for ARainYearly: Custom sensor device adapter
2019-10-18 08:27:01.088 Status: dzVents: > weeklyRain: 18.00
2019-10-18 08:27:01.088 Status: dzVents: > UV: 40
2019-10-18 08:27:01.088 Status: dzVents: > outdoorTemperature: 13.5
2019-10-18 08:27:01.088 Status: dzVents: > solarRadiation: 0.00
2019-10-18 08:27:01.088 Status: dzVents: > windSpeed: 15.1
2019-10-18 08:27:01.088 Status: dzVents: > indoorHumidity: 63
2019-10-18 08:27:01.088 Status: dzVents: > UVI: 0
2019-10-18 08:27:01.088 Status: dzVents: > indoorTemperature: 22.8
2019-10-18 08:27:01.089 Status: dzVents: > yearlyRain: 604.80
2019-10-18 08:27:01.089 Status: dzVents: > windDirection: 244
2019-10-18 08:27:01.089 Status: dzVents: > monthlyRain: 98.70
2019-10-18 08:27:01.089 Status: dzVents: > dailyRain: 0.30
2019-10-18 08:27:01.089 Status: dzVents: > hourlyRainRate: 1.80
2019-10-18 08:27:01.089 Status: dzVents: > outdoorHumidity: 94
2019-10-18 08:27:01.089 Status: dzVents: > relativePressure: 999.80
2019-10-18 08:27:01.089 Status: dzVents: > absolutePressure: 997.70
2019-10-18 08:27:01.089 Status: dzVents: > windGust: 28.1
2019-10-18 08:27:01.091 Status: dzVents: Info: ObserverIP_4-0.201910171900: ------ Finished ObserverIP-4.lua
:?: ;) :?:
RaspberryPi - RFLink - Zwave - WH2600
Domoticz : 2020.2 | Dashticz : V3.12 Master | dzvents : 3.0.2 | Python : 3.7.3
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Get weather data from LAN based ObserverIP PWS

Post by waaren »

Doudy wrote: Friday 18 October 2019 8:25 I have not yet understood the philosophy of the different variables :
E.g. local wind = dz.devices('AWindDir') and windir='windDirection'
wind = dz.devices('AWindDir')
this declares the variable 'wind' and assign the device object (which is a Lua table) dz.devices('AWindDir') to it

windir='windDirection'
the reply from your weatherstation give names to the various fields. For wind Direction it use the string windir. I want more descriptive names in the result table so if the script finds a name windir in the response, it will store a record in the result table using the string 'windDirection' as key and the found value as content.
I still have a problem with gustSpeed and Average wind.
These values are already send to the 'AWindDir' device.
This device combines the windDirection, windDirectionName, windSpeed, WindGust, outdoorTemperature and windChill.

If you want them also in a separate device, you will have to define them as custom sensor types with an X-as of m/sec
I updated the script in my post of Friday 06 September 2019 15:40 in this topic to include the option to have these values also in a separate device
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Doudy
Posts: 246
Joined: Tuesday 09 August 2016 9:09
Target OS: -
Domoticz version:
Contact:

Re: Get weather data from LAN based ObserverIP PWS

Post by Doudy »

;)

Thank you for explanation.
Now I begin understanding. :idea:
It is nice to pass of your time to give all this explanation.

;)

I test your last modification.
RaspberryPi - RFLink - Zwave - WH2600
Domoticz : 2020.2 | Dashticz : V3.12 Master | dzvents : 3.0.2 | Python : 3.7.3
Doudy
Posts: 246
Joined: Tuesday 09 August 2016 9:09
Target OS: -
Domoticz version:
Contact:

Re: Get weather data from LAN based ObserverIP PWS

Post by Doudy »

A little error :

Code: Select all

 2019-10-18 13:19:00.931 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for AinTemp: Temperature device adapter
2019-10-18 13:19:00.932 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for AinTempHum: Temperature+humidity device adapter
2019-10-18 13:19:00.933 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for AoutTemp: Temperature device adapter
2019-10-18 13:19:00.934 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for AoutTempHum: Temperature+humidity device adapter
2019-10-18 13:19:00.935 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for ASolarRad: Solar radiation device adapter
2019-10-18 13:19:00.935 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for AUvi: UV device adapter
2019-10-18 13:19:00.936 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for ARain: Rain device
2019-10-18 13:19:00.937 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for ARelPress: Barometer device adapter
2019-10-18 13:19:00.938 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for ARainDaily: Custom sensor device adapter
2019-10-18 13:19:00.939 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for ARainWeekly: Custom sensor device adapter
2019-10-18 13:19:00.940 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for ARainMonthly: Custom sensor device adapter
2019-10-18 13:19:00.940 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for ARainYearly: Custom sensor device adapter
2019-10-18 13:19:00.941 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for AGustSpeed: Custom sensor device adapter
2019-10-18 13:19:00.942 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for AvgWind: Custom sensor device adapter
2019-10-18 13:19:00.953 Status: dzVents: Error (2.4.19): ObserverIP_0.201910181100: An error occured when calling event handler ObserverIP-5
2019-10-18 13:19:00.953 Status: dzVents: Error (2.4.19): ObserverIP_0.201910181100: /home/pi/domoticz/scripts/dzVents/scripts/ObserverIP-5.lua:207: attempt to compare nil with number
2019-10-18 13:19:00.953 Status: dzVents: Info: ObserverIP_0.201910181100: ------ Finished ObserverIP-5.lua 

Code: Select all

ObserverIP_0.201910181100: An error occured when calling event handler ObserverIP-5
ObserverIP_0.201910181100: /home/pi/domoticz/scripts/dzVents/scripts/ObserverIP-5.lua:207: attempt to compare nil with number 
RaspberryPi - RFLink - Zwave - WH2600
Domoticz : 2020.2 | Dashticz : V3.12 Master | dzvents : 3.0.2 | Python : 3.7.3
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Get weather data from LAN based ObserverIP PWS

Post by waaren »

Doudy wrote: Friday 18 October 2019 13:22 A little error
No idea why you get this error. Can you add directly after line 181 (Line 181 is

Code: Select all

        local function updateDevices(fields) -- update all ( declared ) devices. Specialized function to create required fields are local to this function


the line

Code: Select all

if _G.logLevel == dz.LOG_DEBUG then dz.utils.dumpTable(fields) end
?
Also please include the output from the curl command taken at the same time.
The combination of these might help in finding the cause.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Doudy
Posts: 246
Joined: Tuesday 09 August 2016 9:09
Target OS: -
Domoticz version:
Contact:

Re: Get weather data from LAN based ObserverIP PWS

Post by Doudy »

Hello,
Always the same error.
Log file :

Code: Select all

 2019-10-18 15:35:01.382 Status: dzVents: Info: Handling httpResponse-events for: "ObserverIP_0.201910181100
2019-10-18 15:35:01.382 Status: dzVents: Info: ObserverIP_0.201910181100: ------ Start external script: ObserverIP-5.lua: HTTPResponse: "ObserverIP_0.201910181100"
2019-10-18 15:35:01.385 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for AWindDir: Wind device adapter
2019-10-18 15:35:01.388 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for AinTemp: Temperature device adapter
2019-10-18 15:35:01.392 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for AinTempHum: Temperature+humidity device adapter
2019-10-18 15:35:01.395 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for AoutTemp: Temperature device adapter
2019-10-18 15:35:01.397 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for AoutTempHum: Temperature+humidity device adapter
2019-10-18 15:35:01.399 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for ASolarRad: Solar radiation device adapter
2019-10-18 15:35:01.400 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for AUvi: UV device adapter
2019-10-18 15:35:01.402 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for ARain: Rain device
2019-10-18 15:35:01.404 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for ARelPress: Barometer device adapter
2019-10-18 15:35:01.405 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for ARainDaily: Custom sensor device adapter
2019-10-18 15:35:01.407 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for ARainWeekly: Custom sensor device adapter
2019-10-18 15:35:01.409 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for ARainMonthly: Custom sensor device adapter
2019-10-18 15:35:01.411 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for ARainYearly: Custom sensor device adapter
2019-10-18 15:35:01.413 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for AGustSpeed: Custom sensor device adapter
2019-10-18 15:35:01.414 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for AvgWind: Custom sensor device adapter
2019-10-18 15:35:01.427 Status: dzVents: > absolutePressure: 1001.30
2019-10-18 15:35:01.428 Status: dzVents: > yearlyRain: 604.80
2019-10-18 15:35:01.428 Status: dzVents: > monthlyRain: 98.70
2019-10-18 15:35:01.428 Status: dzVents: > weeklyRain: 18.00
2019-10-18 15:35:01.428 Status: dzVents: > outdoorHumidity: 74
2019-10-18 15:35:01.428 Status: dzVents: > indoorHumidity: 60
2019-10-18 15:35:01.428 Status: dzVents: > outdoorTemperature: 15.5
2019-10-18 15:35:01.428 Status: dzVents: > hourlyRainRate: 0.00
2019-10-18 15:35:01.428 Status: dzVents: > dailyRain: 0.30
2019-10-18 15:35:01.428 Status: dzVents: > UVI: 2
2019-10-18 15:35:01.428 Status: dzVents: > UV: 623
2019-10-18 15:35:01.428 Status: dzVents: > solarRadiation: 371.86
2019-10-18 15:35:01.428 Status: dzVents: > relativePressure: 1003.40
2019-10-18 15:35:01.428 Status: dzVents: > indoorTemperature: 22.6
2019-10-18 15:35:01.428 Status: dzVents: > windDirection: 181
2019-10-18 15:35:01.428 Status: dzVents: Error (2.4.19): ObserverIP_0.201910181100: An error occured when calling event handler ObserverIP-5
2019-10-18 15:35:01.428 Status: dzVents: Error (2.4.19): ObserverIP_0.201910181100: /home/pi/domoticz/scripts/dzVents/scripts/ObserverIP-5.lua:207: attempt to compare nil with number
2019-10-18 15:35:01.428 Status: dzVents: Info: ObserverIP_0.201910181100: ------ Finished ObserverIP-5.lua 
Curl command :

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>LiveData</title>
        <link href="axcss0.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td colspan="2" align="right" bgcolor="#0088F7">&nbsp;</td>
            </tr>
            <tr>
                <td colspan="2" bgcolor="#FFFFFF"><table border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td width="20" height = "80">&nbsp;</td>                                      
                            <td >&nbsp;</td>
                                                        <td width="10">&nbsp;</td>
                                <td class="txtstyle_1" >Weather Logger  2.2</td>                          
                        </tr>
                </table></td>
            </tr>
            <tr>
                <td colspan="2" align="right" bgcolor="#60B7FF"><table border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td width="120" align="center"><font color="#FFFFFF" face="Arial, Helvetica, sans-serif"><em>Version:2.2.2</em></font></td>
                        </tr>
                </table></td>
            </tr>
            <tr>
                <td colspan="2" align="left" bgcolor="#C0C0C0">
                    <table width="20" border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td bgcolor="#C0C0C0"><div class="menuitem_1"><a href="bscsetting.htm">Local Network</a></div></td>
                            <td bgcolor="#C0C0C0"><div class="menuitem_1"><a href="weather.htm">Weather Network</a></div></td>
                            <td bgcolor="#C0C0C0"><div class="menuitem_1"><a href="station.htm">Station Settings</a></div></td>
                            <td bgcolor="#EDEFEF"><div class="menuitem_1"><a href="livedata.htm">Live Data</a></div></td>
                            <td bgcolor="#C0C0C0"><div class="menuitem_1"><a href="correction.htm">Calibration</a></div></td>
                        </tr>
                    </table>
                </td>
            </tr>
            <form name="livedata" method="POST" onsubmit="return chkForm(0);">

                <tr>
                    <td colspan="2" bgcolor="#EDEFEF"><div class="subitem_1">Live Data</div></td>
                </tr>
                 <tr>
                    <td width="533" bgcolor="#EDEFEF"><div class="item_1">Receiver Time:</div></td>
                    <td width="307" bgcolor="#EDEFEF">
                    <input name="CurrTime" disabled="disabled" type="text" class="item_2" style="WIDTH: 120px" value="15:36 10/18/2019" maxlength ="20"></td>
                </tr>
                <tr>
                    <td width="533" bgcolor="#EDEFEF"><div class="item_1">Indoor Battery Status</div></td>
                    <td width="307" bgcolor="#EDEFEF">
                    <select name="inBattSta" class="item_2" disabled="disabled"  style="WIDTH: 120px">
                            <option value="0" selected >Normal</option>
                            <option value="1"          >Indoor Bat Low</option>
                    </select></td>
                </tr>
                <tr>
                    <td width="533" bgcolor="#EDEFEF"><div class="item_1">Outdoor Battery Status</div></td>
                    <td width="307" bgcolor="#EDEFEF">
                    <select name="outBattSta" class="item_2" disabled="disabled"  style="WIDTH: 120px">
                            <option value="0" selected >Normal</option>
                            <option value="1"          >Outdoor Bat Low</option>
                    </select></td>
                </tr>
                <tr>
                    <td width="533" bgcolor="#EDEFEF"><div class="item_1">Indoor Sensor ID</div></td>
                    <td width="307" bgcolor="#EDEFEF"><input name="IndoorID" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="0x4c" maxlength="6"></td>
                </tr>
                <tr>
                    <td bgcolor="#EDEFEF"><div class="item_1">Outdoor Sensor1 ID</div></td>
                    <td bgcolor="#EDEFEF"><input name="Outdoor1ID" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="0x7e" maxlength="6"></td>
                </tr>

                <tr>
                    <td bgcolor="#EDEFEF"><div class="item_1">Outdoor Sensor2 ID</div></td>
                    <td bgcolor="#EDEFEF"><input name="Outdoor2ID" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="0x--" maxlength="6"></td>
                </tr>

                <tr>
                    <td bgcolor="#EDEFEF"><div class="item_1">Indoor Temperature</div></td>
                    <td bgcolor="#EDEFEF"><input name="inTemp" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="22.6" maxlength="8"></td>
                </tr>

                <tr>
                    <td bgcolor="#EDEFEF"><div class="item_1">Indoor Humidity</div></td>
                    <td bgcolor="#EDEFEF"><input name="inHumi" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="60" maxlength="4"></td>
                </tr>
                <tr>
                    <td bgcolor="#EDEFEF"><div class="item_1">Absolute Pressure </div></td>
                    <td bgcolor="#EDEFEF"><input name="AbsPress" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="1001.30" maxlength="6"></td>
                </tr>
                <tr>
                    <td bgcolor="#EDEFEF"><div class="item_1">Relative Pressure </div></td>
                    <td bgcolor="#EDEFEF"><input name="RelPress" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="1003.40" maxlength="6"></td>
                </tr>
                <tr>
                    <td bgcolor="#EDEFEF"><div class="item_1">Outdoor Temperature</div></td>
                    <td bgcolor="#EDEFEF"><input name="outTemp" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="15.5" maxlength="8"></td>
                </tr>

                <tr>
                    <td bgcolor="#EDEFEF"><div class="item_1">Outdoor Humidity </div></td>
                    <td bgcolor="#EDEFEF"><input name="outHumi" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="73" maxlength="4"></td>
                </tr>

                <tr>
                    <td bgcolor="#EDEFEF"><div class="item_1">Wind Direction </div></td>
                    <td bgcolor="#EDEFEF"><input name="windir" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="234" maxlength="5"></td>
                </tr>

                <tr>
                    <td bgcolor="#EDEFEF"><div class="item_1">Wind Speed </div></td>
                    <td bgcolor="#EDEFEF"><input name="avgwind" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="12.2" maxlength="6"></td>
                </tr>

                <tr>
                    <td bgcolor="#EDEFEF"><div class="item_1">Wind Gust </div></td>
                    <td bgcolor="#EDEFEF"><input name="gustspeed" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="16.2" maxlength="6"></td>
                </tr>

                <tr>
                    <td bgcolor="#EDEFEF"><div class="item_1">Solar Radiation </div></td>
                    <td bgcolor="#EDEFEF"><input name="solarrad" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="355.42" maxlength="12"></td>
                </tr>

                <tr>
                    <td bgcolor="#EDEFEF"><div class="item_1">UV </div></td>
                    <td bgcolor="#EDEFEF"><input name="uv" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="596" maxlength="12"></td>
                </tr>

                <tr>
                    <td bgcolor="#EDEFEF"><div class="item_1">UVI </div></td>
                    <td bgcolor="#EDEFEF"><input name="uvi" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="2" maxlength="4"></td>
                </tr>

                <tr>
                    <td bgcolor="#EDEFEF"><div class="item_1">Hourly Rain Rate</div></td>
                    <td bgcolor="#EDEFEF"><input name="rainofhourly" disabled="disabled" type="text" class="item_2" style="WIDTH: 80px" value="0.00" maxlength="8"></td>
                </tr>

                                <form name="Rain_1" method="POST" onsubmit="return chkForm(0);">
                        <tr>
                            <td bgcolor="#EDEFEF"><div class="item_1">Daily Rain</div></td>
                            <td bgcolor="#EDEFEF"><input name="rainofdaily"  type="text" class="item_2" style="WIDTH: 80px" value="0.30" maxlength="8">
                        <span id="rainofdaily_msg" class="errMsg0"></span></td>
                        </tr>

                        <tr>
                            <td bgcolor="#EDEFEF"><div class="item_1">Weekly Rain</div></td>
                            <td bgcolor="#EDEFEF"><input name="rainofweekly" type="text" class="item_2" style="WIDTH: 80px" value="18.00" maxlength="8">
                         <span id="rainofweekly_msg" class="errMsg0"></span></td>
                        </tr>

                        <tr>
                            <td bgcolor="#EDEFEF"><div class="item_1">Monthly Rain</div></td>
                            <td bgcolor="#EDEFEF"><input name="rainofmonthly" type="text" class="item_2" style="WIDTH: 80px" value="98.70" maxlength="8">
                         <span id="rainofmonthly_msg" class="errMsg0"></span></td>
                        </tr>

                        <tr>
                            <td bgcolor="#EDEFEF"><div class="item_1">Yearly Rain</div></td>
                            <td bgcolor="#EDEFEF"><input name="rainofyearly" type="text" class="item_2" style="WIDTH: 80px" value="604.80" maxlength="8">
                         <span id="rainofyearly_msg" class="errMsg0"></span></td>
                        </tr>

                        <tr>
                            <td colspan="2" bgcolor="#EDEFEF">&nbsp;</td>
                        </tr>
                        <tr align="center">
                            <td colspan="2" bgcolor="#EDEFEF"><input name="Apply" type="submit" class="item_2" style="WIDTH: 60px; HEIGHT: 24px;" onclick="setSubmitType(1)" value="Apply" />
                                <input name="Cancel" type="reset" class="item_2" style="WIDTH: 60px; HEIGHT: 24px;" value="Cancel" /></td>
                        </tr>
                </form>

                <tr>
                    <td colspan="2" bgcolor="#EDEFEF">&nbsp;</td>
                </tr>

                <tr>
                    <td colspan="2" align="center" bgcolor="#EDEFEF">
                        <input name="rain_Default" type="button" class="item_2" style="WIDTH: 110px; HEIGHT: 24px;" onclick="raindef()" value="Rain Reset">
                        <input id="refresh_st" type="button" class="item_4" style="WIDTH: 110px; HEIGHT: 24px;"  onclick="uiCtrl(this.value);" value="Refresh">
                        <input id="refresh_sp" type="button" class="item_2" style="WIDTH: 110px; HEIGHT: 24px;"  onclick="uiCtrl(this.value);" value="Stop Refresh">
                    </td>
                </tr>
            </form>
            <tr>
                <td colspan="2" bgcolor="#EDEFEF">&nbsp;</td>
            </tr>
            <tr>
                <td colspan="2" bgcolor="#C0C0C0">&nbsp;</td>
            </tr>
        </table>

                <script src="axjs0.js" type="text/javascript"></script>
        <script language="JavaScript" type="text/javascript">
            <!--
            var rfTaskRuningFlag = 0, rfTimeId;
            uiCtrl('Refresh');

                        function uiCtrl(uiCmd)
                        {
                            if (uiCmd=='Refresh'){
                                document.getElementById('refresh_st').disabled = true;
                                document.getElementById('refresh_sp').disabled = false;
                                rfTaskRuningFlag = 1;
                                rfTaskState = 0;
                                rfTimeId = setInterval("ss()",16000);
                            }else if (uiCmd=='Stop Refresh'){
                                document.getElementById('refresh_st').disabled = false;
                                document.getElementById('refresh_sp').disabled = true;
                                rfTaskRuningFlag = 0;
                                clearInterval(rfTimeId);
                            }
                        }

                        function ss()
                        {
                            if (rfTaskRuningFlag)
                            {
                                window.top.location.reload();
                            }
                        }
                        //-->
                </script>
    </body>
</html>
RaspberryPi - RFLink - Zwave - WH2600
Domoticz : 2020.2 | Dashticz : V3.12 Master | dzvents : 3.0.2 | Python : 3.7.3
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Get weather data from LAN based ObserverIP PWS

Post by waaren »

Doudy wrote: Friday 18 October 2019 15:40 same error.
I tested with the response data from your curl command and I don't get an error.
Sent you a PM
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Doudy
Posts: 246
Joined: Tuesday 09 August 2016 9:09
Target OS: -
Domoticz version:
Contact:

Re: Get weather data from LAN based ObserverIP PWS

Post by Doudy »

waaren wrote: Friday 18 October 2019 17:57 Sent you a PM
;)
RaspberryPi - RFLink - Zwave - WH2600
Domoticz : 2020.2 | Dashticz : V3.12 Master | dzvents : 3.0.2 | Python : 3.7.3
Doudy
Posts: 246
Joined: Tuesday 09 August 2016 9:09
Target OS: -
Domoticz version:
Contact:

Re: Get weather data from LAN based ObserverIP PWS

Post by Doudy »

Hello,
When I change 'on' as follows:

Code: Select all

...
on = 
    { 
	    devices = {'WH2600-Wind'}, --mydevice
	    httpResponses = { scriptVar } 
    },
etc ...
The result is:

Code: Select all

2019-10-29 16:54:52.503 Status: dzVents: Info: Handling events for: "WH2600-Wind", value: "64;ENE;16.0;45.0;10.4;10.4"
2019-10-29 16:54:52.503 Status: dzVents: Info: ObserverIP_0.201910181100: ------ Start external script: ObserverIP-5.lua: Device: "WH2600-Wind (Virtuel)", Index: 43
2019-10-29 16:54:52.507 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for LD-WindDir: Wind device adapter
2019-10-29 16:54:52.509 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for LD-inTemp: Temperature device adapter
2019-10-29 16:54:52.510 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for LD-inTempHum: Temperature+humidity device adapter
2019-10-29 16:54:52.512 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for LD-outTemp: Temperature device adapter
2019-10-29 16:54:52.514 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for LD-outTempHum: Temperature+humidity device adapter
2019-10-29 16:54:52.516 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for LD-SolarRad: Solar radiation device adapter
2019-10-29 16:54:52.518 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for LD-Uvi: UV device adapter
2019-10-29 16:54:52.520 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for LD-Rain: Rain device
2019-10-29 16:54:52.521 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for LD-RelPress: Barometer device adapter
2019-10-29 16:54:52.523 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for LD-RainDaily: Custom sensor device adapter
2019-10-29 16:54:52.525 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for LD-RainWeekly: Custom sensor device adapter
2019-10-29 16:54:52.527 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for LD-RainMonthly: Custom sensor device adapter
2019-10-29 16:54:52.528 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for LD-RainYearly: Custom sensor device adapter
2019-10-29 16:54:52.529 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for LD-GustSpeed: Custom sensor device adapter
2019-10-29 16:54:52.530 Status: dzVents: Debug: ObserverIP_0.201910181100: Processing device-adapter for LD-AvgWind: Custom sensor device adapter
2019-10-29 16:54:52.530 Status: dzVents: Error (2.4.19): ObserverIP_0.201910181100: Could not get (good) data from 192.168.1.99
2019-10-29 16:54:52.530 Status: dzVents: Debug: ObserverIP_0.201910181100: nil
2019-10-29 16:54:52.531 Status: dzVents: Info: ObserverIP_0.201910181100: ------ Finished ObserverIP-5.lua 
But no data display:

Code: Select all

2019-10-29 16:58:00.925 Status: dzVents: > indoorHumidity: 56
2019-10-29 16:58:00.925 Status: dzVents: > windGust: 12.2
2019-10-29 16:58:00.925 Status: dzVents: > relativePressure: 1021.50
2019-10-29 16:58:00.925 Status: dzVents: > UVI: 0
2019-10-29 16:58:00.925 Status: dzVents: > yearlyRain: 624.60
2019-10-29 16:58:00.925 Status: dzVents: > absolutePressure: 1019.40
2019-10-29 16:58:00.925 Status: dzVents: > monthlyRain: 118.50
2019-10-29 16:58:00.925 Status: dzVents: > weeklyRain: 0.00
2019-10-29 16:58:00.925 Status: dzVents: > windDirection: 46
2019-10-29 16:58:00.925 Status: dzVents: > indoorTemperature: 20.9
2019-10-29 16:58:00.925 Status: dzVents: > solarRadiation: 18.51
2019-10-29 16:58:00.925 Status: dzVents: > dailyRain: 0.00
2019-10-29 16:58:00.925 Status: dzVents: > UV: 73
2019-10-29 16:58:00.925 Status: dzVents: > windSpeed: 10.1
2019-10-29 16:58:00.926 Status: dzVents: > outdoorHumidity: 76
2019-10-29 16:58:00.926 Status: dzVents: > hourlyRainRate: 0.00
2019-10-29 16:58:00.926 Status: dzVents: > outdoorTemperature: 10.4 
There is the following error code:

Code: Select all

Status: dzVents: Error (2.4.19): ObserverIP_0.201910181100: Could not get (good) data from 192.168.1.99
For me it's a little too complicated.
He must be missing something somewhere, but where?


Any idea :?:
;)
RaspberryPi - RFLink - Zwave - WH2600
Domoticz : 2020.2 | Dashticz : V3.12 Master | dzvents : 3.0.2 | Python : 3.7.3
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Get weather data from LAN based ObserverIP PWS

Post by waaren »

Doudy wrote: Wednesday 30 October 2019 6:54 When I change 'on' as follows:

Code: Select all

...
on = 
    { 
	    devices = {'WH2600-Wind'}, --mydevice
	    httpResponses = { scriptVar } 
    },
etc ...
There is the following error code:

Code: Select all

Status: dzVents: Error (2.4.19): ObserverIP_0.201910181100: Could not get (good) data from 192.168.1.99
For me it's a little too complicated.
The script now checks if it was triggered by a timer-rule and if not it assumes that it was triggered by a HTTPResponse. Because you changed the trigger in the on = section from timer to devices it does not work as you expect. To enable the script to work on both devices and timers, you will have to change the last couple of lines of the script from

Code: Select all

       -- main 
        if item.isTimer then
            checkWebpageResponse()
            getWeatherStationData()
        elseif item.ok then -- statusCode == 2xx
            updateDevices(processHTM(item.data))
        else
            dz.log('Could not get (good) data from ' .. weatherStationIP,dz.LOG_ERROR)
            dz.log(item.data,dz.LOG_DEBUG)
        end

    end
}
to

Code: Select all

       -- main 
        if item.isTimer or item.isDevice then
            checkWebpageResponse()
            getWeatherStationData()
        elseif item.ok then -- statusCode == 2xx
            updateDevices(processHTM(item.data))
        else
            dz.log('Could not get (good) data from ' .. weatherStationIP,dz.LOG_ERROR)
            dz.log(item.data,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
Doudy
Posts: 246
Joined: Tuesday 09 August 2016 9:09
Target OS: -
Domoticz version:
Contact:

Re: Get weather data from LAN based ObserverIP PWS

Post by Doudy »

OK it works as I wanted
Thank you
;)
RaspberryPi - RFLink - Zwave - WH2600
Domoticz : 2020.2 | Dashticz : V3.12 Master | dzvents : 3.0.2 | Python : 3.7.3
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Get weather data from LAN based ObserverIP PWS

Post by eddieb »

Keep up the great work waaren ;-)
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Get weather data from LAN based ObserverIP PWS

Post by waaren »

Updated version (replaced math.pow(x,y ) with x^y )
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Get weather data from LAN based ObserverIP PWS

Post by eddieb »

Hi, I just installed this new version.
adjusted the IP to my situation and changed local device names .

Works fine
Last edited by eddieb on Saturday 09 November 2019 15:48, edited 1 time in total.
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
Doudy
Posts: 246
Joined: Tuesday 09 August 2016 9:09
Target OS: -
Domoticz version:
Contact:

Re: Get weather data from LAN based ObserverIP PWS

Post by Doudy »

Testing, but :

Code: Select all

2019-11-09 15:40:31.427 Status: dzVents: Error (2.4.19): ObserverIP_0.201910181100: /home/pi/domoticz/scripts/dzVents/scripts/ObserverIP-5.lua:210: bad argument #2 to 'pow' (number expected, got no value)
:?:
RaspberryPi - RFLink - Zwave - WH2600
Domoticz : 2020.2 | Dashticz : V3.12 Master | dzvents : 3.0.2 | Python : 3.7.3
eddieb
Posts: 279
Joined: Wednesday 04 July 2018 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Get weather data from LAN based ObserverIP PWS

Post by eddieb »

@Doudy which version of Domoticz are you running ?
I am on latest beta V4.11474
RPI4 Beta / Tasmota / ZigBee2MQTT / P1meter / Haier AC with Node-Red and MQTT / SolarEdge SE3500H modbus_tcp / Opentherm gateway / Plugwise Anna/Smile / ObserverIP weatherstation thru WuDirect
Feeding ADSB https://adsb.im/home
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Get weather data from LAN based ObserverIP PWS

Post by waaren »

Doudy wrote: Saturday 09 November 2019 15:43

Code: Select all

2019-11-09 15:40:31.427 Status: dzVents: Error (2.4.19): ObserverIP_0.201910181100: /home/pi/domoticz/scripts/dzVents/scripts/ObserverIP-5.lua:210: bad argument #2 to 'pow' (number expected, got no value)
In the latest posted version (0.201911091100) the string pow does not exits so I guess you test with an old or mixed version. Please try again with this new version.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Doudy
Posts: 246
Joined: Tuesday 09 August 2016 9:09
Target OS: -
Domoticz version:
Contact:

Re: Get weather data from LAN based ObserverIP PWS

Post by Doudy »

waaren wrote: Saturday 09 November 2019 23:39 In the latest posted version (0.201911091100) the string pow does not exits so I guess you test with an old or mixed version. Please try again with this new version.
Is Version: 4.10717 OK ?
No Update Available !...
RaspberryPi - RFLink - Zwave - WH2600
Domoticz : 2020.2 | Dashticz : V3.12 Master | dzvents : 3.0.2 | Python : 3.7.3
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Get weather data from LAN based ObserverIP PWS

Post by waaren »

Doudy wrote: Sunday 10 November 2019 8:43 Is Version: 4.10717 OK ? No Update Available !...
You confuse the domoticz Version with the script version. domoticz V4.10717 is the latest "stable" domoticz version. There are newer ( beta ) versions available but those are not required for using this script.

I updated this posting yesterday with a new version of the script (scriptVersion 0.201911091100 )
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest