Sure but keep in mind that my script is totally different.
It is based on Wunderground where you can choose a weather station near by.
I do not have any integration with buienradar.
I also added a switch where i can override the script partly (except for hard wind, rain and night)
Here it is:
Code: Select all
commandArray = {}
--Weatherstation data:
sWeatherTemp, sWeatherHumidity, sWeatherUV, sWeatherPressure, sWeatherUV2 = otherdevices_svalues['Barometer']:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)")
sWeatherTemp = tonumber(sWeatherTemp);
sWeatherHumidity = tonumber(sWeatherHumidity);
sWeatherPressure = tonumber(sWeatherPressure);
sWeatherUV = tonumber(sWeatherUV);
sWeatherUV2 = tonumber(sWeatherUV2);
print("______________________________________________________________________________________")
print("Weather station: Temperature is " .. sWeatherTemp .. " ");
print("Weather station: Humidity is " .. sWeatherHumidity .. " ");
print("Weather station: Pressure is " .. sWeatherPressure .. " ");
print("Weather station: UV is " .. sWeatherUV .. " ");
print("Weather station: UV2 is " .. sWeatherUV2 .. " ");
print("______________________________________________________________________________________")
------------------------------------------------------------------------
--Windmeter data:
sWindDirectionDegrees, sWindDirection, sWindSpeed, sWindGust, sWindTemperature, sWindFeel = otherdevices_svalues['Wind']:match("([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);([^;]+)")
sWindDirectionDegrees = tonumber(sWindDirectionDegrees);
sWindDirection = (sWindDirection);
sWindSpeed = tonumber(sWindSpeed);
sWindGust = tonumber(sWindGust);
sWindTemperature = tonumber(sWindTemperature);
sWindFeel = tonumber(sWindFeel);
print("______________________________________________________________________________________")
print("Windmeter: Winddirection (in degrees) is: " .. sWindDirectionDegrees .. " ");
print("Windmeter: Winddirection is: " .. sWindDirection .. " ");
print("Windmeter: Windspeed is: " .. sWindSpeed .. " ");
print("Windmeter: Windgust is: " .. sWindGust .. " ");
print("Windmeter: Windtemperature is: " .. sWindTemperature .. " ");
print("Windmeter: Windfeel is: " .. sWindFeel .. " ");
print("______________________________________________________________________________________")
------------------------------------------------------------------------
--Rainmeter data:
sRainmeterCurrent, sRainmeterTotal = otherdevices_svalues['Regen']:match("([^;]+);([^;]+)")
sRainmeterCurrent = tonumber(sRainmeterCurrent);
sRainmeterTotal = tonumber(sRainmeterTotal);
print("______________________________________________________________________________________")
print("Rainmeter: Actual rain is: " .. sRainmeterCurrent .. " ");
print("Rainmeter: Total rain is: " .. sRainmeterTotal .. " ");
print("______________________________________________________________________________________")
------------------------------------------------------------------------
--UV data:
sSolar = otherdevices_svalues['Solar']:match("([^;]+)")
--sUV = tonumber(sUV);
sSolar = tonumber(sSolar);
--print("UV: UV Strength is: " .. sUV .." ");
print("UV: Solar radiation is: " .. sSolar .." ");
------------------------------------------------------------------------
--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
------------------------------------------------------------------------
if (timeofday['Daytime'])
then
print('It is past sunrise, monitoring variables for sunscreen')
if (otherdevices['Zonnescherm'] == 'Open' )
then
print ('Sunscreen is up')
else
print ('Sunscreen is down')
end
if (otherdevices['Zonnescherm manual override'] == 'Off')
then
print('Manual override is turned off, follow the rest of the script')
else
print('Manual override is turned on, goto the end of the script and do nothing')
goto done
end
if (otherdevices['Zonnescherm'] == 'Open'
and sRainmeterCurrent == 0
and sWeatherTemp > 12.0
and sSolar > 100
and sWindSpeed < 50
and sWindGust < 150)
then
print ('Sun is shining, all thresholds OK, lowering sunscreen')
print('______________________________________________________________________________________')
commandArray['SendNotification']='Sunscreen#Sunscreen down --> Sun is shining'
commandArray['Zonnescherm']='On'
elseif (otherdevices['Zonnescherm'] == 'Closed' and sRainmeterCurrent > 0)
then
print ('It is raining, raising sunscreen')
print('______________________________________________________________________________________')
commandArray['SendNotification']='Sunscreen#Sunscreen up --> It is raining'
commandArray['Zonnescherm']='Off'
elseif (otherdevices['Zonnescherm'] == 'Closed' and sWeatherTemp <11.0 and otherdevices['Zonnescherm manual override'] == 'Off')
then
print ('Temperature too low, raising sunscreen')
print('______________________________________________________________________________________')
commandArray['SendNotification']='Sunscreen#Sunscreen up --> It is too cold'
commandArray['Zonnescherm']='Off'
elseif (otherdevices['Zonnescherm'] == 'Closed' and sSolar < 80 and otherdevices['Zonnescherm manual override'] == 'Off')
then
print ('Sun not shining too bright, raising sunscreen')
print('______________________________________________________________________________________')
commandArray['SendNotification']='Sunscreen#Sunscreen up --> Sunshine not too bright'
commandArray['Zonnescherm']='Off'
elseif (otherdevices['Zonnescherm'] == 'Closed' and sWindSpeed > 50)
then
print ('Windspeed too high, raising sunscreen')
print('______________________________________________________________________________________')
commandArray['SendNotification']='Sunscreen#Sunscreen up --> Windspeed too high'
commandArray['Zonnescherm']='Off'
elseif (otherdevices['Zonnescherm'] == 'Closed' and sWindGust > 150)
then
print ('Windgust too high, raising sunscreen')
print('______________________________________________________________________________________')
commandArray['SendNotification']='Sunscreen#Sunscreen up --> Windgust too high'
commandArray['Zonnescherm']='Off'
else
print('Sunscreen status OK --> No action')
print('______________________________________________________________________________________')
end
::done::
print("At the end of the script")
print("______________________________________________________________________________________")
elseif (timeofday['Nighttime']
and otherdevices['Zonnescherm'] == 'Closed')
then
print('It is night, raising sunscreen')
print('______________________________________________________________________________________')
commandArray['SendNotification']='Sunscreen#Sunscreen up --> It is night'
commandArray['Zonnescherm']='Off'
else
print('Sunscreen already up --> No action')
print('______________________________________________________________________________________')
end
return commandArray