Timers do not work - in Blocky and in general

Post Reply
hoff
Posts: 7
Joined: Monday 30 January 2017 19:31
Target OS: -
Domoticz version:
Contact:

Timers do not work - in Blocky and in general

Post by hoff » Monday 30 January 2017 19:43

Hello,

since about two weeks I've got Domoticz and in general, this is an impressive piece of software. I keep discovering new functions and possibilities almost every day.

However, there's one thing I still can't get my head around: TIMERS!

In Blocky, simple "if"-conditions work, like if SENSOR = on >> set LIGHT to ON for 1 Minutes

But if I add another if-condition that makes sure that the light is only switched on after sunset or before sunrise, this if-condition gets ignored.

An example is this Blocky script:
Image

In general, I can't set timers. Even if I try to set up this timer via scenes, it won't work. in scenes, I can't even set an 'off' rule.

What da heck am I doing wrong?

I was on the latest stable release since about an hour ago. I thought it might be a bug, so I upgraded to the latest beta version 6562 (I think). After a restart, it was still the same. My system is an Ubuntu 14.04 LTS that also runs various other servers (like a file server). Time is set correctly and is also shown correctly in Domoticz.

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

Re: Timers do not work - in Blocky and in general

Post by StanHD » Monday 30 January 2017 20:08

Hi, you can't use nested "if" blocks in Blockly. Also your inner "if" block is the wrong type as used. A single if - do should not have the blue symbol.

Try:- If [fibaro = on] and [Time <.... or Time> .....]
Do [set ..........]

Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Domoticz Slave - Asrock Ion - Linux, Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa

hoff
Posts: 7
Joined: Monday 30 January 2017 19:31
Target OS: -
Domoticz version:
Contact:

Re: Timers do not work - in Blocky and in general

Post by hoff » Monday 30 January 2017 20:44

Nested if-blocks don't work at all? Why not?

Do nested if-conditionals work in lua or python?

I just tried what you suggested ... and it worked ... nice! Thx!

But nevertheless, I don't get why I cannot use nested if-blocks ...

hoff
Posts: 7
Joined: Monday 30 January 2017 19:31
Target OS: -
Domoticz version:
Contact:

Re: Timers do not work - in Blocky and in general

Post by hoff » Monday 30 January 2017 21:05

Alright, new problem. The following script works for turning the light bulb on during the time frame given. However, the light is not turned off after one minute.

Image

Oh, and I just realized that even if there is no movement in the hallway, the light turns on ... randomly ... wtf?!

UPDATE: Okay, the phenomenon that it randomly turned on is gone now ... for whatever reason. Maybe it was just temporarily.

BUT: The light still won't turn off again after one minute, even though the code block is the right one. The question is ... WHY?

UPDATE 2: The script seems to send a command to the bulb after one minute, however, it's the wrong one:

2017-01-30 21:03:05.276 OpenZWave: Domoticz has send a Switch command!, Level: 79, NodeID: 16 (0x10)
2017-01-30 21:03:05.276 (Z-Wave) Light/Switch (Schlafzimmer - Domitech Smart LED - Dimmer)

It SHOULD send a command with "Level: 0" but it actually sends one with "Level: 79". I have no idea why ... BUG?!
By the way ... the fact that the bulb turned on randomly is related to the wrong signal being sent. I switched off the bulb manually because I realized it doesn't turn off by itself while testing. The wrong command turned it on again. So the question remains: Why does the script trigger the wrong "Level" being sent?

kalinkamaen
Posts: 92
Joined: Sunday 04 January 2015 16:57
Target OS: Windows
Domoticz version: 4.900
Location: Norway
Contact:

Re: Timers do not work - in Blocky and in general

Post by kalinkamaen » Tuesday 31 January 2017 10:33

Hello sir, i am not sure it this is a bug or not. But i want to help you to manage what you want.
As blocky works, do not think this setup you have here will work.

If you want to have this working i blocky, i would made a virtuell switch called "sunset switch" or what ever you want.
And then go in to timers on that switch and set it to switch on at sunset and off at sunrise <-- or the opposite. Then I would
include the switch in blocky like this:

Image
Windows 7, Domoticz 4.9700

hoff
Posts: 7
Joined: Monday 30 January 2017 19:31
Target OS: -
Domoticz version:
Contact:

Re: Timers do not work - in Blocky and in general

Post by hoff » Tuesday 31 January 2017 20:24

Well, kalinkamaen ... thanks for your idea.

