virtual lux octa value

Post Reply
tiga
Posts: 70
Joined: Friday 27 May 2016 20:15
Target OS: Raspberry Pi
Domoticz version:
Location: nederland
Contact:

virtual lux octa value

Post by tiga » Saturday 17 February 2018 12:48

hello i use the virtual lux script and i want to use the octa value for other scripts.
i made a virtual switch that shows the cloud layer.
but i noticed it gets updated only once every hour.
i want it to be updated lets say every 15 minutes.
i beleive this is the part in the virtual lux script that does a octa request every hour, but i am not sure how to change it in 15 minutes.

Code: Select all

       -- Get  SYNOP  message from  Ogimet web  site
       hourUTCminus1 = os.date("!%H")-1
       if string.len(hourUTCminus1) == 1 then
          hourUTCminus1 = "0" .. hourUTCminus1
       end
       UTC = os.date("%Y%m%d").. hourUTCminus1.."00" -- os.date("!%M")
       if (DEBUG == 1) then
          local WMOID = jsonLocation.current_observation.display_location.wmo
       end
 
       cmd='curl "http://www.ogimet.com/cgi-bin/getsynop?block='..WMOID..'&begin='..UTC..'"'
       if( DEBUG == 1) then print(cmd) end
       local ogimet=assert(io.popen(cmd))
       local synop = ogimet:read('*all')
       ogimet:close()
       if( DEBUG == 1) then print('ogimet:'..synop) end
 
       if string.find(synop,"Status: 500") == nil
       then   
          rslt = split(synop,",")
          CodeStation = rslt[1]
          rslt = split(synop, " "..CodeStation.. " ")
          Trame = string.gsub(rslt[2], "=", "")
          Trame = CodeStation .." ".. Trame
          rslt = split(Trame, " ")
          Octa = string.sub(rslt[3], 1, 1)  -- 3rd char is the cloud layer.  0=no cloud , 1-8= cloudy from 1 to 8 max , 9 =Fog , / = no data
          if Octa == "/" then   -- not defined ? take the previous value
             Octa = uservariables['octa']
          elseif Octa == "9" then
             Octa = 8
          end
       else
          Octa = uservariables['octa']
       end

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests