Hej Hasse
Din hash ser lite knepig, det har smygit in <> tecken, ta bort dom.
http://www.temperatur.nu/rapportera.php ... 6328329&t=
mattsjo skrev: ↑01 sep 2013, 23:16 Jag har ett (eventuellt) enklare sätt att rapportera temperatur...
Jag har två tempsensorer, en som heter Ute och den andra som heter UteVP. Tror att det är ganska enkelt att se hur man ska ändra om man bara har en sensor.
Följande script heter script_time_reporttemp.lua och ligger i /home/pi/domoticz/scripts/lua på min Raspberry:
Ska någon använda detta script måste givetvis <hash> ovan bytas ut mot den hash som gäller för den station som ska födas med data... Skriptet körs en gång per minut.Kod: Markera allt
-- Script to report temperature to temperatur.nu commandArray = {} if (otherdevices_temperature['Ute'] <= otherdevices_temperature['UteVP']) then commandArray['OpenURL']='http://www.temperatur.nu/rapportera.php?hash=<hash>&t=' .. string.format("%.2f", otherdevices_temperature['Ute']) else commandArray['OpenURL']='http://www.temperatur.nu/rapportera.php?hash=<hash>&t=' .. string.format("%.2f", otherdevices_temperature['UteVP']) end return commandArray
Kod: Markera allt
-- Script to report temperature to temperatur.nu
commandArray = {}
if (otherdevices_temperature['Utomhustemperatur-Syd'] or otherdevices_temperature['Utomhustemperatur-Nord'] <= otherdevices_temperature['FTX Uteluft (GT1)'] ) then
commandArray['OpenURL']='http://www.temperatur.nu/rapportera.php?hash==' .. string.format("%.2f", otherdevices_temperature['Utomhustemperatur-Syd'])
else
commandArray['OpenURL']='http://www.temperatur.nu/rapportera.php?hash==' .. string.format("%.2f", otherdevices_temperature['Utomhustemperatur-Nord'])
elseif
commandArray['OpenURL']='http://www.temperatur.nu/rapportera.php?hash==' .. string.format("%.2f", otherdevices_temperature['FTX Uteluft (GT1)'])
end
return commandArray
HejTheeDude skrev: ↑03 sep 2021, 23:38 Hej, gammal tråd det här, men jag provar ändå.
Har kört med ditt script i ett antal år, och det har fungerat utan bekymmer!
Men enheten som skickar mina temperaturvärden racklar en del (jäkla fibaro)
Så, jag har installerat ytterligare en tempsensor till mitt FTX aggregat på uteluften.
Försökte då få till i lua så den jämför 3 olika värden, men där gick jag bet!
Gjorde något i stil med detta, och har provat lite olika varianter, men inget av det verkar bringa mig någon lycka.
Någon som vill hjälpa mig i rätt riktning?
Kod: Markera allt
-- Script to report temperature to temperatur.nu commandArray = {} if (otherdevices_temperature['Utomhustemperatur-Syd'] or otherdevices_temperature['Utomhustemperatur-Nord'] <= otherdevices_temperature['FTX Uteluft (GT1)'] ) then commandArray['OpenURL']='http://www.temperatur.nu/rapportera.php?hash==' .. string.format("%.2f", otherdevices_temperature['Utomhustemperatur-Syd']) else commandArray['OpenURL']='http://www.temperatur.nu/rapportera.php?hash==' .. string.format("%.2f", otherdevices_temperature['Utomhustemperatur-Nord']) elseif commandArray['OpenURL']='http://www.temperatur.nu/rapportera.php?hash==' .. string.format("%.2f", otherdevices_temperature['FTX Uteluft (GT1)']) end return commandArray
Kod: Markera allt
--- tijdverschil bepalen sinds laatste schakeling in sec
function timedifference (s)
if s == nil then print("Error ") end
year = string.sub(s, 1, 4)
month = string.sub(s, 6, 7)
day = string.sub(s, 9, 10)
hour = string.sub(s, 12, 13)
minutes = string.sub(s, 15, 16)
seconds = string.sub(s, 18, 19)
t1 = os.time()
t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
difference = (os.difftime (t1, t2))
return difference
end
Kod: Markera allt
aqMeterName = 'Baksida'
tempBaksida = otherdevices_svalues[aqMeterName]
updaBaksida = otherdevices_lastupdate[aqMeterName]
aqTradgard = 'Tradgard'
tempTradgard,humiTradgard,otherTradgard = otherdevices_svalues[aqTradgard]:match("([^;]+);([^;]+);([^;]+)")
updaTradgard = otherdevices_lastupdate[aqTradgard]
aqFramsida = 'Framsida'
tempFramsida = otherdevices_svalues[aqFramsida]
updaFramsida = otherdevices_lastupdate[aqFramsida]
Kod: Markera allt
commandArray = {}
if devicechanged[aqMeterName] then
timeNow = os.date("%Y-%m-%d %H:%M:%S")
year = tonumber(os.date("%Y"))
month = tonumber(os.date("%m"))
day = tonumber(os.date("%d"))
hour = tonumber(os.date("%H"))
min = tonumber(os.date("%M"))
sec = tonumber(os.date("%S"))
timeValue = hour * 60 + min
local minTemperature = tonumber(tempTradgard)
local tempInput = 'tradgard'
diffFramsida = timedifference(updaFramsida)
if diffFramsida < 600 then
if tonumber(tempFramsida) < minTemperature then
minTemperature = tonumber(tempFramsida)
tempInput = 'framsida'
end
end
if tonumber(tempBaksida) < minTemperature then
minTemperature = tonumber(tempBaksida)
tempInput = 'baksida'
end