
Above are virtual devices i got when i added the wunderground hardware.
I tried 3 different stations in my neighborhood, but they all put the data in one device like this.
How can i get outside temperature in one device?
Moderator: leecollings
Code: Select all
--script_device_tempWU.lua
local sensorwu = 'sensor' --sensor of wunderground
local tempsensor = 'temp' --virtual temp sensor of wunderground
local idx = 68 --idx of your virtual temp sensor of wunderground
commandArray = {}
if (otherdevices_lastupdate[sensorwu]) then
sWeatherTemp, sWeatherHumidity, sWeatherPressure = otherdevices_svalues[sensorwu]:match("([^;]+);([^;]+);([^;]+)")
sWeatherTemp = tonumber(sWeatherTemp)
commandArray['UpdateDevice'] = idx .. '|0|' .. tostring(sWeatherTemp)
end
return commandArray
I never used thatThinkPad wrote:Hey thanks!
But can you help me a little bit more?
I found out how to create a virtual temp sensor:
/json.htm?type=createvirtualsensor&idx=XX&sensortype=80
(XX is the IDX i have chosen, looked what the current highest IDX was and did that +1) 80 stands for temperature only.
YesThinkPad wrote:But what to do now? I put the script in /home/pi/domoticz/scripts/lua/. I put in the IDX.
Do i need to change anything else? ('sensorwu' and 'tempsensor' ?)
And what do you mean by: "add the first line to device" ?
It's still not very clear what to put in the "sensorwu"ThinkPad wrote:User 'nickyb2' did a few small modifications to the script, so it now runs as soon as the sensor from WU is updated. This instead of the version i had before, where it would run every 10 minutes. In the worst case the script could lag behind so the data in the virtual_temp sensor would be 19 minutes old. It is now instaneously updated as soon as the WU sensor is updated.
http://www.domoticz.com/wiki/Virtual_we ... emperature
Code: Select all
--script_device_tempWU.lua
local sensorwu = 'WeatherUnderground' --Original sensor of wunderground carrying the 0001 ID
local tempsensor = 'temp' --virtual temp sensor of wunderground (don't touch)
local idx = 157 --idx of your manual created virtual temp sensor
commandArray = {}
if devicechanged[sensorwu] then
sWeatherTemp, sWeatherHumidity, sWeatherPressure = otherdevices_svalues[sensorwu]:match("([^;]+);([^;]+);([^;]+)")
sWeatherTemp = tonumber(sWeatherTemp)
commandArray['UpdateDevice'] = idx .. '|0|' .. tostring(sWeatherTemp)
end
return commandArray
Code: Select all
local sensorwu = 'Buitentemperatuur' --sensor from wunderground
local idx = 102 --idx of your virtual temp sensor of wunderground
commandArray = {}
if devicechanged[sensorwu] then
sWeatherTemp, sWeatherHumidity, sWeatherPressure = otherdevices_svalues[sensorwu]:match("([^;]+);([^;]+);([^;]+)")
sWeatherTemp = tonumber(sWeatherTemp)
commandArray['UpdateDevice'] = idx .. '|0|' .. tostring(sWeatherTemp)
end
return commandArray
Code: Select all
local sensorwu = 'wx' --name of the sensor that gets created when you add the WU device (and that contains multiple values like temperature, humidity, barometer etc)
local idx = 21 --idx of the virtual temperature sensor you created above
commandArray = {}
if devicechanged[sensorwu] then
sWeatherTemp, sWeatherHumidity, sWeatherPressure = otherdevices_svalues[sensorwu]:match("([^;]+);([^;]+);([^;]+)")
sWeatherTemp = tonumber(sWeatherTemp)
commandArray['newtemp'] = idx .. '|27|' .. tostring(sWeatherTemp)
end
return commandArray
Code: Select all
local idx = 21
Code: Select all
local sensorwu = 'Buitentemperatuur' --sensor from wunderground
local idx = 102 --idx of your virtual temp sensor of wunderground
commandArray = {}
if devicechanged[sensorwu] then
sWeatherTemp, sWeatherHumidity, sWeatherPressure = otherdevices_svalues[sensorwu]:match("([^;]+);([^;]+);([^;]+)")
sWeatherTemp = tonumber(sWeatherTemp)
commandArray['UpdateDevice'] = idx .. '|0|' .. tostring(sWeatherTemp)
end
return commandArray
Code: Select all
commandArray['UpdateDevice'] = idx .. '|0|' .. tostring(sWeatherTemp)
Code: Select all
commandArray['newtemp'] = idx .. '|27|' .. tostring(sWeatherTemp)
Code: Select all
commandArray['UpdateDevice'] = idx .. '|0|' .. tostring(sWeatherTemp)
Users browsing this forum: No registered users and 1 guest