Switch On/Off every minute with Blocky

Moderator: leecollings

Post Reply
straatm
Posts: 19
Joined: Monday 15 January 2018 10:06
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Switch On/Off every minute with Blocky

Post by straatm »

All,

I searched already the forum but could not find my answer. If it is already there please redirect me, no problem otherwise here is my problem.

I created a blocky script to sitch on/off light in the morning and the evening. But it is switched on and a few seconds later off. During the period it should be on. I am sure I miss something but I am just a beginner so maybe someone can help me.

This is the log:
2018-01-15 07:04:01 Off
2018-01-15 07:04:00 On
2018-01-15 07:03:00 Off
2018-01-15 07:03:00 On
2018-01-15 07:02:00 Off
2018-01-15 07:02:00 On
2018-01-15 07:01:01 Off
2018-01-15 07:01:00 On
2018-01-15 07:00:01 Off
2018-01-15 07:00:00 On
2018-01-14 22:30:01 Off
2018-01-14 22:30:00 On
2018-01-14 22:29:00 Off
2018-01-14 22:29:00 On
2018-01-14 22:28:01 Off
2018-01-14 22:28:00 On
2018-01-14 22:27:01 Off
2018-01-14 22:27:00 On
2018-01-14 22:26:01 Off
2018-01-14 22:26:00 On
2018-01-14 22:25:01 Off
2018-01-14 22:25:00 On
2018-01-14 22:24:01 Off
2018-01-14 22:24:00 On
2018-01-14 22:23:01 Off
Blocky diagram is also attached:
Blocky Morning-Evening.jpg
Blocky Morning-Evening.jpg (105.34 KiB) Viewed 2119 times
JimmyH1969
Posts: 153
Joined: Tuesday 28 June 2016 16:38
Target OS: Windows
Domoticz version: Beta
Location: Amersfoort NL
Contact:

Re: Switch On/Off every minute with Blocky

Post by JimmyH1969 »

So in a timeframe you are switching "Telefoon Marc" to On, and in the Else If you are switching it Off when it is On.
Because it's a timed blocky this happens every minute.

The blocky works as it should :-)
straatm
Posts: 19
Joined: Monday 15 January 2018 10:06
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Switch On/Off every minute with Blocky

Post by straatm »

Okay,

But how should I switch off if it is outside the timewindow.
I thought I could achieve the switch off out side the time window with the "else if" if it is not in the time window there is an else and this is switch off. If it is in the time window I thought it would not use the "else if" or am I wrong?
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Switch On/Off every minute with Blocky

Post by freijn »

Split it in two blocky events. That would work.
Is "telefoon Marc" a switch ? if so, Why don't you set it in Timers?
straatm
Posts: 19
Joined: Monday 15 January 2018 10:06
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands
Contact:

Re: Switch On/Off every minute with Blocky

Post by straatm »

Thanks for your reactions, I am only a beginner so two blocky events? Could you please make an example.
I am a bit confused with the else statement, if I understand it correctly the "else" is carried out even if the "if" is matched? It is not a "normal" "if then else" statement?
Why not add it with timers, if sunset is after 22:30 (maybe not possible in the Netherlands ;-)) but it would not switch off at 22:30.
I want also to add 07:00 to sunrise and sunrise could be before 07:00 then it is not necessary to switch on. And I try to learn :-)
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Switch On/Off every minute with Blocky

Post by freijn »

The else statment isn't working as expected or is not working at all.

So your understanding of programming is ok, but the blocky is s***t :-)

Lets start with the first step.

Why do you switch on the phone every minute between 07:00 and 10:00?
You could switch on at 07:00 single shot correct?

For the second step. only switch on after sunset but only till 22:30 ?
But still doing this every min.

Start splitting in two scripts as a first step.

Still this is much easier doing it in timers :-) sorry..
User avatar
Denny64
Posts: 53
Joined: Friday 03 February 2017 11:34
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Italy
Contact:

Re: Switch On/Off every minute with Blocky

Post by Denny64 »

Try in this way. It should be working.
Attachments
Screenshot at 2018-01-17 07-34-52.jpg
Screenshot at 2018-01-17 07-34-52.jpg (49.17 KiB) Viewed 2050 times
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests