Page 1 of 1
Question - Sunscreen blockly
Posted: Sunday 11 June 2017 14:10
by Bishop
Hello!
Quite new to Domoticz but I am having a blast. So much fun to tinker with the house.
I am creating a blockly to automate the sunscreen (Awning) in the garden.
The goal:
If the sunscreen is not down (Off or Stop) AND it's between 11:00 and 20:00 AND it isn't raining AND it's 18+c outside AND UV is equal or more then 1 --> Go down (On)
If it rains go up, only if On or Stop (So when it's down halfway or completely)
If IsDark (1 hour before sunset) is On go up. (Off)
At the moment it does not seem to respond.
It does respond if I remove the Off or Stop part.
I have tried different variations for Off Stop On commands. The sunscreen seems to respond to on and off signals. Can someone help me out?
I have looked at various LUA scripts on this forum but, to me, they seem quite complicated and I have no clue what to fill in to make those work.
Can someone tell me what I am doing wrong?

Re: Question - Sunscreen blockly
Posted: Sunday 11 June 2017 14:17
by tozzke
you can't use 'if [switch] = [off or stop]', you'll have to use 'if [switch] = [off] or [switch] = [stop]'
Re: Question - Sunscreen blockly
Posted: Sunday 11 June 2017 14:18
by Bishop
tozzke wrote:you can't use 'if [switch] = [off or stop]', you'll have to use 'if [switch] = [off] or [switch] = [stop]'
Ok! I will try that!
The rest seems fine to you?
Re: Question - Sunscreen blockly
Posted: Sunday 11 June 2017 21:04
by Bishop
So far it seems to work!
Does anyone know if I can make something that does:
'if [UV] = [0 for 30 minutes] then [set Awning] = [Open]
I don't know how to build a blockly that counts the amount of minutes that UV has been 0.
Re: Question - Sunscreen blockly
Posted: Sunday 11 June 2017 21:14
by Derik
you have to test your blockleys in a very small setup..
First try a working uv switch
Try a time between setting
try x and y etc.
Read the LOG everytime....
Is there in the log the setting you like?
Then make step by step the master blockley.
Re: Question - Sunscreen blockly
Posted: Monday 12 June 2017 6:43
by tozzke
Bishop wrote:So far it seems to work!
Does anyone know if I can make something that does:
'if [UV] = [0 for 30 minutes] then [set Awning] = [Open]
I don't know how to build a blockly that counts the amount of minutes that UV has been 0.
Blockly can't do that directly in the if-statement, lua can.
You could however use a variable which you put in a blockly (Time) which will look something like this:
Code: Select all
If [UV] = [0] and [Awning] = [Closed] and [DummyVariable] = [1]
Do [Set [DummyVariable] = [0]]
[Set [Awning] = [Off] After 1800 seconds]
Else if [UV] ≠ [0] and [Awning] = [Closed] and [DummyVariable] ≠ [1]
Do [Set [DummyVariable] = [1]]
[Set [Awning] = [On]]
You could add this to an if-statement which you already have (the first from your screenshot) and you'll have to change this variable in another if-statement to 1 (or the other way around, whatever you like) when the screen is down (the 2nd and 3rd from your blockly).
This way the screen will go up after 30 minutes when the UV = 0 and won't retrigger because of the variable.
When the 'Else if' triggers, it sets the screen to open again (which it already is) and aborts the '[Set [Awning] = [Off] After 1800 seconds]'
Re: Question - Sunscreen blockly
Posted: Monday 12 June 2017 16:33
by Bishop
tozzke wrote:Blockly can't do that directly in the if-statement, lua can.
You could however use a variable which you put in a blockly (Time) ... etc
I read what you said a couple of times and I think I get it. The variable you mention is a line of text I can make up? Like "UVTimer"?
So it would become:
Code: Select all
If [UV] = [0] and [Awning] = [Closed] and [UVTimer] = [1]
Do [Set [UVTimer] = [0]]
[Set [Awning] = [Off] After 1800 seconds]
Else if [UV] ≠ [0] and [Awning] = [Closed] and [UVTimer] ≠ [1]
Do [Set [UVTimer] = [1]]
[Set [Awning] = [On]]