Scraping only temperature from DarkSky

Moderator: leecollings

Post Reply
Qcvictor
Posts: 22
Joined: Wednesday 08 April 2015 3:13
Target OS: Linux
Domoticz version: Beta
Location: Canada
Contact:

Scraping only temperature from DarkSky

Post by Qcvictor »

Hi Guys
I'm trying to get only the temperature in an virtual temperature sensor from DarkSky, I use the script found here https://www.domoticz.com/wiki/Virtual_weather_devices unfortunately doesn't work
I get

Code: Select all

 Error: EventSystem: in TempDarkSky: [string "--Script To Parse WeatherUnderground Multi-Va..."]:14: attempt to index global 'devicechanged' (a nil value)
Where the line said

Code: Select all

if devicechanged[sensorwu] then
I imagine I have to change "sensorwu" !
Any clue
Qcvictor
Posts: 22
Joined: Wednesday 08 April 2015 3:13
Target OS: Linux
Domoticz version: Beta
Location: Canada
Contact:

Re: Scraping only temperature from DarkSky

Post by Qcvictor »

Reply to me:
Finally I use this script:

Code: Select all

local sensorwu = 'THB' --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 = 76 --idx of the virtual temperature sensor you need to change this to your own Device IDx
 
commandArray = {}
 
if devicechanged[sensorwu] then
        sWeatherTemp, sWeatherHumidity = otherdevices_svalues[sensorwu]:match("([^;]+);([^;]+);([^;]+)")
        sWeatherTemp = tonumber(sWeatherTemp)
         
        commandArray[1] = {['UpdateDevice'] = idxt .. '|0|' .. sWeatherTemp}
        end
 
return commandArray
execute as "device" and look like working..
Post Reply

Who is online

Users browsing this forum: Amazon [Bot] and 1 guest