Page 19 of 36

Re: Blockly examples

Posted: Monday 19 December 2016 12:28
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

Re: Blockly examples

Posted: Monday 19 December 2016 13:03
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?

Re: Blockly examples

Posted: Monday 19 December 2016 13:55
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?

Re: Blockly examples

Posted: Monday 19 December 2016 14:44
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.

light won't go off

Posted: Wednesday 21 December 2016 16:17
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

Re: Blockly examples

Posted: Wednesday 21 December 2016 16:28
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.

Re: Blockly examples

Posted: Thursday 22 December 2016 9:30
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 2346 times

Re: Blockly examples

Posted: Thursday 22 December 2016 12:57
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

Re: Blockly examples

Posted: Thursday 22 December 2016 16:07
by StanHD
Yes you still have nested "If"s, try doing as @bjacobse above. A single "If" with multiple "Else if".

Re: Blockly examples

Posted: Friday 23 December 2016 10:40
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 2280 times
[/img]

Re: Blockly examples

Posted: Friday 23 December 2016 10:53
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.

Re: Blockly examples

Posted: Friday 23 December 2016 10:59
by tjabas
yes i mean after sunset :) so the > should be pointing towards the sunset block?

otherwise, did the setup seem to be working?

Re: Blockly examples

Posted: Friday 23 December 2016 11:22
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.

Re: Blockly examples

Posted: Friday 23 December 2016 11:45
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:

Re: RE: Re: Blockly examples

Posted: Friday 23 December 2016 11:49
by StanHD

Re: Blockly examples

Posted: Friday 23 December 2016 15:06
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.

Re: Blockly examples

Posted: Friday 23 December 2016 18:17
by StanHD
Similar to this is worth a try:-

Image

Re: Blockly examples

Posted: Friday 23 December 2016 22:18
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.

Re: Blockly examples

Posted: Friday 23 December 2016 22:20
by StanHD
Right click the "and" block and select external inputs.

Sent from my SM-G925F using Tapatalk

Re: Blockly examples

Posted: Friday 23 December 2016 22:22
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 :)