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.markk wrote:Hi Tlpetertlpeter wrote:Hi Hans i know, that is the problem
I use a different script now and i have it working.
But thanks anyway.
Would you mind sharing your windows script please?
Thanks
Mark
Is it gonna rain within the next X minutes?
Moderator: leecollings
- Brutus
- Posts: 249
- Joined: Friday 26 September 2014 9:33
- Target OS: Windows
- Domoticz version:
- Location: Netherlands
- Contact:
Re: Is it gonna rain within the next X minutes?
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
-
- Posts: 24
- Joined: Tuesday 16 July 2013 10:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Re: Is it gonna rain within the next X minutes?
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.
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?
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
-
- Posts: 228
- Joined: Thursday 21 May 2015 9:08
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Re: Is it gonna rain within the next X minutes?
Thanks for the script. I tested it (only on temperature).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.
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?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
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?
-
- Posts: 24
- Joined: Tuesday 16 July 2013 10:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Re: Is it gonna rain within the next X minutes?
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:
to
and the same for the UV check.
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
Code: Select all
elseif (otherdevices['Zonnescherm'] == 'Closed' and sWeatherTemp < TempThreshold) then
-
- Posts: 24
- Joined: Tuesday 16 July 2013 10:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Re: Is it gonna rain within the next X minutes?
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
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.
- 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
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.
- Brutus
- Posts: 249
- Joined: Friday 26 September 2014 9:33
- Target OS: Windows
- Domoticz version:
- Location: Netherlands
- Contact:
Re: Is it gonna rain within the next X minutes?
For the people who are interested, I made the rain prediction script usable for Windows.
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:
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.
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 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.
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
- Siewert308SW
- Posts: 288
- Joined: Monday 29 December 2014 15:47
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: The Netherlands
- Contact:
Re: Is it gonna rain within the next X minutes?
Just wanna say thx for the script.
Gonna use it for my Garden Irrigation.
Why irrigating while rain is coming up
Gonna use it for my Garden Irrigation.
Why irrigating while rain is coming up
Setup:
- RPi4 - Domo Stable / Aeotec Z-stick7 / PiHole Unbound Gemini
- RPi4 - PiHole / PiVPN Unbound Gemini
- Synology DS923+ / DS218j
- P1 Gas/Power, SmartGateway watermeter
- Fibaro switches, contacts, plugs, smoke/Co2 ect
- rootfs @ USB HDD
- RPi4 - Domo Stable / Aeotec Z-stick7 / PiHole Unbound Gemini
- RPi4 - PiHole / PiVPN Unbound Gemini
- Synology DS923+ / DS218j
- P1 Gas/Power, SmartGateway watermeter
- Fibaro switches, contacts, plugs, smoke/Co2 ect
- rootfs @ USB HDD
-
- Posts: 228
- Joined: Thursday 21 May 2015 9:08
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Re: Is it gonna rain within the next X minutes?
It's a great script!! And two nice thresholds added.
Now some playing with the settings to get it right.
Thanks Luuc and Hansbit
Now some playing with the settings to get it right.
Thanks Luuc and Hansbit
-
- Posts: 22
- Joined: Saturday 02 May 2015 11:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9700
- Location: Utrecht, NL
- Contact:
Re: Is it gonna rain within the next X minutes?
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!
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!
- Siewert308SW
- Posts: 288
- Joined: Monday 29 December 2014 15:47
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: The Netherlands
- Contact:
Re: Is it gonna rain within the next X minutes?
Maybe you could try my script, just finished it and does what you want...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!
viewtopic.php?f=23&t=7290
Setup:
- RPi4 - Domo Stable / Aeotec Z-stick7 / PiHole Unbound Gemini
- RPi4 - PiHole / PiVPN Unbound Gemini
- Synology DS923+ / DS218j
- P1 Gas/Power, SmartGateway watermeter
- Fibaro switches, contacts, plugs, smoke/Co2 ect
- rootfs @ USB HDD
- RPi4 - Domo Stable / Aeotec Z-stick7 / PiHole Unbound Gemini
- RPi4 - PiHole / PiVPN Unbound Gemini
- Synology DS923+ / DS218j
- P1 Gas/Power, SmartGateway watermeter
- Fibaro switches, contacts, plugs, smoke/Co2 ect
- rootfs @ USB HDD
Re: Is it gonna rain within the next X minutes?
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?
- Brutus
- Posts: 249
- Joined: Friday 26 September 2014 9:33
- Target OS: Windows
- Domoticz version:
- Location: Netherlands
- Contact:
Re: Is it gonna rain within the next X minutes?
Can you post an example of your Blockly?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?
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
Re: Is it gonna rain within the next X minutes?
Just a plain and simple blocky just to testBrutus wrote:Can you post an example of your Blockly?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?
- Brutus
- Posts: 249
- Joined: Friday 26 September 2014 9:33
- Target OS: Windows
- Domoticz version:
- Location: Netherlands
- Contact:
Re: Is it gonna rain within the next X minutes?
jjnj wrote:Just a plain and simple blocky just to testBrutus wrote:Can you post an example of your Blockly?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?
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.
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).
1x Intel NUC8i5BEK (Windows 10 x64) Domoticz on Virtualbox with DietPi.
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
1x Aeon Labs USB Z-Stick S2
1x P1 Smart Meter USB
28x Fibaro Modules
SMA Solar System
Daikin Airco / Heating
Denon DHT-S716H & DSW-1H
-
- Posts: 22
- Joined: Saturday 02 May 2015 11:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9700
- Location: Utrecht, NL
- Contact:
Re: Is it gonna rain within the next X minutes?
Thanks! Haven't worked with lua before, so I guess there is a lot to learn but this will help me for sure!Siewert308SW wrote:Maybe you could try my script, just finished it and does what you want...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!
viewtopic.php?f=23&t=7290
-
- Posts: 36
- Joined: Monday 17 February 2014 15:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Is it gonna rain within the next X minutes?
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.
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?
Why a threshold for 70? Then it would already be raining right below 70? So that would be to lateHansbit 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.
-
- Posts: 36
- Joined: Monday 17 February 2014 15:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Is it gonna rain within the next X minutes?
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.jjnj wrote:Why a threshold for 70? Then it would already be raining right below 70? So that would be to late
-
- Posts: 115
- Joined: Sunday 11 January 2015 16:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Is it gonna rain within the next X minutes?
The wiki script gives me the following error: Error: EventSystem: Lua script did not return a commandArray
Any idea what's wrong?
Any idea what's wrong?
- jvdz
- Posts: 2189
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Is it gonna rain within the next X minutes?
Do you have this line at the bottom of the script?
Jos
Code: Select all
return CommandArray
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Who is online
Users browsing this forum: No registered users and 1 guest