I'm actually trying that right now. Looks promising atm.

I have two identical setups, one in the hallway, the other one in the bedroom. I use the second one to try something else: I could use the switch from the Fibaro motion sensor and set a timer directly there. Also trying that option.

However, what I do not understand: Why are the scripting possibilities so limited? I mean why can't I use nested if-blocks and other methods that are possible in "ordinary coding?

I'll report back if your idea with the virtual switch and the timer directly at the switch of the movement sensor worked.

Thanks for the idea again.

Regards
Nils

hoff
Posts: 7
Joined: Monday 30 January 2017 19:31
Target OS: -
Domoticz version:
Contact:

Re: Timers do not work - in Blocky and in general

Post by hoff » Tuesday 31 January 2017 20:28

ARGH!

I'm such an idiot ... I just realized what a stupid idea it was to set a timer for the movement switch ... I thought it might actually activate or deactivate the functionality of the movement sensor, but it just override the on/off signal of the sensor. D'oh!

Therefore, I need a virtual switch.

UPDATE: The virtual switch works. However, it did not solve the main problem: The light stays on after one minute. Domoticz keeps sending the wrong "Level:" to the bulb. Instead of Sending "Level: 0" after one minute to switch off the bulb, it keeps sending the level reported above.

Any other ideas what could cause this problem?

hoff
Posts: 7
Joined: Monday 30 January 2017 19:31
Target OS: -
Domoticz version:
Contact:

Re: Timers do not work - in Blocky and in general

Post by hoff » Tuesday 31 January 2017 21:18

Reply to myself :-)

I found the problem. Seems like the motto of Apple fits here: "It's not a bug, it's a feature" XD

I realized that Domoticz did not set the brightness back to "Level: 0" but to a strange percentage of "Level: 83" (or something). That brightness was set in the "switch section" of Domotics. After lowering the dimmer bar to "0", the lights turn off correctly. I was not aware that the dimmer in the switch section is used as a "standard" that is set after the "one minute" rule is over. I hope I could describe the phenomenon so others understand and can avoid this problem.

Nautilus
Posts: 792
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Timers do not work - in Blocky and in general

Post by Nautilus » Tuesday 31 January 2017 23:18

You might want to try with two "Set" commands. One for "On" and the other for "Off AFTER 60 seconds".

kalinkamaen
Posts: 92
Joined: Sunday 04 January 2015 16:57
Target OS: Windows
Domoticz version: 4.900
Location: Norway
Contact:

Re: Timers do not work - in Blocky and in general

Post by kalinkamaen » Tuesday 31 January 2017 23:51

Hello sir. I am happy that you found a solution to make it work. You can also do as Natulius has described above, then you have a off command in the blocky script. So blocky should the turn off light even whats in switch section. The best way is to play around with different solutions to find the best way. And after a while you understand how blocky works.
Windows 7, Domoticz 4.9700

hoff
Posts: 7
Joined: Monday 30 January 2017 19:31
Target OS: -
Domoticz version:
Contact:

Re: Timers do not work - in Blocky and in general

Post by hoff » Sunday 05 February 2017 20:49

What Nautilus recommended actually seems to do the trick. Thanks for the hint.

It's strange though, how Blocky works in Domoticz. I am far from professional regarding coding skills, but Blocky is quite illogic.

User avatar
Shaggie_NB
Posts: 42
Joined: Thursday 30 January 2014 21:46
Target OS: Windows
Domoticz version:
Location: Oss
Contact:

Re: Timers do not work - in Blocky and in general

Post by Shaggie_NB » Sunday 05 February 2017 21:06

There is a topic full off blockly examples.
Read that first before you try things...
And before you have lots of comments...

Moped
Posts: 1
Joined: Saturday 08 December 2018 15:01
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Timers do not work - in Blocky and in general

Post by Moped » Saturday 08 December 2018 15:11

kalinkamaen wrote:
Tuesday 31 January 2017 10:33
Hello sir, i am not sure it this is a bug or not. But i want to help you to manage what you want.
As blocky works, do not think this setup you have here will work.

If you want to have this working i blocky, i would made a virtuell switch called "sunset switch" or what ever you want.
And then go in to timers on that switch and set it to switch on at sunset and off at sunrise <-- or the opposite. Then I would
include the switch in blocky like this:

Image
Hello,
I made a virtual switch en put it in an event with a motionsensor. But it didn't work. I cannot see the image you send.
Were can i see the image so i can try it?

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests