Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- %% properties
- 299 value
- %% globals
- --]]
- local z_weather = 299
- if (tonumber(fibaro:getValue(z_weather, "value")) > 0) then
- fibaro:debug('Z-Weather-Szene gestartet - ' ..os.date("%c"))
- if (tonumber(fibaro:getGlobalValue('time_past')) == 0) then
- fibaro:debug('Noch kein Wert in die Variable geschrieben - Wird automatisch angelegt.')
- fibaro:setGlobal('time_past', os.time()-900)
- end
- local time_past = fibaro:getGlobal('time_past')
- local last_run = (os.time() - time_past)/60
- fibaro:debug('Letzter Lauf der Szene vor ' ..math.floor(last_run).. ' min.')
- fibaro:debug('Pulsecount Z-Weather: ' ..fibaro:getValue(z_weather, "value"))
- multi = 1
- if (last_run < 60) then
- while last_run < 60 do
- multi = multi + 1
- last_run = last_run + last_run
- end
- local speed = math.floor((fibaro:getValue(z_weather, "value")*7.53984)*multi)
- else
- fibaro:debug('Z-Weather ist im Stromsparmodus; Daten werden nicht mehr zeitnah übermittelt...')
- local speed = math.floor((fibaro:getValue(z_weather, "value")*7.53984)/(last_run/2))
- end
- fibaro:call(z_weather, "reset")
- fibaro:debug('Berechnete Windgeschwindigkeit: ' ..(speed/100).. ' km/h')
- fibaro:debug('Pulsecount resettet.')
- end
- fibaro:setGlobal('time_past', tostring(os.time()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement