Blockly examples

Moderator: leecollings

four2six
Posts: 53
Joined: Wednesday 24 February 2016 9:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NRW, Germany
Contact:

Re: Blockly examples

Post by four2six »

this should still work, if i understand your setup correctly

if 'skymningsrelä' = on and 'larmsensor 1' = on
set scene 'Larmsensor 1 av' = active
if 'skymningsrelä'' = off
set scene 'Larmsensor 1 av' = inactive
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by tjabas »

Yes its correct, but it doesnt work.

i can still aktivate the trigger that aktivates the scene when skymningningsrelä is set to off.

is it possible to make a switch inactive?
four2six
Posts: 53
Joined: Wednesday 24 February 2016 9:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NRW, Germany
Contact:

Re: Blockly examples

Post by four2six »

i'm not sure anymore i really understood what you want to achieve.

i understood:
switch 'larm' ist activated by your burglar alarm.
the scene 'Larmsensor 1 av' is the scene you want to be able to activated manually with the switch 'Larmsensor 1', but only after sunset and before sunrise.
you have a dummy switch "skymningsrelä" with a timer that is turned off at sunset and turned on at sunrise.

is this correct?

what is the connection between 'larm' and the rest?
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by tjabas »

The switch larm is irrelevant, its a fysical button that i press to turn on the burglar alarm in the house, these things dont have anything to do with Domoticz. The only connection between the burglar alarm and Domoticz is the larmsensor1 switch in Domoticz, the burglar alarm sends an on command to the larmsensor1 switch in Domoticz, but otherwise by your are right in the post above. I hope you undrerstand what i mean.
edje1205
Posts: 30
Joined: Tuesday 20 December 2016 12:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: Amsterdam Nieuwendam
Contact:

light won't go off

Post by edje1205 »

Hello

I'm new here but after a week a junk for domoticz !

So easy but second part wont work
doorbell is pressed
after 5 seconds light goes on

if light is on
send sms with tekst

keep light on for x minutes (here 30 seconds)
send cam snapshot

all well but light keeps on and wont go off ! :roll:

whats wrong ? :oops:

thnx in advance
Attachments
doorbell light cam script vertragen.jpg
doorbell light cam script vertragen.jpg (383.96 KiB) Viewed 2367 times
doorbell light cam script vertragen 2.jpg
doorbell light cam script vertragen 2.jpg (376.4 KiB) Viewed 2367 times
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Blockly examples

Post by StanHD »

The nested "If" Blocks are a problem. Can you redo with a single "If" and multiple "Else-If" structure?
The blocks used for seconds and minutes should be integer not time. (6) seconds, not (06:00) seconds.
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
bjacobse
Posts: 85
Joined: Tuesday 06 September 2016 9:08
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Sorø, DK
Contact:

Re: Blockly examples

Post by bjacobse »

StanHD wrote:The nested "If" Blocks are a problem. Can you redo with a single "If" and multiple "Else-If" structure?
The blocks used for seconds and minutes should be integer not time. (6) seconds, not (06:00) seconds.
Yes I also have problems with nested if-else/if and have done as StanHD proposed with success, to avoid the nested, take a look at mine as proposal how you can do similar blockly
blockly_if_then.png
blockly_if_then.png (125.4 KiB) Viewed 2344 times
edje1205
Posts: 30
Joined: Tuesday 20 December 2016 12:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: Amsterdam Nieuwendam
Contact:

Re: Blockly examples

Post by edje1205 »

StanHD wrote:The nested "If" Blocks are a problem. Can you redo with a single "If" and multiple "Else-If" structure?
The blocks used for seconds and minutes should be integer not time. (6) seconds, not (06:00) seconds.
Thanks for reply Stan !
Now I have this (see att) :

Script: light goes on immediatly ( not after 10 seconds) and I want a relais of 10 sec :?
sms has send
camera snapshot has send
light goes off after 1 minute :)

