[SOLVED] Newby Blocky: evaluation fails

Moderator: leecollings

Post Reply
michaelb
Posts: 14
Joined: Wednesday 25 January 2017 19:37
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

[SOLVED] Newby Blocky: evaluation fails

Post by michaelb »

Hi,

I'm fairly good at programming but new to Domoticz and Blocky. I'm trying to create a script that turns on a light if the following conditions are met:
- Frontdoor [voordeur] (switch) set to open
- Time is between 22:00 and 23:59
- Light at staircase [trap] (dimmer) = off

Below the Blocky build (name=Voordeur):
Blocky Script
Blocky Script
BlockyFault.JPG (90.96 KiB) Viewed 764 times
When triggering the event (door opens) however the if's, other than the first are not correcty evaluated, so no matter what the time is, nor what the state of [trap] is, the action is performed always:

Logfile:

Code: Select all

2017-01-27 19:55:31.452 EventSystem: Event triggered: Voordeur_1 
2017-01-27 19:55:31.452 Voordeur open 
2017-01-27 19:55:31.453 Tijd 22:00-23:59 
2017-01-27 19:55:31.453 Licht bij trap is uit: tijdelijk aan 
What am I doing wrong?
Thanks in advance for the help.
Last edited by michaelb on Friday 27 January 2017 21:17, edited 1 time in total.
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Newby Blocky: evaluation fails

Post by StanHD »

Nested Blockly doesn't work. You need to redo it with a single "If - Else If - Else If ..... Etc. " Block. It will work then. Have a look at recent Blockly examples on the forum.
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
User avatar
Ben0it
Posts: 17
Joined: Sunday 31 January 2016 21:22
Target OS: Linux
Domoticz version: 3.6745
Location: France
Contact:

Re: Newby Blocky: evaluation fails

Post by Ben0it »

Hi,

I had a similar problem using a nested « If-Do » with the settings icon (light gear over a blue square) inside a standard « If-Do » block. Actions were always run inside, disregard of the condition(s) of the « If ».

I couldn't solve this using Blockly, so I switched to LUA scripting, now it is fine.

Best Regards,
-
Benoît.
michaelb
Posts: 14
Joined: Wednesday 25 January 2017 19:37
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Newby Blocky: evaluation fails

Post by michaelb »

Thanks for the quick response guys!

Per StanHD's advice I've rewritten the Blockly to one If/Else loop.

Works like a charm!

Michael
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest