Blockly examples

Must be cleaned all topics go to the right subforum
four2six
Posts: 48
Joined: Wednesday 24 February 2016 10:16
Target OS: Raspberry Pi
Domoticz version:
Location: NRW, Germany
Contact:

Re: Blockly examples

Postby four2six » Monday 19 December 2016 13:28

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: 107
Joined: Sunday 11 December 2016 14:51
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Postby tjabas » Monday 19 December 2016 14:03

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: 48
Joined: Wednesday 24 February 2016 10:16
Target OS: Raspberry Pi
Domoticz version:
Location: NRW, Germany
Contact:

Re: Blockly examples

Postby four2six » Monday 19 December 2016 14:55

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: 107
Joined: Sunday 11 December 2016 14:51
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Postby tjabas » Monday 19 December 2016 15:44

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: 19
Joined: Tuesday 20 December 2016 13:09
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: Amsterdam Nieuwendam
Contact:

light won't go off

Postby edje1205 » Wednesday 21 December 2016 17:17

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 385 times
doorbell light cam script vertragen 2.jpg
doorbell light cam script vertragen 2.jpg (376.4 KiB) Viewed 385 times

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

Re: Blockly examples

Postby StanHD » Wednesday 21 December 2016 17:28

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.
Domotica - Intel nuc Celeron, Domoticz - Windows, RFXTRX433E. 1-Wire USB. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub, HA-Bridge with Amazon Echo / Alexa.

bjacobse
Posts: 21
Joined: Tuesday 06 September 2016 9:08
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Postby bjacobse » Thursday 22 December 2016 10:30

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 362 times

edje1205
Posts: 19
Joined: Tuesday 20 December 2016 13:09
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: Amsterdam Nieuwendam
Contact:

Re: Blockly examples

Postby edje1205 » Thursday 22 December 2016 13:57

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 347 times

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

Re: Blockly examples

Postby StanHD » Thursday 22 December 2016 17:07

Yes you still have nested "If"s, try doing as @bjacobse above. A single "If" with multiple "Else if".
Domotica - Intel nuc Celeron, Domoticz - Windows, RFXTRX433E. 1-Wire USB. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub, HA-Bridge with Amazon Echo / Alexa.

tjabas
Posts: 107
Joined: Sunday 11 December 2016 14:51
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Postby tjabas » Friday 23 December 2016 11:40

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
[/img]
Attachments
kodi.PNG
kodi.PNG (18.21 KiB) Viewed 296 times

User avatar
cyberclwn
Posts: 85
Joined: Thursday 20 August 2015 22:53
Target OS: Raspberry Pi
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Blockly examples

Postby cyberclwn » Friday 23 December 2016 11:53

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: 107
Joined: Sunday 11 December 2016 14:51
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Postby tjabas » Friday 23 December 2016 11:59

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: 422
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Blockly examples

Postby StanHD » Friday 23 December 2016 12:22

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.
Domotica - Intel nuc Celeron, Domoticz - Windows, RFXTRX433E. 1-Wire USB. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub, HA-Bridge with Amazon Echo / Alexa.

edje1205
Posts: 19
Joined: Tuesday 20 December 2016 13:09
Target OS: Raspberry Pi
Domoticz version: 3.5877
Location: Amsterdam Nieuwendam
Contact:

Re: Blockly examples

Postby edje1205 » Friday 23 December 2016 12:45

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


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 286 times

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

Re: RE: Re: Blockly examples

Postby StanHD » Friday 23 December 2016 12:49

Domotica - Intel nuc Celeron, Domoticz - Windows, RFXTRX433E. 1-Wire USB. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub, HA-Bridge with Amazon Echo / Alexa.

tjabas
Posts: 107
Joined: Sunday 11 December 2016 14:51
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Postby tjabas » Friday 23 December 2016 16:06

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.



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: 422
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Blockly examples

Postby StanHD » Friday 23 December 2016 19:17

Similar to this is worth a try:-

Image
Domotica - Intel nuc Celeron, Domoticz - Windows, RFXTRX433E. 1-Wire USB. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub, HA-Bridge with Amazon Echo / Alexa.

tjabas
Posts: 107
Joined: Sunday 11 December 2016 14:51
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Postby tjabas » Friday 23 December 2016 23:18

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: 422
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Blockly examples

Postby StanHD » Friday 23 December 2016 23:20

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

Sent from my SM-G925F using Tapatalk
Domotica - Intel nuc Celeron, Domoticz - Windows, RFXTRX433E. 1-Wire USB. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub, HA-Bridge with Amazon Echo / Alexa.

tjabas
Posts: 107
Joined: Sunday 11 December 2016 14:51
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Postby tjabas » Friday 23 December 2016 23:22

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



thank you :)


Return to “Scripts [cleaning in progress]”

Who is online

Users browsing this forum: No registered users and 2 guests