Page 18 of 36

Re: Blockly examples

Posted: Wednesday 16 November 2016 19:29
by HBrandt
@sailmich
Well my post was more meant like a question as I am new to home automation and Domoticz
But I would think it could look like this.

The two variables is created as Integer and default value 0.
I can see that the variable values change between 0 and 1 according to the program etc. 60 and 120 sec for Exit and Enter.

Can you test if it works in real life

Re: Blockly examples

Posted: Wednesday 16 November 2016 21:04
by sailmich
@HBrandt doesn't work. I can see that the value changed as you say, but doesn't turn the light. I stayed with virtual switches ;).
regards

Re: Blockly examples

Posted: Wednesday 16 November 2016 21:12
by HBrandt
Thanks for the feedback. I did some testing the last hour and came up with the same thing.

Is your working code like the three screen shot you uploaded yesterday?


Mvh Henrik

Re: Blockly examples

Posted: Friday 18 November 2016 5:17
by sailmich
Yes this works.
regards

Re: Blockly examples

Posted: Monday 21 November 2016 6:41
by Lebo2d9
.

Re: Blockly examples

Posted: Tuesday 13 December 2016 8:17
by meanmrgreen
Im trying to get my lights to turn on after sunset, while someone is home, and time is before 23:00
Why doesnt this work?

The Var is working with my phone and is switching correct.
The "hjärta kök" is one of my lights. I added that one to keep it from turning on every 30 secs.

Image

Re: Blockly examples

Posted: Tuesday 13 December 2016 8:24
by StanHD
Can you check the operation without the variable component? Perhaps substitute a dummy switch?

Re: Blockly examples

Posted: Tuesday 13 December 2016 9:48
by four2six
I don't understand why you put the second 'or' part in the first if clause. What is supposed to happen after 2300? And after midnight?

I'd use a dummy switch like "evening light" that turns on with a timer at sunset and turns off at 2300, and use that to simplify your scheme.

Re: Blockly examples

Posted: Tuesday 13 December 2016 10:15
by meanmrgreen
It kind of works now, it just took 30 secs for it to see the variable.

Hmm ill try the dummy thing. Trying to get a hang off this. I just want it to send ONE on command. Not force it to always be on between times.

I can't shut off the lights manually since the light on/off thing.

Re: Blockly examples

Posted: Tuesday 13 December 2016 10:36
by meanmrgreen
four2six wrote:I don't understand why you put the second 'or' part in the first if clause. What is supposed to happen after 2300? And after midnight?

I'd use a dummy switch like "evening light" that turns on with a timer at sunset and turns off at 2300, and use that to simplify your scheme.
The or part is for if the time is between 06 in the morning and before sunrise and someone is home. The lights should turn on.

I want this:
If someone is home or coming home
06-sunrise Or Sundown-23 = lights on one time and off all other times.

If someone is not home it should always be off.


I am using a different blocky to set the
variable and that seems to work as it should.
if anyone's phone comes into wifi = 1
or if everyone's phones is not on wifi = 0

Re: Blockly examples

Posted: Tuesday 13 December 2016 11:02
by four2six
re: your "one switch" remark:
in my example, if you turn off the "evening light" manually, the lights will go off and stay off.

re: your morning remark
this is probably going to be a problem with the "evening lights" dummy switch, as probably there will be times in the year, when the sun is already up at 6 in the morning, so the switch would turn on if you add another timer for it. I guess it all depends where you live in sweden anyway ;-)

i found blockly to have problems with sunset and sunrise, so i stopped using it directly in blockly, just over the timers of dummy switches.

i found it to be more convenient to have a light turn on an hour before sunrise (or after sunset) so i created two switches for that ('1hbeforeSunset' and "1hAfterSunrise') and used them in blockly.

Another workaround might be to not switch it on at 6, but a time before your earliest sunrise in the year. then you could just add two more timers to your 'evening switch' (on at that earlier time and off at sunrise).

And In the end it might be useful to learn something about LUA scripts, as they are way more flexible.

Re: Blockly examples

Posted: Tuesday 13 December 2016 11:28
by meanmrgreen
Thanks! Will experiment with the dummy switches tonight. Looks like a solution.

And yes, I have noticed that blocky have a lot of limitations and odd behavior.

Will dive into lua eventually ;)

Re: Blockly examples

Posted: Monday 19 December 2016 11:01
by tjabas
Hi!

i really in need of some help here.

im trying to set a scene to be inactive during daylight, and the scene should go back to be active during night.
I have read every post in this blockly section but i cant get it at all.
I have a switch that activates the scene, but this is set in the scene programming.

So i want to be able to turn on and of the switch in daylight and the scene wont be triggered, but after dark it will be triggered.

I have tried several settings but none of the work, here´s my last attempt to make it work.
[img]
skyming.PNG
skyming.PNG (10.12 KiB) Viewed 2602 times
[/img]

ignore that block in the bottom, i dont know why it got there.

i would really apreciate some help.

Re: Blockly examples

Posted: Monday 19 December 2016 11:15
by StanHD
Hi,

It may be a good idea to make a "Dummy" Dawn - Dusk switch from the virtual hardware.
Use the in-built switch timers to operate the status using Sunrise - Sunset with delays as appropriate to you.
Then use this switch for any Blockley Scripts something like this?

Image

You can use the Blockley Time Blocks for this, but perhaps this is simpler?

Re: Blockly examples

Posted: Monday 19 December 2016 11:44
by tjabas
StanHD wrote:Hi,

It may be a good idea to make a "Dummy" Dawn - Dusk switch from the virtual hardware.
Use the in-built switch timers to operate the status using Sunrise - Sunset with delays as appropriate to you.
Then use this switch for any Blockley Scripts something like this?

Image

You can use the Blockley Time Blocks for this, but perhaps this is simpler?
thanks!

i tried it exactly as you suggested, i made a dusk switch , but it still wont work.

even if it turn the dusk switch off im still able to start that scene i want to turn off during daylight.

Re: Blockly examples

Posted: Monday 19 December 2016 11:49
by tjabas
is it perhaps possible to make a switch inactive in blockly during a period of time?

Re: Blockly examples

Posted: Monday 19 December 2016 11:51
by four2six
something like this should do.

if 'dawn dusk' = on and 'switch' = on
set scene '1 av' = on
if 'dawn dusk' = off
set scene '1 av' = off

'switch' being the switch you only want to work during sunset to sunrise

Re: Blockly examples

Posted: Monday 19 December 2016 12:03
by tjabas
[img]
larm2.PNG
larm2.PNG (14.46 KiB) Viewed 2580 times
[/img]

I tried that, it didnt work.

i have another switch i domoticz that is called larm, this is aktivated by my bruglar alarm, the alarm sends a 433mhz signal that turns on the alarm switch in domoticz ,this trigger is aktivating the scene that i want to disable during daylight.

when i turn of the alarm when the dark outside the lights in the house will turn on, but the lights wont turn on when its daylight outside.

that is what im trying to accomplish.

Re: Blockly examples

Posted: Monday 19 December 2016 12:10
by four2six
what is the name of the switch you don't want to work during daylight?

Re: Blockly examples

Posted: Monday 19 December 2016 12:11
by tjabas
Its called same as the scene, larmsensor 1