The starting if (when light = on) is that correct ? if I do when light = off nothing happened; same for all statements so on is logic (?)
but not logic is: when light = on, set light on after 10 seconds (because it's already on). Or what ?


Wait ! I´m struggling with the ´else if´ uhhh


grtz
Attachments
doorbell light cam script vertragen 2a.jpg
doorbell light cam script vertragen 2a.jpg (109.2 KiB) Viewed 2329 times
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Blockly examples

Post by StanHD »

Yes you still have nested "If"s, try doing as @bjacobse above. A single "If" with multiple "Else if".
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by tjabas »

Good morning!

im trying to get some lamps not to turn on during sunrise, yeat active during sunset.
please take a look at this blockly, i cant get it to work.

[img]
kodi.PNG
kodi.PNG (18.21 KiB) Viewed 2278 times
[/img]
User avatar
cyberclwn
Posts: 103
Joined: Thursday 20 August 2015 22:53
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Blockly examples

Post by cyberclwn »

Hi,

I think the main issue here is that "Sunset" is a time. let's say it's "16:27".
So only when you have Kodi paused at 16:27, it will trigger.
Probably you mean "time > sunset" (after sunset)

Also the if looks a bit strange to me.

Code: Select all

If "kodi = ( paused and (time = 16:27 ) ) then ... 
look at the previous post of bjacobse to see the difference in the "if" statement.
3xPi 2B (Domoticz "live", Domoticz "sandbox", PhotoFrame)
RFXCom433(E), KaKu, Oregon Scientific, Keyes 2-relay, Logitech Media Server, MiLight, Smartwares heating controller(2x), IR Send/Receive, Keyes PIR, XH-M131 DuskSensor, DHT22/11
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by tjabas »

yes i mean after sunset :) so the > should be pointing towards the sunset block?

otherwise, did the setup seem to be working?
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Blockly examples

Post by StanHD »

Try:- (Kodi=paused) and (Time = sunset)
not (Kodi=(paused and Time = sunset)

Sometimes setting the options on the "and" block to external inputs makes the logic easier to see / understand.
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
edje1205
Posts: 30
Joined: Tuesday 20 December 2016 12:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: Amsterdam Nieuwendam
Contact:

Re: Blockly examples

Post by edje1205 »

StanHD wrote:Yes you still have nested "If"s, try doing as @bjacobse above. A single "If" with multiple "Else if". Image
Thanks StanH and of course bjacobse (ignored your suggestion :oops: )

This is working !
Easy and what I wanted !

I will read other blockly's (blocklies) to learn later.

Now time for shopping; the wife is waiting :lol: :D :mrgreen:
Attachments
doorbell light cam script vertragen final.jpg
doorbell light cam script vertragen final.jpg (74.04 KiB) Viewed 2268 times
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: RE: Re: Blockly examples

Post by StanHD »

Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by tjabas »

StanHD wrote:Try:- (Kodi=paused) and (Time = sunset)
not (Kodi=(paused and Time = sunset)

Sometimes setting the options on the "and" block to external inputs makes the logic easier to see / understand. Image

thanks for your answer, it didnt work, i cant really tell why, i also have a dummy switch that turns on after sunset and of when sun rises.
i aslo replaced sunset timer with the dummy switch, but neither that one worked.

Is there anyone what would like to make a example blockly of how this would look like?

thank you.
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Blockly examples

Post by StanHD »

Similar to this is worth a try:-

Image
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by tjabas »

StanHD wrote:Similar to this is worth a try:-

Image
thanks

but i dont really know how i would get that big (and) block right beside the (if do) block.
cant find it anywhere.
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Blockly examples

Post by StanHD »

Right click the "and" block and select external inputs.

Sent from my SM-G925F using Tapatalk
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by tjabas »

StanHD wrote:Yes you still have nested "If"s, try doing as @bjacobse above. A single "If" with multiple "Else if". Image

thank you :)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest