Scraping only the temperature from WeatherUnderground sensor

Moderator: leecollings

Sergio
Posts: 39
Joined: Friday 12 December 2014 13:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9639
Location: Spain
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by Sergio »

The script doesn't work anymore as now it seems that the virtual sensors id's are alphanumeric. I'll search for updating a sensors with an alphanumeric id, but if anyone knows how to do it I'll be appreciated.
User avatar
McMelloW
Posts: 434
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by McMelloW »

Starting with a Raspberry Pi and Domoticz. I have setup the the WU weather station and virtual devices. The WU devices are updated correctly, but the virtual devices are updated only once. Below is the code from the wiki page adjusted for my system. Can somebody give me a hint

Code: Select all

--Script To Parse WeatherUnderground Multi-Value Sensor, Additionally using PWS: system from WU with a new output format
--This script assumes the output (which can be viewed in events show current state button) is like this 19.5;79;3;1019;3 (temp;humidity;null;pressure;null)
--more details at this wiki http://www.domoticz.com/wiki/Virtual_weather_devices
--
--The following need updated for your environment get the 'Idx' or 'Name' off the Device tab. By default only the Temp is 'uncommented or enabled' in this script.
local sensorwu = 'WU-THB' --name of the sensor that gets created when you add the WU device (and that contains multiple values like temperature, humidity, baromete$
local idxt = 24 --idx of the virtual temperature sensor you need to change this to your own Device IDx
local idxh = 25 --idx of the virtual humidity sensor you need to change this to your own Device IDx
local idxp = 26 --idx of the virtual pressure sensor you need to change this to your own Device IDx
--

commandArray = {}

if (devicechaged[sensorwu]) then
        sWeatherTemp, sWeatherHumidity, sHumFeelsLike, sWeatherPressure = otherdevices_svalues[sensorwu]:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)")
        sWeatherTemp = tonumber(sWeatherTemp)
        sWeatherHumidity = tonumber(sWeatherHumidity)
        sWeatherPressure = tonumber(sWeatherPressure)
        --parseDebug = ('WU Script Parsed Temp=' .. sWeatherTemp .. ' Humidity=' .. sWeatherHumidity .. ' Pressure=' .. sWeatherPressure)
        --print(parseDebug)

        commandArray[1] = {['UpdateDevice'] = idxt .. '|0|' .. tostring(sWeatherTemp)}
        commandArray[2] = {['UpdateDevice'] = idxh .. '|' .. tostring(sWeatherHumidity) .. '|' .. tostring(sHumFeelsLike)}
        commandArray[3] = {['UpdateDevice'] = idxp .. '|0|' .. tostring(sWeatherPressure) .. ';' .. tostring(sWeatherPressForcast)}
end

return commandArray
Greetings McMelloW
astrapowerrr
Posts: 141
Joined: Tuesday 31 January 2017 20:34
Target OS: -
Domoticz version:
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by astrapowerrr »

hi

i just tried to make this script working but i`m only having errors like

2017-12-14 16:01:36.075 Error: WUnderground: Receiving old data from WU! (No new data return for more than 30 minutes)
2017-12-14 16:01:49.401 Error: PROXY: timeout occurred, reconnecting
2017-12-14 16:01:49.402 Error: PROXY: Connect failed, reconnecting: Network is unreachable
2017-12-14 16:03:04.402 Error: PROXY: timeout occurred, reconnecting
2017-12-14 16:03:04.403 Error: PROXY: Connect failed, reconnecting: Network is unreachable
2017-12-14 16:04:19.403 Error: PROXY: timeout occurred, reconnecting
2017-12-14 16:04:19.403 Error: PROXY: Connect failed, reconnecting: Network is unreachable
2017-12-14 16:05:34.404 Error: PROXY: timeout occurred, reconnecting
2017-12-14 16:05:34.404 Error: PROXY: Connect failed, reconnecting: Network is unreachable
2017-12-14 16:06:49.404 Error: PROXY: timeout occurred, reconnecting
2017-12-14 16:06:49.405 Error: PROXY: Connect failed, reconnecting: Network is unreachable
2017-12-14 16:08:04.405 Error: PROXY: timeout occurred, reconnecting
2017-12-14 16:08:04.405 Error: PROXY: Connect failed, reconnecting: Network is unreachable
2017-12-14 16:09:19.406 Error: PROXY: timeout occurred, reconnecting
2017-12-14 16:09:19.406 Error: PROXY: Connect failed, reconnecting: Network is unreachable
2017-12-14 16:10:34.407 Error: PROXY: timeout occurred, reconnecting
2017-12-14 16:10:34.407 Error: PROXY: Connect failed, reconnecting: Network is unreachable
2017-12-14 16:11:49.407 Error: PROXY: timeout occurred, reconnecting
2017-12-14 16:11:49.408 Error: PROXY: Connect failed, reconnecting: Network is unreachable
2017-12-14 16:13:04.408 Error: PROXY: timeout occurred, reconnecting
2017-12-14 16:13:04.408 Error: PROXY: Connect failed, reconnecting: Network is unreachable
2017-12-14 16:14:19.409 Error: PROXY: timeout occurred, reconnecting
2017-12-14 16:14:19.409 Error: PROXY: Connect failed, reconnecting: Network is unreachable
2017-12-14 16:15:34.410 Error: PROXY: timeout occurred, reconnecting
2017-12-14 16:15:34.410 Error: PROXY: Connect failed, reconnecting: Network is unreachable
Mitchie
Posts: 2
Joined: Sunday 28 January 2018 18:02
Target OS: OS X
Domoticz version:
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by Mitchie »

I want to make this also working with only scraping wind and not showing temperture.
Showing : WindDirectionDegrees, sWindDirection, WindSpeed and WindGust.
I have been trying to do change a script for a couple of days but i am not so good at coding.
Can some please look at it help to good way around.

Code: Select all

--Script To Parse WeatherUnderground Multi-Value Sensor, Additionally using PWS: system from WU with a new output format
--more details at this wiki http://www.domoticz.com/wiki/Virtual_weather_devices
--
--The following need updated for your environment get the 'Idx' or 'Name' off the Device tab. By default only the Temp is 'uncommented or enabled' in this script.
local sensorwu = 'Wind1'
local idxw = 25 --idx of virtual windsensor
local idxg = 999 --idx of gevoelstemperatuur

commandArray = {}

if devicechanged[sensorwu] then

        sWindDirectionDegrees, sWindDirection, sWindSpeed, sWindGust, sWindTemperature, sWindFeel = otherdevices_svalues[sensorwu]:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)")
        sWindDirectionDegrees = tonumber(sWindDirectionDegrees);
        sWindDirection = (sWindDirection);
        sWindSpeed = tonumber(sWindSpeed);
        sWindGust = tonumber(sWindGust);
        sWindTemperature = tonumber(sWindTemperature);
        sWindFeel = tonumber(sWindFeel);

        -- print("Windmeter: Winddirection (in degrees) is: " .. sWindDirectionDegrees .. " ");
        -- print("Windmeter: Winddirection is: " .. sWindDirection .. " ");
        -- print("Windmeter: Windspeed is: " .. sWindSpeed .. " ");
        -- print("Windmeter: Windgust is: " .. sWindGust .. " ");
        -- print("Windmeter: Windtemperature is: " .. sWindTemperature .. " ");
        -- print("Windmeter: Windfeel is: " .. sWindFeel .. " ");
        
        -- commandArray[5] = {['UpdateDevice'] = idxw .. sWindDirectionDegrees .. ';' .. sWindDirection .. ';' .. sWindSpeed .. ';' .. sWindGust .. ';' .. sWindTemperature .. ';' ..sWindFeel}
        commandArray[6] = {['UpdateDevice'] = idxg .. '|0|'.. sWindFeel}
end

return commandArray
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest