Perhaps you first have to separately extract Temp and Humidity from the DHT-set of 3 svalues.
Have myself a simple stepwise script along that line operating on output of a meteo-sensor which provides 4 svalues.
Following is an extract from that lua-script of those segments relevant for you.
In practise I have made 2 scripts, tuned to the designated line for the OLED: one for Temp, one for Humidity
Below you see the version valid/active for Temp, to be tuned for your configuration and application.
Code: Select all
-- Lua-script for info-upload to ESP8266 with OLED SS1306
-- (c)2017 Toulon7559 rev. 01
-- Definition of function(s) and Setting of references
function round(num, dec)
if num == 0 then
return 0
else
local mult = 10^(dec or 0)
return math.floor(num * mult + 0.5) / mult
end
end
baseurl = "http://192.168.x.y/control?cmd=oled"
-- Call Meteo-info from Domoticz-database
Binnen_Temp_RV_Baro = 'WS7000_Temp_RV_Baro'
sTemp, sRV, sComfort, sBaro = otherdevices_svalues[Binnen_Temp_RV_Baro]:match("([^;]+);([^;]+);([^;]+);([^;]+)")
sTemp = round(tonumber(sTemp),1);
print ('Temp = '.. sTemp)
-- sRV = round(tonumber(sRV),1);
-- print ('RV = '.. sRV)
-- sComfort = tonumber(sComfort);
-- print ('Comfort = '.. sComfort)
-- sBaro = tonumber(sBaro);
-- print ('Baro = '.. sBaro)
UploadURL0A = baseurl .. ",3,1,T=".. sTemp .."C"
-- UploadURL0B = baseurl .. ",4,1,V=".. sRV .."%"
-- Perform upload
commandArray = {}
commandArray['OpenURL']= UploadURL0A
-- commandArray['OpenURL']= UploadURL0B
return commandArray