Page 3 of 16

Re: Is it gonna rain within the next X minutes?

Posted: Sunday 31 May 2015 23:32
by Brutus
markk wrote:
tlpeter wrote:Hi Hans i know, that is the problem :mrgreen:
I use a different script now and i have it working.
But thanks anyway.
Hi Tlpeter

Would you mind sharing your windows script please?

Thanks
Mark
Yeah please ;) Also a Windows user. Have ordered screens but the fibaro module is already installed. So I have al the time preparing the windows script for it.

Re: Is it gonna rain within the next X minutes?

Posted: Wednesday 03 June 2015 16:09
by Luuc_a
I have taken the script of tlpeter and made it to my needs.
I have done the following
- Integrate the script with the rain prediction of 'buienradar'.
- made user variables from the thresholds in Domoticz so I can control it from the web interface.

Code: Select all

-----------------------------------------------------------------------------
-- LUA Script
-- Extract values from Weather Underground device and 'Buienradar'-rain 
-- prediction to control the sunscreen
-- Auteur: Luuc_A
-- Datum : 29-05-2014
-----------------------------------------------------------------------------
-- Setup uservariables:
--   1) Weather_Debug          			= String = True / False
--   2) Weather_WindSpeedThreshold		= integer
--   3) Weather_WindGustThreshold		= integer
--   4) Weather_RainThreshold			= integer
--   5) Weather_UVThreshold				= integer
--   6) Weather_TempThreshold			= integer
-- Create Switches:
--   1) Regen             				= Dummy Humiditysensor
--   2) WindSnelheid      				= Dummy Text
--   3) WindRichting      				= Dummy Text
--	 4) Barometer		  				= Weather Underground/Forecast IO
--	 5) Wind			  				= Weather Underground/Forecast IO
--	 6) Regen			  				= Weather Underground/Forecast IO
--   7) Zon				  				= Weather Underground/Forecast IO
--   8) Zonnescherm		  				= Up/Down switch
--   9) Zonnescherm manual override		= Dummy switch
-----------------------------------------------------------------------------
commandArray = {}
------------------------------------------------------------------------
-- Variabelen
lat='52.025526'   -- example lat/lon for Gouda
lon='4.692806'
sDebug = tostring(uservariables["Weather_Debug"])
UVThreshold = uservariables["Weather_UVThreshold"]
WindSpeedThreshold = uservariables["Weather_WindSpeedThreshold"]
WindGustThreshold = uservariables["Weather_WindGustThreshold"]
RainThreshold = uservariables["Weather_RainThreshold"]
TempThreshold = uservariables["Weather_TempThreshold"]
tempfilename = '/var/tmp/rain.tmp' -- can be anywhere writeable
idx = 220  --idx regen
idx2 = 221 -- idx windrichting
idx3 = 222 -- idx windsnelheid
minuten = 5
sBarometer = 'Barometer Gouda' 
sWind = 'Wind Gouda'
sRain = 'Regen Gouda'
sUV = 'UV Gouda'
sSolar = 'Zon Gouda'
------------------------------------------------------------------------

--Sunscreen thresholds:
        -- Windspeed            = 100.0 (value is multiplied by 100)
        -- Rain                 =  0.0
        -- UV                   =  2.0
        -- Temperature          = 12.0
        -- Closed       = Down  = On
        -- Open         = Up    = Off

------------------------------------------------------------------------

-- Functies
function Message(fMessage, fDebug)
        if (fDebug == "True") then
                print("Weather: " .. fMessage)
        end
end

function Notification(fNotification, fDebug)
	if (fDebug == "False") then
	    commandArray['SendNotification'] = "" .. fNotification .. ""
	end
end

function IsItGonnaRain( minutesinfuture )
   url='http://gps.buienradar.nl/getrr.php?lat='..lat..'&lon='..lon
   Message("-- "..url,sDebug)
   read = os.execute('curl -s -o '..tempfilename..' "'..url..'"')
   file = io.open(tempfilename, "r")
   totalrain=0
   rainlines=0
   -- now analyse the received lines, format is like 000|15:30 per line.
   while true do 
      line = file:read("*line")
      if not line then break end
      Message("-- Line:" ..line,sDebug)
      linetime=string.sub(tostring(line), 5, 9)
	  Message("-- Linetime: "..linetime,sDebug)
         
         -- Linetime2 holds the full date calculated from the time on a line
         linetime2 = os.time{year=os.date('%Y'), month=os.date('%m'), day=os.date('%d'), hour=string.sub(linetime,1,2), min=string.sub(linetime,4,5), sec=os.date('%S')}
         difference = os.difftime (linetime2,os.time())
   
      -- When a line entry has a time in the future AND is in the given range, then totalize the rainfall
      if ((difference > 0) and (difference<=minutesinfuture*60)) then
         Message("-- Line in time range found",sDebug)
		 rain=tonumber(string.sub(tostring(line), 0, 3))
         totalrain = totalrain+rain
         rainlines=rainlines+1
         Message("-- Rain in timerange: "..rain,sDebug)
		 Message("-- Total rain now: "..totalrain,sDebug)
      end
   
   end
   file:close()
   averagerain=totalrain/rainlines
   
return(averagerain)
end

	regen = IsItGonnaRain(minuten)
	Message("-- Regen verwacht: "..regen.." binnen "..minuten.." minuten.",sDebug)
	if (regen > 0  ) then verw = 3 else verw = 2 end
	
	--Weatherstation data:
	sWeatherTemp, sWeatherHumidity, sWeatherUV, sWeatherPressure, sWeatherUV2 = otherdevices_svalues[sBarometer]:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)")
	sWeatherTemp = tonumber(sWeatherTemp);
	sWeatherHumidity = tonumber(sWeatherHumidity);
	sWeatherPressure = tonumber(sWeatherPressure);
	sWeatherUV = tonumber(sWeatherUV);
	sWeatherUV2 = tonumber(sWeatherUV2);
	Message("______________________________________________________________________________________",sDebug)
	Message("Weather station: Temperature is " .. sWeatherTemp .. " ",sDebug)
	Message("Weather station: Humidity is " .. sWeatherHumidity .. " ",sDebug)
	Message("Weather station: Pressure is " .. sWeatherPressure .. " ",sDebug)
	Message("Weather station: UV is " .. sWeatherUV .. " ",sDebug)
	Message("Weather station: UV2 is " .. sWeatherUV2 .. " ",sDebug)
	Message("______________________________________________________________________________________",sDebug)
	
	------------------------------------------------------------------------

	--Windmeter data:
	sWindDirectionDegrees, sWindDirection, sWindSpeed, sWindGust, sWindTemperature, sWindFeel = otherdevices_svalues[sWind]:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)")

	sWindDirectionDegrees = tonumber(sWindDirectionDegrees);
	sWindDirection = (sWindDirection);
	sWindSpeed = tonumber(sWindSpeed);
	sWindGust = tonumber(sWindGust);
	sWindTemperature = tonumber(sWindTemperature);
	sWindFeel = tonumber(sWindFeel);

	Message("______________________________________________________________________________________",sDebug)
	Message("Windmeter: Winddirection (in degrees) is: " .. sWindDirectionDegrees .. " ",sDebug)
	Message("Windmeter: Winddirection is: " .. sWindDirection .. " ",sDebug)
	Message("Windmeter: Windspeed is: " .. sWindSpeed .. " ",sDebug)
	Message("Windmeter: Windgust is: " .. sWindGust .. " ",sDebug)
	Message("Windmeter: Windtemperature is: " .. sWindTemperature .. " ",sDebug)
	Message("Windmeter: Windfeel is: " .. sWindFeel .. " ",sDebug)
	Message("______________________________________________________________________________________")

	------------------------------------------------------------------------

	--Rainmeter data:
	sRainmeterCurrent, sRainmeterTotal = otherdevices_svalues[sRain]:match("([^;]+);([^;]+)")
	
	sRainmeterCurrent = tonumber(sRainmeterCurrent);
	sRainmeterTotal = tonumber(sRainmeterTotal);
	
	Message("______________________________________________________________________________________",sDebug)
	Message("Rainmeter: Actual rain is: " .. sRainmeterCurrent .. " ",sDebug)
	Message("Rainmeter: Total rain is: " .. sRainmeterTotal .. " ",sDebug)
	Message("Rainmeter: Predicted rain is: " .. regen .. " ",sDebug)
	Message("______________________________________________________________________________________",sDebug)
	------------------------------------------------------------------------

	--UV data:
	sUV = otherdevices_svalues[sUV]:match("([^;]+)")
	sSolar = otherdevices_svalues[sSolar]:match("([^;]+)")
	
	sUV = tonumber(sUV);
	sSolar = tonumber(sSolar);

	Message("UV: UV Strength is: " .. sUV .." ",sDebug)
	Message("UV: Solar radiation is: " .. sSolar .." ",sDebug)
	
	--Thresholds:
	Message("______________________________________________________________________________________",sDebug)
	Message("Thresholds: Temp threshold is: " .. TempThreshold .." ",sDebug)
	Message("Thresholds: UV threshold is: " .. UVThreshold .." ",sDebug)
	Message("Thresholds: WindSpeed threshold is: " .. WindSpeedThreshold .." ",sDebug)
	Message("Thresholds: WindGust threshold is: " .. WindGustThreshold .." ",sDebug)
	Message("Thresholds: Rain threshold is: " .. RainThreshold .." ",sDebug)
	Message("______________________________________________________________________________________",sDebug)
	
	if (timeofday['Daytime']) then
        Message('It is past sunrise, monitoring variables for sunscreen',sDebug)
        if (otherdevices['Zonnescherm'] == 'Open' ) then
            Message ('Sunscreen is up',sDebug)
        else
            Message ('Sunscreen is down',sDebug)
		end
		if (otherdevices['Zonnescherm']   == 'Open'
			and sRainmeterCurrent   == RainThreshold
			and sWeatherTemp        > TempThreshold
			and sUV            		> UVThreshold
			and sWindSpeed          < WindSpeedThreshold
			and sWindGust           < WindGustThreshold)
		then
			Message ('Sun is shining, all thresholds OK, lowering sunscreen',sDebug)
			Message('______________________________________________________________________________________',sDebug)
			Notification('Sunscreen#Sunscreen down --> Sun is shining',sDebug)
			commandArray['Zonnescherm']='On'
		elseif (otherdevices['Zonnescherm'] == 'Closed' and (sRainmeterCurrent > RainThreshold or regen > 0)) then
            Message ('It is raining, raising sunscreen')
            Message('______________________________________________________________________________________',sDebug)
            Notification('Sunscreen#Sunscreen up --> It is raining',sDebug)
            commandArray['Zonnescherm']='Off'
        elseif (otherdevices['Zonnescherm'] == 'Closed' and sWeatherTemp < TempThreshold and otherdevices['Zonnescherm manual override'] == 'Off') then
            Message ('Temperature too low, raising sunscreen',sDebug)
            Message('______________________________________________________________________________________',sDebug)
            Notification('Sunscreen#Sunscreen up --> It is too cold',sDebug)
            commandArray['Zonnescherm']='Off'
        elseif (otherdevices['Zonnescherm'] == 'Closed' and sUV < UVThreshold and otherdevices['Zonnescherm manual override'] == 'Off') then
            Message ('Sun not shining too bright, raising sunscreen',sDebug)
            Message('______________________________________________________________________________________',sDebug)
            Notification('Sunscreen#Sunscreen up --> Sunshine not too bright',sDebug)
            commandArray['Zonnescherm']='Off'
        elseif (otherdevices['Zonnescherm'] == 'Closed' and sWindSpeed > WindSpeedThreshold) then
            Message ('Windspeed too high, raising sunscreen',sDebug)
            Message('______________________________________________________________________________________',sDebug)
            Notification('Sunscreen#Sunscreen up --> Windspeed too high',sDebug)
            commandArray['Zonnescherm']='Off'
        elseif (otherdevices['Zonnescherm'] == 'Closed' and sWindGust > WindGustThreshold) then
            Message ('Windgust too high, raising sunscreen',sDebug)
            Message('______________________________________________________________________________________',sDebug)
            Notification('Sunscreen#Sunscreen up --> Windgust too high',sDebug)
            commandArray['Zonnescherm']='Off'
		else
			Message('Sunscreen status OK --> No action',sDebug)
			Message('______________________________________________________________________________________',sDebug)
		end

		::done::
		Message("At the end of the script",sDebug)
		Message("______________________________________________________________________________________",sDebug)
    elseif (timeofday['Nighttime'] and otherdevices['Zonnescherm'] == 'Closed') then
		Message('It is night, raising sunscreen',sDebug)
		Message('______________________________________________________________________________________',sDebug)
		Notification('Sunscreen#Sunscreen up --> It is night',sDebug)
		commandArray['Zonnescherm']='Off'
	else
		Message('Sunscreen already up --> No action',sDebug)
		Message('______________________________________________________________________________________',sDebug)
	end
	commandArray[1] = {['UpdateDevice'] = idx .. '|'..tostring(regen)..'|'..tostring(verw)}
	commandArray[2] = {['UpdateDevice'] = idx2 .. '|0|'.. sWindDirection}
	commandArray[3] = {['UpdateDevice'] = idx3 .. '|0|'.. sWindSpeed}


return CommandArray
There is a little question. In the settings of Domoticz you can set the langitude and longitude. Is it possible to read this out by LUA?

Re: Is it gonna rain within the next X minutes?

Posted: Friday 05 June 2015 12:45
by Justintime
Luuc_a wrote:I have taken the script of tlpeter and made it to my needs.
I have done the following
- Integrate the script with the rain prediction of 'buienradar'.
- made user variables from the thresholds in Domoticz so I can control it from the web interface.

Code: Select all

-----------------------------------------------------------------------------
-- LUA Script
-- Extract values from Weather Underground device and 'Buienradar'-rain 
-- prediction to control the sunscreen
-- Auteur: Luuc_A
-- Datum : 29-05-2014
-----------------------------------------------------------------------------
-- Setup uservariables:
--   1) Weather_Debug          			= String = True / False
--   2) Weather_WindSpeedThreshold		= integer
--   3) Weather_WindGustThreshold		= integer
--   4) Weather_RainThreshold			= integer
--   5) Weather_UVThreshold				= integer
--   6) Weather_TempThreshold			= integer
-- Create Switches:
--   1) Regen             				= Dummy Humiditysensor
--   2) WindSnelheid      				= Dummy Text
--   3) WindRichting      				= Dummy Text
--	 4) Barometer		  				= Weather Underground/Forecast IO
--	 5) Wind			  				= Weather Underground/Forecast IO
--	 6) Regen			  				= Weather Underground/Forecast IO
--   7) Zon				  				= Weather Underground/Forecast IO
--   8) Zonnescherm		  				= Up/Down switch
--   9) Zonnescherm manual override		= Dummy switch
-----------------------------------------------------------------------------
commandArray = {}
------------------------------------------------------------------------
-- Variabelen
lat='52.025526'   -- example lat/lon for Gouda
lon='4.692806'
sDebug = tostring(uservariables["Weather_Debug"])
UVThreshold = uservariables["Weather_UVThreshold"]
WindSpeedThreshold = uservariables["Weather_WindSpeedThreshold"]
WindGustThreshold = uservariables["Weather_WindGustThreshold"]
RainThreshold = uservariables["Weather_RainThreshold"]
TempThreshold = uservariables["Weather_TempThreshold"]
tempfilename = '/var/tmp/rain.tmp' -- can be anywhere writeable
idx = 220  --idx regen
idx2 = 221 -- idx windrichting
idx3 = 222 -- idx windsnelheid
minuten = 5
sBarometer = 'Barometer Gouda' 
sWind = 'Wind Gouda'
sRain = 'Regen Gouda'
sUV = 'UV Gouda'
sSolar = 'Zon Gouda'
------------------------------------------------------------------------

--Sunscreen thresholds:
        -- Windspeed            = 100.0 (value is multiplied by 100)
        -- Rain                 =  0.0
        -- UV                   =  2.0
        -- Temperature          = 12.0
        -- Closed       = Down  = On
        -- Open         = Up    = Off

------------------------------------------------------------------------

-- Functies
function Message(fMessage, fDebug)
        if (fDebug == "True") then
                print("Weather: " .. fMessage)
        end
end

function Notification(fNotification, fDebug)
	if (fDebug == "False") then
	    commandArray['SendNotification'] = "" .. fNotification .. ""
	end
end

function IsItGonnaRain( minutesinfuture )
   url='http://gps.buienradar.nl/getrr.php?lat='..lat..'&lon='..lon
   Message("-- "..url,sDebug)
   read = os.execute('curl -s -o '..tempfilename..' "'..url..'"')
   file = io.open(tempfilename, "r")
   totalrain=0
   rainlines=0
   -- now analyse the received lines, format is like 000|15:30 per line.
   while true do 
      line = file:read("*line")
      if not line then break end
      Message("-- Line:" ..line,sDebug)
      linetime=string.sub(tostring(line), 5, 9)
	  Message("-- Linetime: "..linetime,sDebug)
         
         -- Linetime2 holds the full date calculated from the time on a line
         linetime2 = os.time{year=os.date('%Y'), month=os.date('%m'), day=os.date('%d'), hour=string.sub(linetime,1,2), min=string.sub(linetime,4,5), sec=os.date('%S')}
         difference = os.difftime (linetime2,os.time())
   
      -- When a line entry has a time in the future AND is in the given range, then totalize the rainfall
      if ((difference > 0) and (difference<=minutesinfuture*60)) then
         Message("-- Line in time range found",sDebug)
		 rain=tonumber(string.sub(tostring(line), 0, 3))
         totalrain = totalrain+rain
         rainlines=rainlines+1
         Message("-- Rain in timerange: "..rain,sDebug)
		 Message("-- Total rain now: "..totalrain,sDebug)
      end
   
   end
   file:close()
   averagerain=totalrain/rainlines
   
return(averagerain)
end

	regen = IsItGonnaRain(minuten)
	Message("-- Regen verwacht: "..regen.." binnen "..minuten.." minuten.",sDebug)
	if (regen > 0  ) then verw = 3 else verw = 2 end
	
	--Weatherstation data:
	sWeatherTemp, sWeatherHumidity, sWeatherUV, sWeatherPressure, sWeatherUV2 = otherdevices_svalues[sBarometer]:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)")
	sWeatherTemp = tonumber(sWeatherTemp);
	sWeatherHumidity = tonumber(sWeatherHumidity);
	sWeatherPressure = tonumber(sWeatherPressure);
	sWeatherUV = tonumber(sWeatherUV);
	sWeatherUV2 = tonumber(sWeatherUV2);
	Message("______________________________________________________________________________________",sDebug)
	Message("Weather station: Temperature is " .. sWeatherTemp .. " ",sDebug)
	Message("Weather station: Humidity is " .. sWeatherHumidity .. " ",sDebug)
	Message("Weather station: Pressure is " .. sWeatherPressure .. " ",sDebug)
	Message("Weather station: UV is " .. sWeatherUV .. " ",sDebug)
	Message("Weather station: UV2 is " .. sWeatherUV2 .. " ",sDebug)
	Message("______________________________________________________________________________________",sDebug)
	
	------------------------------------------------------------------------

	--Windmeter data:
	sWindDirectionDegrees, sWindDirection, sWindSpeed, sWindGust, sWindTemperature, sWindFeel = otherdevices_svalues[sWind]:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)")

	sWindDirectionDegrees = tonumber(sWindDirectionDegrees);
	sWindDirection = (sWindDirection);
	sWindSpeed = tonumber(sWindSpeed);
	sWindGust = tonumber(sWindGust);
	sWindTemperature = tonumber(sWindTemperature);
	sWindFeel = tonumber(sWindFeel);

	Message("______________________________________________________________________________________",sDebug)
	Message("Windmeter: Winddirection (in degrees) is: " .. sWindDirectionDegrees .. " ",sDebug)
	Message("Windmeter: Winddirection is: " .. sWindDirection .. " ",sDebug)
	Message("Windmeter: Windspeed is: " .. sWindSpeed .. " ",sDebug)
	Message("Windmeter: Windgust is: " .. sWindGust .. " ",sDebug)
	Message("Windmeter: Windtemperature is: " .. sWindTemperature .. " ",sDebug)
	Message("Windmeter: Windfeel is: " .. sWindFeel .. " ",sDebug)
	Message("______________________________________________________________________________________")

	------------------------------------------------------------------------

	--Rainmeter data:
	sRainmeterCurrent, sRainmeterTotal = otherdevices_svalues[sRain]:match("([^;]+);([^;]+)")
	
	sRainmeterCurrent = tonumber(sRainmeterCurrent);
	sRainmeterTotal = tonumber(sRainmeterTotal);
	
	Message("______________________________________________________________________________________",sDebug)
	Message("Rainmeter: Actual rain is: " .. sRainmeterCurrent .. " ",sDebug)
	Message("Rainmeter: Total rain is: " .. sRainmeterTotal .. " ",sDebug)
	Message("Rainmeter: Predicted rain is: " .. regen .. " ",sDebug)
	Message("______________________________________________________________________________________",sDebug)
	------------------------------------------------------------------------

	--UV data:
	sUV = otherdevices_svalues[sUV]:match("([^;]+)")
	sSolar = otherdevices_svalues[sSolar]:match("([^;]+)")
	
	sUV = tonumber(sUV);
	sSolar = tonumber(sSolar);

	Message("UV: UV Strength is: " .. sUV .." ",sDebug)
	Message("UV: Solar radiation is: " .. sSolar .." ",sDebug)
	
	--Thresholds:
	Message("______________________________________________________________________________________",sDebug)
	Message("Thresholds: Temp threshold is: " .. TempThreshold .." ",sDebug)
	Message("Thresholds: UV threshold is: " .. UVThreshold .." ",sDebug)
	Message("Thresholds: WindSpeed threshold is: " .. WindSpeedThreshold .." ",sDebug)
	Message("Thresholds: WindGust threshold is: " .. WindGustThreshold .." ",sDebug)
	Message("Thresholds: Rain threshold is: " .. RainThreshold .." ",sDebug)
	Message("______________________________________________________________________________________",sDebug)
	
	if (timeofday['Daytime']) then
        Message('It is past sunrise, monitoring variables for sunscreen',sDebug)
        if (otherdevices['Zonnescherm'] == 'Open' ) then
            Message ('Sunscreen is up',sDebug)
        else
            Message ('Sunscreen is down',sDebug)
		end
		if (otherdevices['Zonnescherm']   == 'Open'
			and sRainmeterCurrent   == RainThreshold
			and sWeatherTemp        > TempThreshold
			and sUV            		> UVThreshold
			and sWindSpeed          < WindSpeedThreshold
			and sWindGust           < WindGustThreshold)
		then
			Message ('Sun is shining, all thresholds OK, lowering sunscreen',sDebug)
			Message('______________________________________________________________________________________',sDebug)
			Notification('Sunscreen#Sunscreen down --> Sun is shining',sDebug)
			commandArray['Zonnescherm']='On'
		elseif (otherdevices['Zonnescherm'] == 'Closed' and (sRainmeterCurrent > RainThreshold or regen > 0)) then
            Message ('It is raining, raising sunscreen')
            Message('______________________________________________________________________________________',sDebug)
            Notification('Sunscreen#Sunscreen up --> It is raining',sDebug)
            commandArray['Zonnescherm']='Off'
        elseif (otherdevices['Zonnescherm'] == 'Closed' and sWeatherTemp < TempThreshold and otherdevices['Zonnescherm manual override'] == 'Off') then
            Message ('Temperature too low, raising sunscreen',sDebug)
            Message('______________________________________________________________________________________',sDebug)
            Notification('Sunscreen#Sunscreen up --> It is too cold',sDebug)
            commandArray['Zonnescherm']='Off'
        elseif (otherdevices['Zonnescherm'] == 'Closed' and sUV < UVThreshold and otherdevices['Zonnescherm manual override'] == 'Off') then
            Message ('Sun not shining too bright, raising sunscreen',sDebug)
            Message('______________________________________________________________________________________',sDebug)
            Notification('Sunscreen#Sunscreen up --> Sunshine not too bright',sDebug)
            commandArray['Zonnescherm']='Off'
        elseif (otherdevices['Zonnescherm'] == 'Closed' and sWindSpeed > WindSpeedThreshold) then
            Message ('Windspeed too high, raising sunscreen',sDebug)
            Message('______________________________________________________________________________________',sDebug)
            Notification('Sunscreen#Sunscreen up --> Windspeed too high',sDebug)
            commandArray['Zonnescherm']='Off'
        elseif (otherdevices['Zonnescherm'] == 'Closed' and sWindGust > WindGustThreshold) then
            Message ('Windgust too high, raising sunscreen',sDebug)
            Message('______________________________________________________________________________________',sDebug)
            Notification('Sunscreen#Sunscreen up --> Windgust too high',sDebug)
            commandArray['Zonnescherm']='Off'
		else
			Message('Sunscreen status OK --> No action',sDebug)
			Message('______________________________________________________________________________________',sDebug)
		end

		::done::
		Message("At the end of the script",sDebug)
		Message("______________________________________________________________________________________",sDebug)
    elseif (timeofday['Nighttime'] and otherdevices['Zonnescherm'] == 'Closed') then
		Message('It is night, raising sunscreen',sDebug)
		Message('______________________________________________________________________________________',sDebug)
		Notification('Sunscreen#Sunscreen up --> It is night',sDebug)
		commandArray['Zonnescherm']='Off'
	else
		Message('Sunscreen already up --> No action',sDebug)
		Message('______________________________________________________________________________________',sDebug)
	end
	commandArray[1] = {['UpdateDevice'] = idx .. '|'..tostring(regen)..'|'..tostring(verw)}
	commandArray[2] = {['UpdateDevice'] = idx2 .. '|0|'.. sWindDirection}
	commandArray[3] = {['UpdateDevice'] = idx3 .. '|0|'.. sWindSpeed}


return CommandArray
There is a little question. In the settings of Domoticz you can set the langitude and longitude. Is it possible to read this out by LUA?
Thanks for the script. I tested it (only on temperature).

Outside temp. is 25 degrees. When i set the treshold variable on 30 the screen is Up (off). When is switch manually down (on) it goes up. so thats ok. Because temperature is too low.

But when i set the treshold temperature on 12 degrees nothing happens.... Up or down, the status is ok.

Which blinds switch did you use?? Looks like up/down, open/close on/off are mixed?

Re: Is it gonna rain within the next X minutes?

Posted: Friday 05 June 2015 13:44
by Luuc_a
Do you have a override switch called "Zonnescherm manual override"? The first time I used it I had the same sort of issues. Then I saw that I don't had the override switch.
When you don't want to use the override script you can edit the code:

Code: Select all

 elseif (otherdevices['Zonnescherm'] == 'Closed' and sWeatherTemp < TempThreshold and otherdevices['Zonnescherm manual override'] == 'Off') then
to

Code: Select all

elseif (otherdevices['Zonnescherm'] == 'Closed' and sWeatherTemp < TempThreshold) then
and the same for the UV check.

Re: Is it gonna rain within the next X minutes?

Posted: Tuesday 16 June 2015 8:13
by Luuc_a
I have made a new script with the following adaptions:

- 2 new variables (RainPredThreshold and SolarThreshold)
- Check if UV or Solar is right to open or close the sunscreen
- Check if Rain Current of Rain Predicted is right to open or close the sunscreen
- More loging when debug is on

Code: Select all

-----------------------------------------------------------------------------
-- LUA Script
-- Extract values from WU device
-- Auteur: Luuc Alarm
-- Datum : 29-05-2014
-----------------------------------------------------------------------------
-- Setup uservariables:
--   1) Weather_Debug          			= String = True / False
--   2) Weather_WindSpeedThreshold      = integer
--   3) Weather_WindGustThreshold      	= integer
--   4) Weather_RainThreshold         	= integer
--   5) Weather_RainPredThreshold		= integer
--   6) Weather_UVThreshold            	= integer
--	 7) Weather_SolarThreshold			= integer
--   8) Weather_TempThreshold         	= integer
-- Create Switches:
--   1) Regen             				= Dummy Humiditysensor
--   2) WindSnelheid      				= Dummy Text
--   3) WindRichting      				= Dummy Text
--   4) Barometer             			= Weather Underground/Forecast IO
--   5) Wind                          	= Weather Underground/Forecast IO
--   6) Regen                         	= Weather Underground/Forecast IO
--   7) Zon                             = Weather Underground/Forecast IO
--   8) Zonnescherm               		= Up/Down switch
--   9) Zonnescherm manual override		= Dummy On/Off switch
-----------------------------------------------------------------------------
commandArray = {}
-- tijd ophalen
time = os.date("*t")
------------------------------------------------------------------------
-- Variabelen
lat='52.025526'   -- example lat/lon for Gouda
lon='4.692806'
sDebug = tostring(uservariables["Weather_Debug"])
UVThreshold = uservariables["Weather_UVThreshold"]
SolarThreshold = uservariables["Weather_SolarThreshold"]
WindSpeedThreshold = uservariables["Weather_WindSpeedThreshold"]
WindGustThreshold = uservariables["Weather_WindGustThreshold"]
RainThreshold = uservariables["Weather_RainThreshold"]
RainPredThreshold = uservariables["Weather_RainPredThreshold"]
TempThreshold = uservariables["Weather_TempThreshold"]
tempfilename = '/var/tmp/rain.tmp' -- can be anywhere writeable
idx = 220  --idx regen
idx2 = 221 -- idx windrichting
idx3 = 222 -- idx windsnelheid
minuten = 5  -- time within rainprediction
sBarometer = 'Barometer Gouda'
sWind = 'Wind Gouda'
sRain = 'Regen Gouda'
sUV = 'UV Gouda'
sSolar = 'Zon Gouda'
------------------------------------------------------------------------

--Sunscreen thresholds:
        -- Windspeed            = 100.0 (value is multiplied by 100)
        -- Rain                 =  0.0
        -- UV                   =  2.0
        -- Temperature          = 12.0
        -- Closed       = Down  = On
        -- Open         = Up    = Off

------------------------------------------------------------------------

-- Functies
function Message(fMessage, fDebug)
        if (fDebug == "True") then
                print("Weather: " .. fMessage)
        end
end

function Notification(fNotification, fDebug)
        if (fDebug == "False") then
            commandArray['SendNotification'] = "" .. fNotification .. ""
        end
end

function IsItGonnaRain( minutesinfuture )
   url='http://gps.buienradar.nl/getrr.php?lat='..lat..'&lon='..lon
   Message("-- "..url,sDebug)
   read = os.execute('curl -s -o '..tempfilename..' "'..url..'"')
   file = io.open(tempfilename, "r")
   totalrain=0
   rainlines=0
   -- now analyse the received lines, format is like 000|15:30 per line.
   while true do
      line = file:read("*line")
      if not line then break end
      Message("-- Line:" ..line,sDebug)
      linetime=string.sub(tostring(line), 5, 9)
          Message("-- Linetime: "..linetime,sDebug)

         -- Linetime2 holds the full date calculated from the time on a line
         linetime2 = os.time{year=os.date('%Y'), month=os.date('%m'), day=os.date('%d'), hour=string.sub(linetime,1,2), min=string.sub(linetime,4,5), sec=os.date('%S')}
         difference = os.difftime (linetime2,os.time())

      -- When a line entry has a time in the future AND is in the given range, then totalize the rainfall
      if ((difference > 0) and (difference<=minutesinfuture*60)) then
         Message("-- Line in time range found",sDebug)
                 rain=tonumber(string.sub(tostring(line), 0, 3))
         totalrain = totalrain+rain
         rainlines=rainlines+1
         Message("-- Rain in timerange: "..rain,sDebug)
                 Message("-- Total rain now: "..totalrain,sDebug)
      end

   end
   file:close()
   averagerain=totalrain/rainlines

return(averagerain)
end

    regen = IsItGonnaRain(minuten)
    Message("-- Regen verwacht: "..regen.." binnen "..minuten.." minuten.",sDebug)
    if (regen > 0  ) then verw = 3 else verw = 2 end

		--Weatherstation data:

        sWeatherTemp, sWeatherHumidity, sWeatherUV, sWeatherPressure, sWeatherUV2 = otherdevices_svalues[sBarometer]:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)")
        sWeatherTemp = tonumber(sWeatherTemp);
        sWeatherHumidity = tonumber(sWeatherHumidity);
        sWeatherPressure = tonumber(sWeatherPressure);
        sWeatherUV = tonumber(sWeatherUV);
        sWeatherUV2 = tonumber(sWeatherUV2);
        Message("______________________________________________________________________________________",sDebug)
        Message("Weather station: Temperature is " .. sWeatherTemp .. " ",sDebug)
        Message("Weather station: Humidity is " .. sWeatherHumidity .. " ",sDebug)
        Message("Weather station: Pressure is " .. sWeatherPressure .. " ",sDebug)
        Message("Weather station: UV is " .. sWeatherUV .. " ",sDebug)
        Message("Weather station: UV2 is " .. sWeatherUV2 .. " ",sDebug)
        Message("______________________________________________________________________________________",sDebug)

        ------------------------------------------------------------------------

        --Windmeter data:
        sWindDirectionDegrees, sWindDirection, sWindSpeed, sWindGust, sWindTemperature, sWindFeel = otherdevices_svalues[sWind]:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)")

        sWindDirectionDegrees = tonumber(sWindDirectionDegrees);
        sWindDirection = (sWindDirection);
        sWindSpeed = tonumber(sWindSpeed);
        sWindGust = tonumber(sWindGust);
        sWindTemperature = tonumber(sWindTemperature);
        sWindFeel = tonumber(sWindFeel);

        Message("______________________________________________________________________________________",sDebug)
        Message("Windmeter: Winddirection (in degrees) is: " .. sWindDirectionDegrees .. " ",sDebug)
        Message("Windmeter: Winddirection is: " .. sWindDirection .. " ",sDebug)
        Message("Windmeter: Windspeed is: " .. sWindSpeed .. " ",sDebug)
        Message("Windmeter: Windgust is: " .. sWindGust .. " ",sDebug)
        Message("Windmeter: Windtemperature is: " .. sWindTemperature .. " ",sDebug)
        Message("Windmeter: Windfeel is: " .. sWindFeel .. " ",sDebug)
        Message("______________________________________________________________________________________")

        ------------------------------------------------------------------------

        --Rainmeter data:
        sRainmeterCurrent, sRainmeterTotal = otherdevices_svalues[sRain]:match("([^;]+);([^;]+)")

        sRainmeterCurrent = tonumber(sRainmeterCurrent);
        sRainmeterTotal = tonumber(sRainmeterTotal);

        Message("______________________________________________________________________________________",sDebug)
        Message("Rainmeter: Actual rain is: " .. sRainmeterCurrent .. " ",sDebug)
        Message("Rainmeter: Total rain is: " .. sRainmeterTotal .. " ",sDebug)
        Message("Rainmeter: Predicted rain is: " .. regen .. " ",sDebug)
        Message("______________________________________________________________________________________",sDebug)
        ------------------------------------------------------------------------

        --UV data:
        sUV = otherdevices_svalues[sUV]:match("([^;]+)")
        sSolar = otherdevices_svalues[sSolar]:match("([^;]+)")

        sUV = tonumber(sUV);
        sSolar = tonumber(sSolar);

        Message("UV: UV Strength is: " .. sUV .." ",sDebug)
        Message("UV: Solar radiation is: " .. sSolar .." ",sDebug)

        --Thresholds:
        Message("______________________________________________________________________________________",sDebug)
        Message("Thresholds: Temp threshold is: " .. TempThreshold .." ",sDebug)
        Message("Thresholds: UV threshold is: " .. UVThreshold .." ",sDebug)
        Message("Thresholds: Solar threshold is: " .. SolarThreshold .." ",sDebug)
        Message("Thresholds: WindSpeed threshold is: " .. WindSpeedThreshold .." ",sDebug)
        Message("Thresholds: WindGust threshold is: " .. WindGustThreshold .." ",sDebug)
        Message("Thresholds: Rain threshold is: " .. RainThreshold .." ",sDebug)
        Message("Thresholds: Rain Prediction threshold is: " .. RainPredThreshold .." ",sDebug)
        Message("______________________________________________________________________________________",sDebug)
        Message("Override: ".. otherdevices['Zonnescherm manual override'],sDebug)
        Message("______________________________________________________________________________________",sDebug)

        if (timeofday['Daytime']) then
        Message('It is past sunrise, monitoring variables for sunscreen',sDebug)
        if (otherdevices['Zonnescherm'] == 'Open' ) then
            Message ('Sunscreen is up',sDebug)
        else
            Message ('Sunscreen is down',sDebug)
        end
        if (otherdevices['Zonnescherm']   == 'Open'
				and sRainmeterCurrent   == RainThreshold
				and sWeatherTemp        > TempThreshold
				and (sUV > UVThreshold or sSolar > SolarThreshold)
				and sWindSpeed          < WindSpeedThreshold
				and sWindGust           < WindGustThreshold)
			then
				Message ('Sun is shining, all thresholds OK, lowering sunscreen',sDebug)
				Message('______________________________________________________________________________________',sDebug)
				Notification('Sunscreen#Sunscreen down --> Sun is shining',sDebug)
				commandArray['Zonnescherm']='On'
		elseif (otherdevices['Zonnescherm'] == 'Closed' and (sRainmeterCurrent > RainThreshold or regen > RainPredThreshold)) then
            Message ('It is raining, raising sunscreen')
            Message('______________________________________________________________________________________',sDebug)
            Notification('Sunscreen#Sunscreen up --> It is raining',sDebug)
            commandArray['Zonnescherm']='Off'
        elseif (otherdevices['Zonnescherm'] == 'Closed' and sWeatherTemp < TempThreshold-1 and otherdevices['Zonnescherm manual override'] == 'Off') then
            Message ('Temperature too low, raising sunscreen',sDebug)
            Message('______________________________________________________________________________________',sDebug)
            Notification('Sunscreen#Sunscreen up --> It is too cold',sDebug)
            commandArray['Zonnescherm']='Off'
        elseif (otherdevices['Zonnescherm'] == 'Closed' and (sUV < UVThreshold-1 or sSolar < SolarThreshold) and otherdevices['Zonnescherm manual override'] == 'Off') then
            Message ('Sun not shining too bright, raising sunscreen',sDebug)
            Message('______________________________________________________________________________________',sDebug)
            Notification('Sunscreen#Sunscreen up --> Sunshine not too bright',sDebug)
            commandArray['Zonnescherm']='Off'
        elseif (otherdevices['Zonnescherm'] == 'Closed' and sWindSpeed > WindSpeedThreshold) then
            Message ('Windspeed too high, raising sunscreen',sDebug)
            Message('______________________________________________________________________________________',sDebug)
            Notification('Sunscreen#Sunscreen up --> Windspeed too high',sDebug)
            commandArray['Zonnescherm']='Off'
        elseif (otherdevices['Zonnescherm'] == 'Closed' and sWindGust > WindGustThreshold) then
            Message ('Windgust too high, raising sunscreen',sDebug)
            Message('______________________________________________________________________________________',sDebug)
            Notification('Sunscreen#Sunscreen up --> Windgust too high',sDebug)
            commandArray['Zonnescherm']='Off'
        else
            Message('Sunscreen status OK --> No action',sDebug)
            Message('______________________________________________________________________________________',sDebug)
        end

        ::done::
        Message("At the end of the script",sDebug)
        Message("______________________________________________________________________________________",sDebug)
    elseif (timeofday['Nighttime'] and otherdevices['Zonnescherm'] == 'Closed') then
        Message('It is night, raising sunscreen',sDebug)
        Message('______________________________________________________________________________________',sDebug)
        Notification('Sunscreen#Sunscreen up --> It is night',sDebug)
        commandArray['Zonnescherm']='Off'
    else
        Message('Sunscreen already up --> No action',sDebug)
        Message('______________________________________________________________________________________',sDebug)
    end
    commandArray[1] = {['UpdateDevice'] = idx .. '|'..tostring(regen)..'|'..tostring(verw)}
    commandArray[2] = {['UpdateDevice'] = idx2 .. '|0|'.. sWindDirection}
    commandArray[3] = {['UpdateDevice'] = idx3 .. '|0|'.. sWindSpeed}

