Page 32 of 36
Re: Blockly examples
Posted: Saturday 02 February 2019 10:43
by tozzke
PetervandePol wrote: ↑Saturday 02 February 2019 9:48
tozzke wrote: ↑Thursday 31 January 2019 21:46
PetervandePol wrote: ↑Wednesday 30 January 2019 14:34
Hi,
I am afraid I need some help. I can't figure out how to switch two lamps on between sunset and sunrise with a motion sensor. It works without the time restiction, but I do not want the lights on and off during the day. Based on the examples in this forum I have made this:
But nothing happens

Where do I go wrong?
what @geezerrr and @waaren said with the addition that the Set part should be split in two. So you'll have to add a Set block for YeeLight 1 and another Set block for YeeLight 2, you can't use the 'and' block in the output
Also the 'On for x minutes' doesn't always react as you might think it does. When the device is off when the 'if' is triggered, it'll turn on and after the set time it'll turn off like you'd expect. Is the device already on however (when the 'if' is triggered) it won't turn off but will turn to the state it was at the trigger, so "back"
on in that case.
Thank you, @tozzke.
I changed to:
... and this works to switch "on" but like you predicted the lights do go on, but not off. How do I achieve that then?
The [Time < 23:59] and [Time > 00:00] aren't necessary, you'll accomplish the same with:
Code: Select all
If [ [ [Bewegingsensor keuken] = [On] ] and [ [Time > [Sunset] ] or [Time < [Sunrise] ] ] ]
Do [Set [Yeelight 1] = [On] ]
[Set [Yeelight 2] = [On] ]
[Set [Yeelight 1] = [Off] after [300] seconds]
[Set [Yeelight 2] = [Off] after [300] seconds]
The Do-part will turn the lights on when motion is detected between sunset and sunrise and turn them off after 5 minutes
Re: Blockly examples
Posted: Saturday 02 February 2019 11:16
by PetervandePol
Excellent!! I will try later today. Others in this thread said that working with Sunset and Sunrise could not work; hence the 23:59 and 00:00....
Re: Blockly examples
Posted: Saturday 02 February 2019 11:28
by tozzke
PetervandePol wrote: ↑Saturday 02 February 2019 11:16
Excellent!! I will try later today. Others in this thread said that working with Sunset and Sunrise could not work; hence the 23:59 and 00:00....
Indeed 'and' will not work, it should be 'or'

It can't be past sunset and before sunrise on the same day at once, therefor 'or'
Re: Blockly examples
Posted: Wednesday 06 February 2019 16:12
by Gertschi
Hello,
I don´t know, why my blockly script doesn´t work?

- blockly.JPG (23.64 KiB) Viewed 6315 times
"Heizung" is a selector-switch:

- Heizung.JPG (41.63 KiB) Viewed 6315 times
and "Gert@home" is a normal on/off-switch
Hope that someone can help??
Re: Blockly examples
Posted: Wednesday 06 February 2019 17:24
by tozzke
Gertschi wrote: ↑Wednesday 06 February 2019 16:12
Hello,
I don´t know, why my blockly script doesn´t work?
blockly.JPG
"Heizung" is a selector-switch:
Heizung.JPG
and "Gert@home" is a normal on/off-switch
[email protected]
Hope that someone can help??
With only 1 if statement, you can only use the If-blockly WITHOUT the blue gear icon. When using the one WITH the icon, you HAVE to use else if's
Re: Blockly examples
Posted: Wednesday 06 February 2019 17:29
by Gertschi
I also used this, with no luck???

- Heizung.JPG (33.67 KiB) Viewed 6308 times
Re: Blockly examples
Posted: Wednesday 06 February 2019 18:34
by Gertschi
Has anyone run a blockly script that has linked a "and/or" block to a selector switch in an if-statement???
After a whole day try and error, I think it isn´t possible with blockly??? Because without the selector switch in the if-statement it works.
Re: Blockly examples
Posted: Wednesday 06 February 2019 18:47
by tozzke
Gertschi wrote: ↑Wednesday 06 February 2019 17:29
I also used this, with no luck???
Heizung.JPG
This should work just fine, just tested it myself

Re: Blockly examples
Posted: Wednesday 06 February 2019 18:54
by Gertschi
So where could be the problem, why it does not work for me?
@tozzke: Could I try something else??
Re: Blockly examples
Posted: Wednesday 06 February 2019 19:27
by Gertschi
I found the problem: The selector-switch was the wrongdoer!!!
My selector-switch was created by the ebusd plugin and the 0 Step was the problem.
So I created it manually with my steps and I also created a not possible 0 step...and it worked!!!
@tozzke: Thanks for your assistance!!!
Re: Blockly examples
Posted: Sunday 10 March 2019 3:29
by usbuild
Anyone knows how to add an offset to sunrise and trigger a switch 30 minutes earlier?
Re: Blockly examples
Posted: Sunday 10 March 2019 12:23
by Samael
Is it possible to insert in notification message some kind of line break?
My message for telegram:
Code: Select all
Temperature:{{temperaturedevice[51]}} °C Humidity: {{humiditydevice[51]}} % Pressure: {{barometerdevice[51]}} hPA Balcony: {{temperaturedevice[41]}} °C
Re: Blockly examples
Posted: Thursday 25 April 2019 21:29
by astrapowerrr
Hi,
i have a question witch i cant figure out how to solve this.
Made this blocky,

- Aantekening 2019-04-25 212422.png (163.85 KiB) Viewed 5731 times
but the "problem" is not how it works because it works perfect for me.
but my device log i growing huge…
every minute it updates to the log.
did some braincracking on this but im just blind to see it.
i hope someone else with a fresh view sees how to tackle this..
greets marco
Re: Blockly examples
Posted: Thursday 25 April 2019 21:51
by tozzke
I'd add a integer variable 'mechanische_ventillatie_level' which I'll sync with the level (%) of the switch so you'll get something like:
Code: Select all
If [Klimaat beheersing] = [On] and [CO2 Huiskamer] >= [400] and [CO2 Huiskamer] < [522] and [VAR mechanische_ventillatie_level] ≠ [10]
Do [Set Mechanische Ventillatie Level] = [Level (%) 10]
[Set [VAR mechanische_ventillatie_level] = [10]
Else if [Klimaat beheersing] = [On] and [CO2 Huiskamer] >= [522] and [CO2 Huiskamer] < [644] and [VAR mechanische_ventillatie_level] ≠ [20]
Do [Set Mechanische Ventillatie Level] = [Level (%) 20]
[Set [VAR mechanische_ventillatie_level] = [20]
etc
If your switch 'Mechanische Ventillatie Level' is a selector switch, you can skip the variable and just add the name of each level to the if's
This way each (else) if only triggers once when conditions are met
Re: Blockly examples
Posted: Friday 26 April 2019 17:05
by salopette
Hello, how can I realize it?
From 22.00 on, I would like to see the lamp on the left and on the right and from 6:00 on the lamp on the left, on the right and on the top.
but it does not work that way
Blockly examples
Posted: Friday 26 April 2019 22:59
by astrapowerrr
tozzke wrote:I'd add a integer variable 'mechanische_ventillatie_level' which I'll sync with the level (%) of the switch so you'll get something like:
Code: Select all
If [Klimaat beheersing] = [On] and [CO2 Huiskamer] >= [400] and [CO2 Huiskamer] < [522] and [VAR mechanische_ventillatie_level] ≠ [10]
Do [Set Mechanische Ventillatie Level] = [Level (%) 10]
[Set [VAR mechanische_ventillatie_level] = [10]
Else if [Klimaat beheersing] = [On] and [CO2 Huiskamer] >= [522] and [CO2 Huiskamer] < [644] and [VAR mechanische_ventillatie_level] ≠ [20]
Do [Set Mechanische Ventillatie Level] = [Level (%) 20]
[Set [VAR mechanische_ventillatie_level] = [20]
etc
If your switch 'Mechanische Ventillatie Level' is a selector switch, you can skip the variable and just add the name of each level to the if's
This way each (else) if only triggers once when conditions are met
I will try this.
But what I don’t understand is that var has to be 10 to set ventilation to 10 and set var to 10.
In my brain it’s not possible to event start this switch. Because what will set var to 10 in the first time? To even make a switch possible?
Edit: I see... I should use = and ≠ !!
Verzonden vanaf mijn iPhone met Tapatalk
Re: Blockly examples
Posted: Saturday 04 May 2019 14:31
by salopette
salopette wrote: ↑Friday 26 April 2019 17:05
Hello, how can I realize it?
From 22.00 on, I would like to see the lamp on the left and on the right and from 6:00 on the lamp on the left, on the right and on the top.
but it does not work that way
anyone an idea?
Re: Blockly examples
Posted: Monday 06 May 2019 19:22
by tozzke
salopette wrote: ↑Saturday 04 May 2019 14:31
salopette wrote: ↑Friday 26 April 2019 17:05
Hello, how can I realize it?
From 22.00 on, I would like to see the lamp on the left and on the right and from 6:00 on the lamp on the left, on the right and on the top.
but it does not work that way
anyone an idea?
What exactly doesn't work?
I'd say that you'll have to edit your time settings (and add a safety so it won't keep (re)triggering) so you'll get something like this:
Code: Select all
Else if [Time >= [22:00]] and [XiMotion Sensor BAD] = [On] and [ [BAD-Links LED] = [Off] or [BAD-Rechts LED] = [Off] ]*
Do [Set [BAD-Links LED] = [On]]
[Set [BAD-Rechts LED] = [On]]
Else if [Time >= [6:00]] and [Time < [22:00]] and [XiMotion Sensor BAD] = [On] and [ [BAD-Links LED] = [Off] or [BAD-Untere LED] = [Off] or [BAD-Rechts LED] = [Off] ]*
Do [Set [BAD-Links LED] = [On]]
[Set [BAD-Untere LED] = [On]]
[Set [BAD-Rechts LED] = [On]]
* mind the blocks regarding the or-statement, all the or's have to be in a composed block which you add to the second part of the previous and-block.
Re: Blockly examples
Posted: Monday 06 May 2019 20:49
by salopette
My problem is e.g. that the lights do not come on at 5 o'clock.
Re: Blockly examples
Posted: Monday 06 May 2019 21:37
by tozzke
salopette wrote: ↑Monday 06 May 2019 20:49
My problem is e.g. that the lights do not come on at 5 o'clock.
Do you want to share your entire Blockly? You shared only a part of it