Scraping only the temperature from WeatherUnderground sensor

dpons039
Posts: 12
Joined: Monday 10 August 2015 12:38
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Scraping only the temperature from WeatherUnderground se

Post by dpons039 » Wednesday 12 August 2015 10:57

spudgunman wrote: and wacky on the dash
Image
Hello guys,

I have been checking the posts around the forum but I didn't found any solution for this.

Can someone help? I would relly like to have the barometer working without extra devices showing up on my dashboard.

Thank you in advance!

Edit:
Within the Bartometer, you need a second parameter in order to be diplayed correctly.
Synology NAS 415+ | Raspberry + Aeon Z-Stick Gen5

Sandman79
Posts: 27
Joined: Wednesday 30 September 2015 20:30
Target OS: NAS (Synology & others)
Domoticz version:
Location: Belgium
Contact:

Re: Scraping only the temperature from WeatherUnderground se

Post by Sandman79 » Saturday 03 October 2015 14:41

just a question: is it also possible to log the dew point using the weatherunderground 'sensor' ? :)

rednas
Posts: 120
Joined: Tuesday 20 October 2015 12:23
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands
Contact:

Re: Scraping only the temperature from WeatherUnderground se

Post by rednas » Wednesday 11 November 2015 23:51

Did someone fix this already?

I am using this:
commandArray[3] = {['UpdateDevice'] = idxp .. '|0|' .. tostring(sWeatherPressure)}

The value is shown in the devices tab, but when I go to the weather tab I have this empty barometer box.
How can I fix this?

rednas
Posts: 120
Joined: Tuesday 20 October 2015 12:23
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands
Contact:

Re: Scraping only the temperature from WeatherUnderground se

Post by rednas » Tuesday 24 November 2015 22:30

dpons039 wrote: Edit:
Within the Bartometer, you need a second parameter in order to be diplayed correctly.
Does anybody know how I can make this work?

mrblond18
Posts: 10
Joined: Monday 21 December 2015 12:40
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Scraping only the temperature from WeatherUnderground se

Post by mrblond18 » Monday 21 December 2015 12:48

I was facing the same problem. Important to know is that a pressure sensor needs the pressure in bar, a barometer needs the pressure in hPa and weather underground supplies the pressure in hPa. Further a barometer also needs a so called BAR_FOR = Barometer forecast (see domoticz json/api docs for more details). I think weather underground supplies this forecast also.

I think I have fixed the problems for both types of sensors in LUA. I added an index for a barometer sensor, I also read the last value of the Temperature-Humidity-Barometer object (stored it in sWeatherPressureForecast ) and converted from hPa to bar.

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 = 'TempHumiBaro-WU' --name of the sensor that gets created when you add the WU device (and that contains multiple values like temperature, humidity, barometer etc)
local idxt = 51 --idx of the virtual temperature sensor you need to change this to your own Device IDx
local idxh = 52 --idx of the virtual humidity sensor you need to change this to your own Device IDx
local idxp = 54 --idx of the virtual pressure sensor you need to change this to your own Device IDx
local idxb = 53 --idx of virtual barometer sensor you need to change this to your own Device IDx
--

commandArray = {}

if devicechanged[sensorwu] then
        sWeatherTemp, sWeatherHumidity, sHumFeelsLike, sWeatherPressure, sWeatherPressureForecast = otherdevices_svalues[sensorwu]:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)")
        sWeatherTemp = tonumber(sWeatherTemp)
        sWeatherHumidity = tonumber(sWeatherHumidity)
        sHumFeelsLike = tonumber(sHumFeelsLike)
        sWeatherPressure = tonumber(sWeatherPressure) -- hPa
        sWeatherPressureBar = sWeatherPressure/1000 -- bar
        sWeatherPressureForecast = tonumber(sWeatherPressureForecast)
        parseDebug = ('WU Script Parsed Temperat=' .. sWeatherTemp)
        print(parseDebug)
        parseDebug = ('WU Script Parsed Humidity=' .. sWeatherHumidity)
        print(parseDebug)
        parseDebug = ('WU Script Parsed HumidityFeelsLike=' .. sHumFeelsLike)
        print(parseDebug)
        parseDebug = ('WU Script Parsed Pressure=' .. sWeatherPressure .. ' hPa')
        print(parseDebug)
        parseDebug = ('WU Script Parsed Pressure=' .. sWeatherPressureBar .. ' bar')
        print(parseDebug)
        parseDebug = ('WU Script Parsed PressureForecast=' .. sWeatherPressureForecast)
        print(parseDebug)



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

return commandArray


I see that values are read correctly. I still see some weird behaviour of the pressure sensor. It only stores one decimal, everything between 0.95 and 1.05 bar is seen as 1.0 bar. I send 1.019 bars, which is stored as 1.0 bar. The differences in air pressure are normally not that big, so a lot of info is lost.

tigo72
Posts: 35
Joined: Friday 13 March 2015 10:19
Target OS: Linux
Domoticz version: Beta
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by tigo72 » Saturday 13 February 2016 20:33

Thanks to your examples I managed to scrape Temp, Humid, Pressure etc. data from the combined WU sensor using LUA scripts. Everything is displayed correctly in some virtual sensors I created, such as Outisde Temperature and Humidity. However, when I use these virtual sensors in Blocky, nothing happens. The built-in sensors for temp/humid/pressure work, but not those I created myself using the info in this thread.

I would like to use scraped wind data from WU (speed, gust, feelsliketemperature) in Blocky events. These individual sensors are not by default available in Domoticz. Again, I can create virtual sensors, they do display the correct values, but they do not trigger events. Is it possible to do this in Blocky?

stlaha2007
Posts: 437
Joined: Monday 05 October 2015 10:16
Target OS: -
Domoticz version:
Contact:

Re: RE: Re: Scraping only the temperature from WeatherUnderground se

Post by stlaha2007 » Tuesday 01 March 2016 0:56

I see that values are read correctly. I still see some weird behaviour of the pressure sensor. It only stores one decimal, everything between 0.95 and 1.05 bar is seen as 1.0 bar. I send 1.019 bars, which is stored as 1.0 bar. The differences in air pressure are normally not that big, so a lot of info is lost.
Ran into sumular problem with my own BME280. Adafruit script gives a presure of 1012.523 Domoticz showed 1012.5.
Problem with json-api is that it expects a single decimal and there rounds it up/down.

So 0.95 and 1.04 will go into as 1.0 bar.
I solved this by rounding to one decimal first before sending to domoticz.

Grtz,
Stephan

rednas
Posts: 120
Joined: Tuesday 20 October 2015 12:23
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by rednas » Tuesday 01 March 2016 22:15

You should use the barometer device! This device has a hPa (hecto Pascal) scale, so that would be exactly the values your Adafruit scripts gives you.
So change the device from pressure to barometer and don't convert it into bar and you're done!

nosehook
Posts: 22
Joined: Thursday 31 March 2016 20:49
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by nosehook » Tuesday 05 April 2016 23:28

I seem to have a small issue with the script:
2016-04-05 23:24:00.480 Error: EventSystem: in WU sensors7: [string "--Script To Parse WeatherUnderground Multi-Va..."]:17: attempt to index global 'devicechanged' (a nil value)

This line reads:
if devicechanged[sensorwu] then

I do not seem to be able to find out how to resolve this. The script does it's job, only I want to get rid of this error :?
B+ Domoticz | B+ OpenElec | Pi3 RetroPie | RFXcom 433E | 6 KAKU/COCO |
Harmony Hub | Panasonic TV | KODI (win) | YouLess | 4 x HS100 | VoxCommando (win) | Xiaomi gateway | sensors | scripts

User avatar
Westcott
Posts: 548
Joined: Tuesday 09 December 2014 18:04
Target OS: Raspberry Pi
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by Westcott » Tuesday 05 April 2016 23:42

Is it a 'time' script?
They don't access 'devicechanged'
Zwave - Sigma Z+ stick, Fibaro 2x FGSD002, FGMS001
Horstmann - 2x HRT4, 2x C-stat-11, 4x ASR-ZW, TKB 2x TZ56, 2x TZ68E
Max-EQ Cube, Valve, Neo 2x door
RFXtrx433E, RFlink - 1byone driveway, doorbell, Oregon and BangGood temp
Wifi - YeeLight RGB, 3x ESP8266

nosehook
Posts: 22
Joined: Thursday 31 March 2016 20:49
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by nosehook » Tuesday 05 April 2016 23:51

It is a modification of the previous posted code for the dummy sensors via Weather Underground. I do not think this is time based, only event based

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 sensorwu2 = 'Wind Utrecht FC'
local sensorwu = 'Temp Humidity Baro Utrecht ACT' --name of the sensor that gets created when you add the WU device (and that contains multiple values like temperature, humidity, barometer etc)
local idxt = 21 --idx of the virtual temperature sensor you need to change this to your own Device IDx
local idxh = 39 --idx of the virtual humidity sensor you need to change this to your own Device IDx
-- local idxp = 44 --idx of the virtual pressure sensor you need to change this to your own Device IDx
local idxb = 43 --idx of virtual barometer sensor you need to change this to your own Device IDx
-- local idxw = 28 --idx of virtual windsensor
local idxg = 45 --idx of gevoelstemperatuur

commandArray = {}

if devicechanged[sensorwu] then
    
        sWeatherTemp, sWeatherHumidity, sHumFeelsLike, sWeatherPressure, sWeatherPressureForecast = otherdevices_svalues[sensorwu]:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)")
        sWeatherTemp = tonumber(sWeatherTemp)
        sWeatherHumidity = tonumber(sWeatherHumidity)
        sHumFeelsLike = tonumber(sHumFeelsLike)
        sWeatherPressure = tonumber(sWeatherPressure) -- hPa
        -- sWeatherPressureBar = sWeatherPressure/1000 -- bar
        sWeatherPressureForecast = tonumber(sWeatherPressureForecast)
        
        -- parseDebug = ('WU Script Parsed Temperat=' .. sWeatherTemp)
        -- print(parseDebug)
        -- parseDebug = ('WU Script Parsed Humidity=' .. sWeatherHumidity)
        -- print(parseDebug)
        -- parseDebug = ('WU Script Parsed HumidityFeelsLike=' .. sHumFeelsLike)
        -- print(parseDebug)
        -- parseDebug = ('WU Script Parsed Pressure=' .. sWeatherPressure .. ' hPa')
        -- print(parseDebug)
        -- parseDebug = ('WU Script Parsed Pressure=' .. sWeatherPressureBar .. ' bar')
        -- print(parseDebug)
        -- parseDebug = ('WU Script Parsed PressureForecast=' .. sWeatherPressureForecast)
        -- print(parseDebug)
        
        if (sWeatherHumidity > 60 ) then
            verw = 3 -->60 = 3 wet
        elseif (sWeatherHumidity  < 25 ) then
            verw = 2 --<25 = 2 dry
        else
            verw = 1 -->=25 of <=60 = 1 comfortable
        end


        commandArray[1] = {['UpdateDevice'] = idxt .. '|0|' .. sWeatherTemp}
        commandArray[2] = {['UpdateDevice'] = idxh .. '|' .. tostring(sWeatherHumidity) .. '|' .. tostring(sHumFeelsLike)} -- .. '|' .. tostring(verw)}
        -- commandArray[3] = {['UpdateDevice'] = idxp .. '|0|' .. sWeatherPressureBar}
        commandArray[4] = {['UpdateDevice'] = idxb .. '|0|' .. sWeatherPressure .. ';' .. sWeatherPressureForecast}

elseif devicechanged[sensorwu2] then

        sWindDirectionDegrees, sWindDirection, sWindSpeed, sWindGust, sWindTemperature, sWindFeel = otherdevices_svalues[sensorwu2]: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

B+ Domoticz | B+ OpenElec | Pi3 RetroPie | RFXcom 433E | 6 KAKU/COCO |
Harmony Hub | Panasonic TV | KODI (win) | YouLess | 4 x HS100 | VoxCommando (win) | Xiaomi gateway | sensors | scripts

User avatar
Westcott
Posts: 548
Joined: Tuesday 09 December 2014 18:04
Target OS: Raspberry Pi
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by Westcott » Wednesday 06 April 2016 0:21

OK, what is its name. and where is it stored?
Zwave - Sigma Z+ stick, Fibaro 2x FGSD002, FGMS001
Horstmann - 2x HRT4, 2x C-stat-11, 4x ASR-ZW, TKB 2x TZ56, 2x TZ68E
Max-EQ Cube, Valve, Neo 2x door
RFXtrx433E, RFlink - 1byone driveway, doorbell, Oregon and BangGood temp
Wifi - YeeLight RGB, 3x ESP8266

nosehook
Posts: 22
Joined: Thursday 31 March 2016 20:49
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by nosehook » Wednesday 06 April 2016 11:33

Hi Westcott,

Appreciate the help!
It's name is WU sensors7. I created it via the webinterface of Domoticz, so I assume it is in the standard forlder/directory.
I am currently away and can not SSH into my Raspberry Pi..

I trailed the devicechanged in a different script too and that one gives an error too, the same one.

Does this help?
B+ Domoticz | B+ OpenElec | Pi3 RetroPie | RFXcom 433E | 6 KAKU/COCO |
Harmony Hub | Panasonic TV | KODI (win) | YouLess | 4 x HS100 | VoxCommando (win) | Xiaomi gateway | sensors | scripts

User avatar
Westcott
Posts: 548
Joined: Tuesday 09 December 2014 18:04
Target OS: Raspberry Pi
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by Westcott » Wednesday 06 April 2016 11:49

Ah - I actually meant what is the script's name, and where is it stored?
Zwave - Sigma Z+ stick, Fibaro 2x FGSD002, FGMS001
Horstmann - 2x HRT4, 2x C-stat-11, 4x ASR-ZW, TKB 2x TZ56, 2x TZ68E
Max-EQ Cube, Valve, Neo 2x door
RFXtrx433E, RFlink - 1byone driveway, doorbell, Oregon and BangGood temp
Wifi - YeeLight RGB, 3x ESP8266

nosehook
Posts: 22
Joined: Thursday 31 March 2016 20:49
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by nosehook » Friday 08 April 2016 10:42

The issue is resolved, I disabled the script I made in the webinterface and created one in the folder.
No more errors!
Thanks for the help.
B+ Domoticz | B+ OpenElec | Pi3 RetroPie | RFXcom 433E | 6 KAKU/COCO |
Harmony Hub | Panasonic TV | KODI (win) | YouLess | 4 x HS100 | VoxCommando (win) | Xiaomi gateway | sensors | scripts

wergeld
Posts: 15
Joined: Friday 01 January 2016 0:29
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by wergeld » Friday 06 May 2016 0:34

I have been trying to do this for a couple of days of an on. I have my script taken from:
https://www.domoticz.com/wiki/Virtual_weather_devices

I have set my sensorwu to my WU's name and created the virtual device to hold the temp. I have the script in domiticz/scritps/lua. However, the script does not get run. No messages in log (error or otherwise) regarding it and no updates to the virtual device's value. I have even allowed the debug output in the script and nothing. I know I have to missing something but I am not sure what.

Here is my script:

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 = 'WUHudson' --name of the sensor that gets created when you add the WU device (and that contains multiple values like temperature, humidity, barometer etc)
local idxt = 18 --idx of the virtual temperature sensor you need to change this to your own Device IDx
--local idxh = 999 --idx of the virtual humidity sensor you need to change this to your own Device IDx
--local idxp = 999 --idx of the virtual pressure sensor you need to change this to your own Device IDx
--
 
commandArray = {}
 
if devicechanged[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|' .. sWeatherTemp}
        --commandArray[2] = {['UpdateDevice'] = idxh .. '|' .. tostring(sWeatherHumidity) .. '|' .. tostring(sHumFeelsLike)}
        --commandArray[3] = {['UpdateDevice'] = idxp .. '|0|' .. tostring(sWeatherPressure) .. ';' .. tostring(sWeatherPressForcast)}
end
 
return commandArray

jonkjon
Posts: 10
Joined: Tuesday 10 May 2016 23:37
Target OS: Linux
Domoticz version:
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by jonkjon » Tuesday 10 May 2016 23:39

Ditto here....I have tried all of the scripts here and it just never runs....

jonkjon
Posts: 10
Joined: Tuesday 10 May 2016 23:37
Target OS: Linux
Domoticz version:
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by jonkjon » Wednesday 11 May 2016 3:24

I got this sorted. As usual, it was my error of course as I was putting the name of the hardware device and not the name of the sensor that contained the data.....

--Jon

wergeld
Posts: 15
Joined: Friday 01 January 2016 0:29
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by wergeld » Thursday 12 May 2016 2:10

So finally got this to work starting off with un-modded script and filling in my values. It worked! Beautifully!

For about three hours. Now it constantly throws:

Code: Select all

script_device_sensorWU.lua:19: attempt to concatenate global 'sWeatherPressure' (a nil value)
Turns out that is the debug output line. So I have commented that out. Now I get an error on line 22:
commandArray[1] = {['UpdateDevice'] = idxt .. '|0|' .. sWeatherTemp}
Saying that sWeatherTemp is nil. Except, just above it I am printing out what the WU device is sending. Under events it should be something like:

Code: Select all

25.8;75;3;1020;2
My debug is output is just:

Code: Select all

22.1
So...huh? This is the last value sent to my virtual temp-only device. I am really confused here.

jonkjon
Posts: 10
Joined: Tuesday 10 May 2016 23:37
Target OS: Linux
Domoticz version:
Contact:

Re: Scraping only the temperature from WeatherUnderground sensor

Post by jonkjon » Friday 13 May 2016 22:41

Is there some way to increase the number of decimal places for rainfall? It defaults to "0.0 mm". It would be nice to be able to convert rain to inches in Domoticz directly but that doesn't seem to be an option. Today my WU site recorded .01 inches rain (.254 mm) but the rain device still shows "0.0 mm". Not sure what's up with that....

--Jon

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests