Page 1 of 1

[FIXED] OWM temperature to dummy device

Posted: Sunday 25 April 2021 12:58
by HansieNL
I'm using a dummy temperature sensor which data is retrieved from the OWM TempHumBaro device. I use a LUA script, but that doesn't fill the dummy with data anymore. Looks like it stopped working after update to 2021.1.
Can someone tell me how to get the data to virtual temperature sensor again?
Thanks in advance.

EDIT: Sensor is updating now with the script as posted.

Code: Select all

local sensorwu = 'TempHumBaro'	--Device name of the Open Weather Map sensor
local idxt = 354	--Idx of the virtual temperature sensor
 
commandArray = {}
 
if devicechanged[sensorwu] then
	sTemp, sHumidity, sNull, sBarometer, sNull = otherdevices_svalues[sensorwu]:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)")	
	sTemp = tonumber(sTemp)
	parseDebug = ('(Open Weather Map) Buitentemperatuur ' .. sTemp .. ' C')
	print(parseDebug)
 
        commandArray ['UpdateDevice'] = idxt.. '|0|' ..sTemp
end
 
return commandArray