Blockly examples

Moderator: leecollings

sion
Posts: 113
Joined: Friday 08 January 2016 12:32
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Blockly examples

Post by sion »

tjabas wrote:Hi!

i have made this simple blocky, it is supposed to turn of the fan to my stove when the air temperature goes below 25 degrees celcius, this works very well, but i have problem when i want to start the fan when the air is cold, below 25 degrees the fan turns of emediately, i have to keep a fire in the stove for about 10 minutes before the fan stops from turning off.

is it possible to do it like this , when the air temp reaches 30 degrees then the blocky ive made turns active?
[img]kamin.PNG[/img]
Using variables would be the neatest way to do this, but you could possibly use a dummy switch that is turned on when the stove reaches 30 degrees.

Then just add "and this switch=on" into your first line.
Then remember to switch "this switch" off when the fan goes off.

This way the script will only run if the stove has at least been over 30 degrees.
running domoticz 3.4834 on rpi2, with
Hue bridge / bulbs.
lightwave rf sockets, mood controlers, sensors & contacts.
Home bridge / Siri.
Ha bridge / echo Alexa.
Hard wired alarm system - setting home / away status.

Next: harmony hub.
edje1205
Posts: 30
Joined: Tuesday 20 December 2016 12:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: Amsterdam Nieuwendam
Contact:

Re: Blockly examples

Post by edje1205 »

I will set lamps group on at moday till friday on at a certain time, (not in the weekends) and when off
if on yet norhing may happen

My logics in blockly were:

Code: Select all

 if on certain time and its Monday till Friday and groups is off then do group on
nothing happended :lol:

little help if possible

thnx !
Attachments
set lights on if.png
set lights on if.png (127.18 KiB) Viewed 4249 times
elmortero
Posts: 247
Joined: Sunday 29 November 2015 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9639
Location: Spain
Contact:

Re: Blockly examples

Post by elmortero »

edje1205 wrote: My logics in blockly were:

Code: Select all

 if on certain time and its Monday till Friday and groups is off then do group on
nothing happended :lol:
If for some reason events skip a beat and miss 11:37 it will not trigger, to build in a safety you could put it between timeX and timeY
In your case it will also only trigger if none of mentioned lights are on (but I guess you know that).
blcok.JPG
blcok.JPG (45.2 KiB) Viewed 4237 times
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 »

@edj1205,

Also note you have used an If, else if, block (with the blue symbol in the top left) but without an else if. For this situation you should use the single If block without the blue symbol. ;)
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
edje1205
Posts: 30
Joined: Tuesday 20 December 2016 12:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: Amsterdam Nieuwendam
Contact:

Re: Blockly examples

Post by edje1205 »

Thnx both of you.

Oke maybe the first attachement was a little bit blurring and over the top

I tried in another way see att
without the last 'and' (huiskamer staande lamp = off) it runs, so now I split it off in if's and else if's
but the last 'and' frustrate it.
Attachments
set lights on if 2.png
set lights on if 2.png (40.12 KiB) Viewed 4209 times
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 »

the last 'and' in every line is one level lower as the other 'and's. that could be a problem.
edje1205
Posts: 30
Joined: Tuesday 20 December 2016 12:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: Amsterdam Nieuwendam
Contact:

Re: Blockly examples

Post by edje1205 »

I do realize something s wrong with the structure but what ever I try it's not like the one from elmotero (see att2)
domoticz is last version 3.5877

wonder how to change structure logic and control see att1 :oops:
Attachments
logic control.png
logic control.png (26.78 KiB) Viewed 4195 times
samole blockly.png
samole blockly.png (72.09 KiB) Viewed 4195 times
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Blockly examples

Post by tozzke »

