AllesVanZelf wrote: Sunday 24 May 2020 20:35
Hi all,
I have a Blockly script that I want to convert to a DzVents.
I want to try this in DzVents because this blockly script does work for opening the sunscreen and it is closing the suncreen, but closing is going 1% by 1%. So closing from 30%, 31%, 32% etc. till 100% - what is closed. That makes it very slow.
Happy to help but I don't understand why the slowness occurs in the Blockly so might well be that the dzVents script does not solve that.
Can you try this one (untested)
Code: Select all
return
{
on =
{
timer =
{
'every 5 minutes',
},
devices =
{
'BR Mogelijk Regen',
'BR Regent het?',
'BR Regen komend uur',
'BR Zonnekracht',
},
},
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)
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)
if shutter.state == 'Closed' and dz.time.matchesRule('at 9:30-15:20') and possibleRain == 'Off' and raining == 'Off' and nextHourRain == 0 and sunPower >= 500 then
shutter.dimTo(45).silent()
elseif shutter.state ~= 'Closed' and dz.time.matchesRule('at 15:30-23:59') then
shutter.dimTo(100).silent()
elseif shutter.state ~= 'Closed' 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)
elseif shutter.state ~= 'Closed' and nextHourRain > 0 then
shutter.dimTo(100).silent()
dz.notify('Zonwering dicht','Het gaat komen uur regenen volgens Buienradar, de zonwering gaat dicht', dz.PRIORITY_LOW, dz.SOUND_DEFAULT,nil, dz.NSS_TELEGRAM)
end
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>>
dzVents wiki