I do this with a lot of trial and error
This is my code now:
Code: Select all
return
{
on =
{
timer =
{
'every 5 minutes',
},
devices =
{
'BR Mogelijk Regen',
'BR Regent het?',
'BR Regen komend uur',
'BR Zonnekracht',
'BR Wind',
},
},
logging =
{
level = domoticz.LOG_DEBUG,
},
execute = function(dz)
local shutter = dz.devices('Zonwering Qubino Shutter')
local possibleRain = dz.devices('BR Mogelijk Regen').state
local raining = dz.devices('BR Regent het?').state
local nextHourRain = tonumber(dz.devices('BR Regen komend uur').sValue)
local sunPower = tonumber(dz.devices('BR Zonnekracht').sValue)
local automaat = dz.devices('Zonwerking automatisch').state
local wind = dz.devices('BR Wind').speedMs
dz.log(shutter.name .. ', state: ' .. tostring(shutter.state) , dz.LOG_DEBUG)
dz.log('BR Mogelijk Regen, state: ' .. tostring(possibleRain) , dz.LOG_DEBUG)
dz.log('BR Regent het?, state: ' .. tostring(raining) , dz.LOG_DEBUG)
dz.log('BR Regen komend uur, value: ' .. tostring(nextHourRain) , dz.LOG_DEBUG)
dz.log('BR Zonnekracht, value: ' .. tostring(sunPower) , dz.LOG_DEBUG)
dz.log('Zonwering automatisch, state: ' .. tostring(automaat) , dz.LOG_DEBUG)
dz.log('BW Wind, value: ' .. tostring(wind) , dz.LOG_DEBUG)
-- Zonwering open
if shutter.state == 'Closed' and automaat == 'On' and dz.time.matchesRule('at 9:30-15:20') and possibleRain == 'Off' and raining == 'Off' and nextHourRain == 0 and sunPower >= 700 and wind <= 7.4 then
shutter.dimTo(50).silent()
-- Zonwering dicht op tijd
elseif shutter.state ~= 'Closed' and automaat == 'On' and dz.time.matchesRule('at 15:30-23:59') then
shutter.dimTo(100).silent()
dz.notify('Zonwering dicht','Het is 15:30, de zonwering gaat dicht', dz.PRIORITY_LOW, dz.SOUND_DEFAULT,nil, dz.NSS_TELEGRAM)
-- Zonwering dicht vanwege mogelijke regen
elseif shutter.state ~= 'Closed' and automaat == 'On' and possibleRain == 'On' then
shutter.dimTo(100).silent()
dz.notify('Zonwering dicht','Het regent volgens Buienradar, de zonwering gaat dicht', dz.PRIORITY_LOW, dz.SOUND_DEFAULT,nil, dz.NSS_TELEGRAM)
-- Zonwering dicht vanwege komend uur regen
elseif shutter.state ~= 'Closed' and automaat == 'On' and nextHourRain > 0 then
shutter.dimTo(100).silent()
dz.notify('Zonwering dicht','Het gaat komend uur regenen volgens Buienradar, de zonwering gaat dicht', dz.PRIORITY_LOW, dz.SOUND_DEFAULT,nil, dz.NSS_TELEGRAM)
-- Zonwering dicht vanwege harde wind
elseif shutter.state ~= 'Closed' and wind > 8.0 then
shutter.dimTo(100).silent()
dz.notify('Zonwering dicht','Het waait te hard volgens Buienradar, de zonwering gaat dicht', dz.PRIORITY_LOW, dz.SOUND_DEFAULT,nil, dz.NSS_TELEGRAM)
end
end
}
No error is the log this time.
I'm not sure about the tonumbers and tostrings. But I will have a look if it is working coming days.
any advice is appreciated! I learn a lot here!

Domoticz 2020.1 (12230) on Raspberry Pi 3B with Raspian Buster. Besides Domoticz, Rpi is running Pi-Hole.