return CommandArray


For me this would be the latest version because in my case I can not trust on WU of Forecast IO.
When there is a clear blue sky WU sometimes think it's rain. As long as I don't have a dedicated weather station I will leave it like this. If anyone has any comments or want something else let me know and I will take a look into it.

Re: Is it gonna rain within the next X minutes?

Posted: Tuesday 16 June 2015 23:01
by Brutus
For the people who are interested, I made the rain prediction script usable for Windows. 8-)

Steps to make it work:

- Make a virtual Humidity device in Domoticz and remember the IDX number.
- Go to the following website: http://curl.haxx.se/dlwiz/ and download the needed setup. (x86, x64).
In my case I selected "curl executable", "Win64", "Generic", "Any" and "x86_64" (I use Windows 8.1 64Bits)
- Create A new folder on your Domoticz Computer (For example: C:\Rain ).
- Extract the downloaded "Curl" zip file in this map.
- Make also a new file in this folder called: "rain.tmp"
- Make a new lua file called: "script_time_rain_prediction.lua" Fill the file with the following code:

Code: Select all

    
    ----------------------------------------------------------------------------------------------------------------
    -- IsItGonnaRain( int minutesinfuture)
    -- returns: int avarage rainfall for the next minutesinfuture
    --
    -- Function to get rain prediction from Buienradar.nl (dutch)
    -- 
    -- http://gratisweerdata.buienradar.nl/#Buienradar You may use their free service for non-commercial purposes.
    -- 
    -- Written in LUA by Hans van der Heijden (h4nsie @ gmail.com)
    -- Spring 2015
    -- 28-03-2015 v0.3 bug: quotes around url added.
    -- 27-03-2015 v0.2 return value is now average for next time
    -- 26-03-2015 v0.1 Initial release
    -- todo: some error checking on http and file handling (tmp file)
    ----------------------------------------------------------------------------------------------------------------
    function IsItGonnaRain( minutesinfuture )

       -- config ---------------------------------------------------------
       lat='50.891508'   -- example lat/lon for Heerlen
       lon='5.960975'
       debug=False
       tempfilename = 'C:\\Rain\\rain.tmp' -- can be anywhere writeable
       -- config ---------------------------------------------------------
             
       url='http://gps.buienradar.nl/getrr.php?lat='..lat..'&lon='..lon
       if debug then print(url) end
       read = os.execute('"C:/Rain/Curl/bin/curl.exe -s -o '..tempfilename..' "'..url..'"')
       file = io.open(tempfilename, "r")
       totalrain=0
       rainlines=0
       -- now analyse the received lines, format is like 000|15:30 per line.
       while true do
          line = file:read("*line")
          if not line then break end
          if debug then print('Line:'..line) end
          linetime=string.sub(tostring(line), 5, 9)
          if debug then print('Linetime: '..linetime) end
             
             -- Linetime2 holds the full date calculated from the time on a line
             linetime2 = os.time{year=os.date('%Y'), month=os.date('%m'), day=os.date('%d'), hour=string.sub(linetime,1,2), min=string.sub(linetime,4,5), sec=os.date('%S')}
             difference = os.difftime (linetime2,os.time())
       
          -- When a line entry has a time in the future AND is in the given range, then totalize the rainfall
          if ((difference > 0) and (difference<=minutesinfuture*60)) then
             if debug then print('Line in time range found') end
             rain=tonumber(string.sub(tostring(line), 0, 3))
             totalrain = totalrain+rain
             rainlines=rainlines+1
             if debug then print('Rain in timerange: '..rain) end
             if debug then print('Total rain now: '..totalrain) end
          end
       
       end
       file:close()
       
       -- Returned value is average rain fall for next time
       -- 0 is no rain, 255 is very heavy rain
       -- When needed, mm/h is calculated by 10^((value -109)/32) (example: 77 = 0.1 mm/hour)
       averagerain=totalrain/rainlines
       
    return(averagerain)
    end



    ----- REGEN ------
    commandArray = {}
    minuten=15
    regen = IsItGonnaRain(minuten)
    print('Regen verwacht(0-255 hoe hoger hoe meer regen): '..regen..' binnen '..minuten..' minuten.')
    if (regen > 0  ) then verw = 3 else verw = 2 end
    commandArray['UpdateDevice'] = '170|'..tostring(regen)..'|'..tostring(verw)
    return commandArray