tjabas wrote:]i did it like this: [img]Skärmklipp.PNG[/img]
and now check your log... this will constantly trigger as long as the temperature is between those values and switch that switch off...
The log will be flooded (or you'll have to choose for a time-blockly (does that even work @ blockly? of only @ lua?))
If the switch you're turning off is a 433MHz device, you might encounter some issues when you want to switch other devices (because 433MHz keeps sending it's signal for a few seconds in which you can't send/receive another command)
edje1205 wrote:I do realize something s wrong with the structure but what ever I try it's not like the one from elmotero (see att2)
domoticz is last version 3.5877

wonder how to change structure logic and control see att1 :oops:
right click on block and click 'external inputs'
tnegun
Posts: 11
Joined: Tuesday 27 December 2016 16:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.6328
Location: Ireland
Contact:

Re: Blockly examples

Post by tnegun »

tozzke wrote:right click on block and click 'external inputs'
Just for my info thats purely visual, it doesn't affect the logic right?
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Blockly examples

Post by tozzke »

tnegun wrote:
tozzke wrote:right click on block and click 'external inputs'
Just for my info thats purely visual, it doesn't affect the logic right?
correct :)
sometimes it makes it easier to read and in very long blocklies it makes it more compact
tnegun
Posts: 11
Joined: Tuesday 27 December 2016 16:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.6328
Location: Ireland
Contact:

Re: Blockly examples

Post by tnegun »

tozzke wrote: correct :)
sometimes it makes it easier to read and in very long blocklies it makes it more compact
Thanks!
edje1205
Posts: 30
Joined: Tuesday 20 December 2016 12:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: Amsterdam Nieuwendam
Contact:

Re: Blockly examples

Post by edje1205 »

tozzke wrote:
tnegun wrote:
tozzke wrote:right click on block and click 'external inputs'
<br abp="431">Just for my info thats purely visual, it doesn't affect the logic right?
<br abp="432">correct :)<br abp="433">sometimes it makes it easier to read and in very long blocklies it makes it more compact
hmm nothing on that !?
this is what I see right clicking see att
Attachments
right click blocks.png
right click blocks.png (34.79 KiB) Viewed 4123 times
tnegun
Posts: 11
Joined: Tuesday 27 December 2016 16:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.6328
Location: Ireland
Contact:

Re: Blockly examples

Post by tnegun »

Right click on the logic block
mabo21
Posts: 8
Joined: Saturday 07 January 2017 17:17
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Blockly examples

Post by mabo21 »

Hi,

i would like to turn the light on after sunset and before 00:30 ( half past midnight ) and if Lux is under 15. Between 00:30 and 17:00 the light should be off. Anything i am doing wrong... The light is not turning on. Anybody an idea?

Thanks,
Mario

Image
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Blockly examples

Post by tozzke »

mabo21 wrote:Hi,

i would like to turn the light on after sunset and before 00:30 ( half past midnight ) and if Lux is under 15. Between 00:30 and 17:00 the light should be off. Anything i am doing wrong... The light is not turning on. Anybody an idea?

Thanks,
Mario

Image
Try:

Code: Select all

If [Time > Sunset] or* [Time < 0:30] and [Lux < 15] and [Light = Off]**
Do [Set Light = On]
Else if [Time > 0:30] and [Time < 17:00] and [Light = On]**
Do [Set Light = Off]
Sunset and Sunrise are times in Domoticz, so you'll have to use the 'Time ='-Blockly

* OR because a day (@ Domoticz) is from 0:00 till 24:00 which means it can't be past sunset AND before 0:30 on the same day
** Check whether de light you want to switch on/off is the opposite state you want to switch it to. Else it'll trigger continuously. Now it'll only trigger when the light isn't the state you want it to be
mabo21
Posts: 8
Joined: Saturday 07 January 2017 17:17
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Blockly examples

Post by mabo21 »

tozzke wrote:
mabo21 wrote:Hi,

i would like to turn the light on after sunset and before 00:30 ( half past midnight ) and if Lux is under 15. Between 00:30 and 17:00 the light should be off. Anything i am doing wrong... The light is not turning on. Anybody an idea?

Thanks,
Mario

Image
Try:

Code: Select all

If [Time > Sunset] or* [Time < 0:30] and [Lux < 15] and [Light = Off]**
Do [Set Light = On]
Else if [Time > 0:30] and [Time < 17:00] and [Light = On]**
Do [Set Light = Off]
Sunset and Sunrise are times in Domoticz, so you'll have to use the 'Time ='-Blockly

* OR because a day (@ Domoticz) is from 0:00 till 24:00 which means it can't be past sunset AND before 0:30 on the same day
** Check whether de light you want to switch on/off is the opposite state you want to switch it to. Else it'll trigger continuously. Now it'll only trigger when the light isn't the state you want it to be
Thanks tozzke, that way it work!
plantjes
Posts: 7
Joined: Friday 18 November 2016 20:57
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Contact:

Re: Blockly examples

Post by plantjes »

Hi,
I am strugeling with the varialble options in blocky.
I see an option for variable but i have no devices in it.
Where can i make a var device??

I would like to use it for preventing double actions in setting a value to this variable...

If it needs to go in lua i need help as i do not use lua (up to now.)

Best regards
Benno
User avatar
Domosapiens
Posts: 232
Joined: Wednesday 20 August 2014 12:08
Target OS: Windows
Domoticz version: V3.5981
Location: NL
Contact:

Re: Blockly examples

Post by Domosapiens »

Go to Setup -> More Options -> User variables.
There you can create them.
Win Vista&7; 1#Aeon Z-Stick S2; 1#Aeotec Z-Sick Gen5, 6#Fib.FGBS001; 24#DS18B20; 8#Everspr.AN158-2; 3#Philio PAN04; 1#Philio PAN06, 1#YouLess El; 1#Fib.FGWPE; 1#ZME_RC2; 2#FAK_ZWS230, 2#Quib.ZMNHCDx, 1#Quib.ZMNHDD1, 7#EM6555
edje1205
Posts: 30
Joined: Tuesday 20 December 2016 12:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Location: Amsterdam Nieuwendam
Contact:

Re: Blockly examples

Post by edje1205 »

Hi

at least i got my Kaku dusk sensor abst-604 recognized in domoticz :)

Now I want:

A) My lights go on different times in week daily (some later) and weekend (some earlier)

But It could be grey/duskey outside so when its dark enough the dusksensor has to start
BUT
not running as A) is active because my lights go dimming down/up

see my blockly but it does nothing
(when I click on dusk sensor and have a light connected with it with the sensor setup it goes on/off. there are no devices connected with it)

thanx for suggestions !
Attachments
dusk script.jpg
dusk script.jpg (92.27 KiB) Viewed 3858 times
tozzke
Posts: 135
Joined: Friday 02 January 2015 9:22
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Blockly examples

Post by tozzke »

edje1205 wrote:Hi

at least i got my Kaku dusk sensor abst-604 recognized in domoticz :)

Now I want:

A) My lights go on different times in week daily (some later) and weekend (some earlier)

But It could be grey/duskey outside so when its dark enough the dusksensor has to start
BUT
not running as A) is active because my lights go dimming down/up

see my blockly but it does nothing
(when I click on dusk sensor and have a light connected with it with the sensor setup it goes on/off. there are no devices connected with it)

thanx for suggestions !
It does not trigger because it's incorrect ;)
Don't use the time (00:00) blockly for indicating seconds/minutes and mind the place where you put the conditions the [x = On] block has to be in 1 block... not seperated into 2 (I marked the part which is wrong).
Image
Try this:

Code: Select all

If [[[Dusk sensor switch] = [On]] and [[Huiskamer televisie lamp] = [Off]]]
Do [Set [Huiskamer televisie lamp] = [On] After [10] seconds]
Else if [[[Dusk sensor switch] = [On]] and [[Huiskamer staande lamp] = [On]]]
Do [Set group [Huiskamer voor 2 week] = [On]]
mind the brackets!
Groups switch on and off, you don't set them active/inactive (I'm not even sure when to use the (in)active option)
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests