Page 3 of 4

Re: Scraping only the temperature from WeatherUnderground se

Posted: Wednesday 12 August 2015 10:57
by dpons039
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.

Re: Scraping only the temperature from WeatherUnderground se

Posted: Saturday 03 October 2015 14:41
by Sandman79
just a question: is it also possible to log the dew point using the weatherunderground 'sensor' ? :)

Re: Scraping only the temperature from WeatherUnderground se

Posted: Wednesday 11 November 2015 22:51
by rednas
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?

Re: Scraping only the temperature from WeatherUnderground se

Posted: Tuesday 24 November 2015 21:30
by rednas
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?

Re: Scraping only the temperature from WeatherUnderground se

Posted: Monday 21 December 2015 11:48
by mrblond18
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.

Re: Scraping only the temperature from WeatherUnderground sensor

Posted: Saturday 13 February 2016 19:33
by tigo72
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?

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

Posted: Monday 29 February 2016 23:56
by stlaha2007
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

Re: Scraping only the temperature from WeatherUnderground sensor

Posted: Tuesday 01 March 2016 21:15
by rednas
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!

Re: Scraping only the temperature from WeatherUnderground sensor

Posted: Tuesday 05 April 2016 23:28
by nosehook
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 :?

Re: Scraping only the temperature from WeatherUnderground sensor

Posted: Tuesday 05 April 2016 23:42
by Westcott
Is it a 'time' script?
They don't access 'devicechanged'

Re: Scraping only the temperature from WeatherUnderground sensor

Posted: Tuesday 05 April 2016 23:51
by nosehook
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


Re: Scraping only the temperature from WeatherUnderground sensor

Posted: Wednesday 06 April 2016 0:21
by Westcott
OK, what is its name. and where is it stored?

Re: Scraping only the temperature from WeatherUnderground sensor

Posted: Wednesday 06 April 2016 11:33
by nosehook
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?

Re: Scraping only the temperature from WeatherUnderground sensor

Posted: Wednesday 06 April 2016 11:49
by Westcott
Ah - I actually meant what is the script's name, and where is it stored?

Re: Scraping only the temperature from WeatherUnderground sensor

Posted: Friday 08 April 2016 10:42
by nosehook
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.

Re: Scraping only the temperature from WeatherUnderground sensor

Posted: Friday 06 May 2016 0:34
by wergeld
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

Re: Scraping only the temperature from WeatherUnderground sensor

Posted: Tuesday 10 May 2016 23:39
by jonkjon
Ditto here....I have tried all of the scripts here and it just never runs....

Re: Scraping only the temperature from WeatherUnderground sensor

Posted: Wednesday 11 May 2016 3:24
by jonkjon
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

Re: Scraping only the temperature from WeatherUnderground sensor

Posted: Thursday 12 May 2016 2:10
by wergeld
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.

Re: Scraping only the temperature from WeatherUnderground sensor

Posted: Friday 13 May 2016 22:41
by jonkjon
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