Page 1 of 1
convert blockly to dzvents
Posted: Sunday 24 May 2020 20:35
by AllesVanZelf
Hi all,
I have a Blockly script that I want to convert to a DzVents. It is this one:
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.
I'm hoping that dzvents will solve this issue.
Anyone who can write this script in dzvents? Please!
Re: convert blockly to dzvents
Posted: Monday 25 May 2020 0:21
by waaren
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
}
Re: convert blockly to dzvents
Posted: Monday 25 May 2020 9:11
by AllesVanZelf
Thank you Waaren!!!
I will try this one out and report you back.
Re: convert blockly to dzvents
Posted: Monday 25 May 2020 16:00
by AllesVanZelf
He Waaren,
Thank you again.
This morning the sunscreen opened around 10. This is good. At that point the sun became strong enough.

And at 15:30 the sunscreen closed in one run till 100% what is closed. This is good too!! Very good.
What is the difference between the blockly and dzvents scripts?? The blockly is almost the same is it not? Strange that the dzvents closes in one run and the blockly in steps of 1% a time.
Re: convert blockly to dzvents [Solved]
Posted: Tuesday 26 May 2020 1:42
by waaren
AllesVanZelf wrote: Monday 25 May 2020 16:00
What is the difference between the blockly and dzvents scripts?? The blockly is almost the same is it not? Strange that the dzvents closes in one run and the blockly in steps of 1% a time.
My guess is that the Blockly called itself many times because the sunscreen was one of the devices of which the state needed to be compared. So if the Blockly changes the state of the sunscreen the Blockly triggered again etc....
The dzVents script does not trigger on a changed state of the sunscreen.