Blockly examples

Moderator: leecollings

HBrandt
Posts: 8
Joined: Tuesday 15 November 2016 22:54
Target OS: -
Domoticz version:
Contact:

Re: Blockly examples

Post 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
Attachments
EntryExit.PNG
EntryExit.PNG (41.49 KiB) Viewed 2972 times
ControlExit.PNG
ControlExit.PNG (12.3 KiB) Viewed 2972 times
ControlEnter.PNG
ControlEnter.PNG (12.46 KiB) Viewed 2972 times
sailmich
Posts: 232
Joined: Wednesday 17 February 2016 22:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Germany
Contact:

Re: Blockly examples

Post 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
HBrandt
Posts: 8
Joined: Tuesday 15 November 2016 22:54
Target OS: -
Domoticz version:
Contact:

Re: Blockly examples

Post 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
sailmich
Posts: 232
Joined: Wednesday 17 February 2016 22:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Germany
Contact:

Re: Blockly examples

Post by sailmich »

Yes this works.
regards
Lebo2d9
Posts: 139
Joined: Tuesday 06 September 2016 20:39
Target OS: Raspberry Pi / ODroid
Domoticz version: L stab
Location: Belgium
Contact:

Re: Blockly examples

Post by Lebo2d9 »

.
Domoicz on RPI3 (wifi) directly connected 3x ds18b20 for CV temp, Evohome (9 zone), 1 remote 220V switch based on ESP-12. RFXtrx433E, 16x AMST-606, 5 Somfy RTS motors
Domoticz on RPI3(wifi) as slave for terraruim control
More to come
meanmrgreen
Posts: 9
Joined: Sunday 13 November 2016 11:05
Target OS: -
Domoticz version:
Contact:

Re: Blockly examples

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

Can you check the operation without the variable component? Perhaps substitute a dummy switch?
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
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 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.
meanmrgreen
Posts: 9
Joined: Sunday 13 November 2016 11:05
Target OS: -
Domoticz version:
Contact:

Re: Blockly examples

Post 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.
meanmrgreen
Posts: 9
Joined: Sunday 13 November 2016 11:05
Target OS: -
Domoticz version:
Contact:

Re: Blockly examples

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

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.
meanmrgreen
Posts: 9
Joined: Sunday 13 November 2016 11:05
Target OS: -
Domoticz version:
Contact:

Re: Blockly examples

Post 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 ;)
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post 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 2598 times
[/img]

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

i would really apreciate some help.
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 »

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?
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: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.
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by tjabas »

is it perhaps possible to make a switch inactive in blockly during a period of time?
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 »

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
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by tjabas »

[img]
larm2.PNG
larm2.PNG (14.46 KiB) Viewed 2576 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.
Last edited by tjabas on Monday 19 December 2016 12:10, edited 1 time in total.
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 »

what is the name of the switch you don't want to work during daylight?
tjabas
Posts: 564
Joined: Sunday 11 December 2016 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by tjabas »

Its called same as the scene, larmsensor 1
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests