Blockly examples

Must be cleaned all topics go to the right subforum
HBrandt
Posts: 8
Joined: Tuesday 15 November 2016 23:54
Target OS: -
Domoticz version:
Contact:

Re: Blockly examples

Postby HBrandt » Wednesday 16 November 2016 20:29

@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 595 times
ControlExit.PNG
ControlExit.PNG (12.3 KiB) Viewed 595 times
ControlEnter.PNG
ControlEnter.PNG (12.46 KiB) Viewed 595 times

sailmich
Posts: 12
Joined: Wednesday 17 February 2016 23:55
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Postby sailmich » Wednesday 16 November 2016 22:04

@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 23:54
Target OS: -
Domoticz version:
Contact:

Re: Blockly examples

Postby HBrandt » Wednesday 16 November 2016 22:12

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: 12
Joined: Wednesday 17 February 2016 23:55
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Blockly examples

Postby sailmich » Friday 18 November 2016 6:17

Yes this works.
regards

Lebo2d9
Posts: 6
Joined: Tuesday 06 September 2016 20:39
Target OS: Raspberry Pi
Domoticz version: 3.4834
Location: Belgium
Contact:

Re: Blockly examples

Postby Lebo2d9 » Monday 21 November 2016 7:41

.
Running Domoicz on RPI3 (wifi) directly connected 3x ds18b20 for CV temp, Evohome (9 zone), 1 remote 220V switch based on ESP-12.
More to come

meanmrgreen
Posts: 8
Joined: Sunday 13 November 2016 12:05
Target OS: -
Domoticz version:
Contact:

Re: Blockly examples

Postby meanmrgreen » Tuesday 13 December 2016 9:17

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

Re: Blockly examples

Postby StanHD » Tuesday 13 December 2016 9:24

Can you check the operation without the variable component? Perhaps substitute a dummy switch?
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.

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 » Tuesday 13 December 2016 10:48

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: 8
Joined: Sunday 13 November 2016 12:05
Target OS: -
Domoticz version:
Contact:

Re: Blockly examples

Postby meanmrgreen » Tuesday 13 December 2016 11:15

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: 8
Joined: Sunday 13 November 2016 12:05
Target OS: -
Domoticz version:
Contact:

Re: Blockly examples

Postby meanmrgreen » Tuesday 13 December 2016 11:36

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

Re: Blockly examples

Postby four2six » Tuesday 13 December 2016 12:02

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: 8
Joined: Sunday 13 November 2016 12:05
Target OS: -
Domoticz version:
Contact:

Re: Blockly examples

Postby meanmrgreen » Tuesday 13 December 2016 12:28

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

Re: Blockly examples

Postby tjabas » Monday 19 December 2016 12:01

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

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

i would really apreciate some help.
Attachments
skyming.PNG
skyming.PNG (10.12 KiB) Viewed 221 times

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

Re: Blockly examples

Postby StanHD » Monday 19 December 2016 12:15

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

Re: Blockly examples

Postby tjabas » Monday 19 December 2016 12:44

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

Re: Blockly examples

Postby tjabas » Monday 19 December 2016 12:49

is it perhaps possible to make a switch inactive in blockly during a period of time?

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 12:51

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

Re: Blockly examples

Postby tjabas » Monday 19 December 2016 13:03

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

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:10

what is the name of the switch you don't want to work during daylight?

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

Re: Blockly examples

Postby tjabas » Monday 19 December 2016 13:11

Its called same as the scene, larmsensor 1


Return to “Scripts [cleaning in progress]”

Who is online

Users browsing this forum: No registered users and 2 guests