Change the following data in your script:
- Change the longitude and latitude to your location. You can find these numbers in your Domoticz Settings.
- Change the path after: "tempfilename" if you have chosen another location.
- Change the path after: "read = os.execute: if you have chosen another location.

Greetings.

Re: Is it gonna rain within the next X minutes?

Posted: Wednesday 17 June 2015 0:39
by Siewert308SW
Just wanna say thx for the script.
Gonna use it for my Garden Irrigation.
Why irrigating while rain is coming up ;-)

Re: Is it gonna rain within the next X minutes?

Posted: Wednesday 17 June 2015 18:30
by Justintime
It's a great script!! And two nice thresholds added.
Now some playing with the settings to get it right.

Thanks Luuc and Hansbit

Re: Is it gonna rain within the next X minutes?

Posted: Sunday 19 July 2015 14:38
by Bram81
Hi Hans,

I've tried to send you a PM (in Dutch) but it seems that I can't get any messasges sent. I'm not familiar witch lua just yet but I would like to get data from Buienradar as well to add to my garden irrigation system and moisture sensors already in place. Can you put me on the right track about how to integrate this in domoticz exactly?

Thank in advance!

Re: Is it gonna rain within the next X minutes?

Posted: Sunday 19 July 2015 14:41
by Siewert308SW
Bram81 wrote:Hi Hans,

I've tried to send you a PM (in Dutch) but it seems that I can't get any messasges sent. I'm not familiar witch lua just yet but I would like to get data from Buienradar as well to add to my garden irrigation system and moisture sensors already in place. Can you put me on the right track about how to integrate this in domoticz exactly?

Thank in advance!
Maybe you could try my script, just finished it and does what you want...
viewtopic.php?f=23&t=7290

Re: Is it gonna rain within the next X minutes?

Posted: Monday 20 July 2015 13:31
by jjnj
I would like to use the outcome of the rain value/virtual humidity sensor in blocky. But for some reason blocky doesn't seem to respond to the value of the virtual humidity sensor. anybody has an idea?

Re: Is it gonna rain within the next X minutes?

Posted: Monday 20 July 2015 14:43
by Brutus
jjnj wrote:I would like to use the outcome of the rain value/virtual humidity sensor in blocky. But for some reason blocky doesn't seem to respond to the value of the virtual humidity sensor. anybody has an idea?
Can you post an example of your Blockly?

Re: Is it gonna rain within the next X minutes?

Posted: Monday 20 July 2015 15:08
by jjnj
Brutus wrote:
jjnj wrote:I would like to use the outcome of the rain value/virtual humidity sensor in blocky. But for some reason blocky doesn't seem to respond to the value of the virtual humidity sensor. anybody has an idea?
Can you post an example of your Blockly?
Just a plain and simple blocky just to test
Image

Re: Is it gonna rain within the next X minutes?

Posted: Monday 20 July 2015 15:57
by Brutus
jjnj wrote:
Brutus wrote:
jjnj wrote:I would like to use the outcome of the rain value/virtual humidity sensor in blocky. But for some reason blocky doesn't seem to respond to the value of the virtual humidity sensor. anybody has an idea?
Can you post an example of your Blockly?
Just a plain and simple blocky just to test
Image

I think you need to compare something like in my Blockly:
And I have my doubts about the "open" command.
Maybe test to write something in the log file or send a notification.
Naamloos.jpg
Naamloos.jpg (52.81 KiB) Viewed 5490 times
Timer Regen = virtual switch that is on when there is rain and off when there isn't. (needed for not creating loops in blockly).
Screens Dicht = Virtual switch for indicating if the screens are closed. (needed for not creating any loops in blockly).

Re: Is it gonna rain within the next X minutes?

Posted: Tuesday 21 July 2015 10:20
by Bram81
Siewert308SW wrote:
Bram81 wrote:Hi Hans,

I've tried to send you a PM (in Dutch) but it seems that I can't get any messasges sent. I'm not familiar witch lua just yet but I would like to get data from Buienradar as well to add to my garden irrigation system and moisture sensors already in place. Can you put me on the right track about how to integrate this in domoticz exactly?

Thank in advance!
Maybe you could try my script, just finished it and does what you want...
viewtopic.php?f=23&t=7290
Thanks! Haven't worked with lua before, so I guess there is a lot to learn but this will help me for sure!

Re: Is it gonna rain within the next X minutes?

Posted: Friday 24 July 2015 23:52
by Hansbit
Posted a install instruction in the Wiki

https://www.domoticz.com/wiki/Is_it_gonna_rain

Please note that a threshold of 70 is (in my opinion) the best value to trigger for rain.

Re: Is it gonna rain within the next X minutes?

Posted: Saturday 25 July 2015 0:07
by jjnj
Hansbit wrote:Posted a install instruction in the Wiki

https://www.domoticz.com/wiki/Is_it_gonna_rain

Please note that a threshold of 70 is (in my opinion) the best value to trigger for rain.
Why a threshold for 70? Then it would already be raining right below 70? So that would be to late

Re: Is it gonna rain within the next X minutes?

Posted: Saturday 25 July 2015 0:25
by Hansbit
jjnj wrote:Why a threshold for 70? Then it would already be raining right below 70? So that would be to late
With lower values to trigger for rain you'll get too many false positives. Even on sunny days with clear blue sky, Buienrader sometimes reports values like 35 or 40.

Re: Is it gonna rain within the next X minutes?

Posted: Saturday 25 July 2015 11:13
by RayAmsterdam
The wiki script gives me the following error: Error: EventSystem: Lua script did not return a commandArray
Any idea what's wrong?

Re: Is it gonna rain within the next X minutes?

Posted: Saturday 25 July 2015 12:09
by jvdz
Do you have this line at the bottom of the script?

Code: Select all

return CommandArray
Jos