Scraping only the temperature from WeatherUnderground sensor

Sergio
Posts: 51
Joined: Friday 12 December 2014 14:25
Target OS: Raspberry Pi
Domoticz version: 3.6150
Location: Spain
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by Sergio » Tuesday 09 August 2016 6:25

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.

McMelloW
Posts: 9
Joined: Monday 20 November 2017 18:01
Target OS: Raspberry Pi
Domoticz version: V3.8153
Location: Harderwijk
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by McMelloW » Monday 20 November 2017 18:37

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: 18
Joined: Tuesday 31 January 2017 21:34
Target OS: -
Domoticz version:
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by astrapowerrr » Thursday 14 December 2017 17:17

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

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest