Just fighting a bit with Domoticz and Weather Underground. Was able to setup WU properly according to wiki, now I wanted to grab only the temperature, because I need temp only for some scripts. So I setup the script described also in wiki (https://www.domoticz.com/wiki/Virtual_w ... emperature), but I don't get it working. Have changed the first both vars of the script according to my setup and uncommented the debug part:
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, barometer etc)
local idxt = 124 --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


The Script is placed under ~/domoticz/scripts/lua/script_device_wu.lua, based on the logs, it seems that the script will not be triggered:
Code: Select all
2018-04-02 12:45:37.234 (Weather Underground) Temp + Humidity + Baro (WU-THB)
2018-04-02 12:45:37.236 (Weather Underground) Wind (Unknown)
2018-04-02 12:45:37.238 (Weather Underground) UV (UV)
2018-04-02 12:45:37.241 (Weather Underground) Rain (Unknown)
2018-04-02 12:45:37.243 (Weather Underground) General/Solar Radiation (Unknown)
2018-04-02 12:55:37.724 (Weather Underground) Temp + Humidity + Baro (WU-THB)
2018-04-02 12:55:37.726 (Weather Underground) Wind (Unknown)
2018-04-02 12:55:37.728 (Weather Underground) UV (UV)
2018-04-02 12:55:37.730 (Weather Underground) Rain (Unknown)
2018-04-02 12:55:37.732 (Weather Underground) General/Solar Radiation (Unknown)