Script Dzvents to read values from webpage [Solved]
Posted: Tuesday 01 February 2022 22:29
Dear all,
I would like to get somes values from a weather station website and store these data into Domoticz.
The API request is :
Lines 65 and 66 from html reponse are Wind Speed and Wind Gust:
Line 68 is Wind Direction:
This is my code lines but, how I could read the html reponse to dump in dzvents?
Thank you in advance.
I would like to get somes values from a weather station website and store these data into Domoticz.
The API request is :
Code: Select all
http://centronautico.cm-faro.pt/report.php
Code: Select all
<td class="ws3">3</td>
<td class="ws3">5</td>
Code: Select all
<img src="images/wd_SE.gif" alt="SE" /></td>
Code: Select all
local scriptVar = 'getWidInfo'
return
{
on =
{
timer =
{
'every minute',
},
httpResponses =
{
scriptVar,
},
},
logging =
{
level = domoticz.LOG_DEBUG,
marker = scriptVar,
},
execute = function(dz, item)
if item.isTimer or item.isDevice then
dz.openURL(
{
url = "http://centronautico.cm-faro.pt/report1.php",
method = 'GET',
callback = scriptVar,
})
elseif item.ok then -- statusCode == 2xx
end
}