Blockly examples

Moderator: leecollings

tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Blockly examples

Post 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:

Image

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:

Image

... 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
User avatar
PetervandePol
Posts: 23
Joined: Wednesday 09 January 2019 11:24
Target OS: Linux
Domoticz version:
Location: Scherpenzeel, GLD, NL
Contact:

Re: Blockly examples

Post 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....
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Blockly examples

Post 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'
Gertschi
Posts: 15
Joined: Monday 07 January 2019 12:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Austria
Contact:

Re: Blockly examples

Post by Gertschi »

Hello,

I don´t know, why my blockly script doesn´t work?

blockly.JPG
blockly.JPG (23.64 KiB) Viewed 5509 times


"Heizung" is a selector-switch:

Heizung.JPG
Heizung.JPG (41.63 KiB) Viewed 5509 times

and "Gert@home" is a normal on/off-switch

Gert@home.JPG
[email protected] (39.01 KiB) Viewed 5509 times


Hope that someone can help??
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Blockly examples

Post 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
Gertschi
Posts: 15
Joined: Monday 07 January 2019 12:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Austria
Contact:

Re: Blockly examples

Post by Gertschi »

I also used this, with no luck???
Heizung.JPG
Heizung.JPG (33.67 KiB) Viewed 5502 times
Gertschi
Posts: 15
Joined: Monday 07 January 2019 12:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Austria
Contact:

Re: Blockly examples

Post 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.
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Blockly examples

Post 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
Image
Gertschi
Posts: 15
Joined: Monday 07 January 2019 12:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Austria
Contact:

Re: Blockly examples

Post by Gertschi »

So where could be the problem, why it does not work for me?

@tozzke: Could I try something else??
Gertschi
Posts: 15
Joined: Monday 07 January 2019 12:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Austria
Contact:

Re: Blockly examples

Post 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!!!
usbuild
Posts: 4
Joined: Wednesday 06 March 2019 7:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by usbuild »

Anyone knows how to add an offset to sunrise and trigger a switch 30 minutes earlier?
Samael
Posts: 27
Joined: Saturday 12 January 2019 11:48
Target OS: Windows
Domoticz version: 4.9701
Contact:

Re: Blockly examples

Post 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
astrapowerrr
Posts: 141
Joined: Tuesday 31 January 2017 20:34
Target OS: -
Domoticz version:
Contact:

Re: Blockly examples

Post 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
Aantekening 2019-04-25 212422.png (163.85 KiB) Viewed 4925 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
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Blockly examples

Post 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
salopette
Posts: 187
Joined: Tuesday 07 March 2017 21:03
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Germany
Contact:

Re: Blockly examples

Post 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
Attachments
sshot-2019-04-26-[1].jpg
sshot-2019-04-26-[1].jpg (111.04 KiB) Viewed 4898 times
astrapowerrr
Posts: 141
Joined: Tuesday 31 January 2017 20:34
Target OS: -
Domoticz version:
Contact:

Blockly examples

Post 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
salopette
Posts: 187
Joined: Tuesday 07 March 2017 21:03
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Germany
Contact:

Re: Blockly examples

Post 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?
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Blockly examples

Post 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
Image
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.
salopette
Posts: 187
Joined: Tuesday 07 March 2017 21:03
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Germany
Contact:

Re: Blockly examples

Post by salopette »

My problem is e.g. that the lights do not come on at 5 o'clock.
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Blockly examples

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest