Group logging flooded because of script

Post Reply
Plantje
Posts: 128
Joined: Friday 16 October 2015 7:58
Target OS: Windows
Domoticz version:
Contact:

Group logging flooded because of script

Post by Plantje » Wednesday 23 August 2017 8:02

I have created two events (blockly scripts I guess...)

I have a Aeon Gen5 multi sensor.
The first script: if lux < 50 and movement = on then set group (lighting) = on
The second script: if lux > 50 or movement = off then set group (lighting) = off

Fairly simple, but now in the logging of the group lighting I see hundreds of events. In most cases off, off, off, off, off etc. But also on, on, on etc.
Now I don't think this will really cause an issue, but perhaps there is something I can do better. Can I improve this?

User avatar
Egregius
Posts: 2446
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: Beta
Location: Beitem, BE
Contact:

Re: Group logging flooded because of script

Post by Egregius » Wednesday 23 August 2017 8:33

You should also check the status of the group. When it's on it's not needed to put it on again.

Plantje
Posts: 128
Joined: Friday 16 October 2015 7:58
Target OS: Windows
Domoticz version:
Contact:

Re: Group logging flooded because of script

Post by Plantje » Wednesday 23 August 2017 8:35

Sounds logical :) Will do

Plantje
Posts: 128
Joined: Friday 16 October 2015 7:58
Target OS: Windows
Domoticz version:
Contact:

Re: Group logging flooded because of script

Post by Plantje » Wednesday 23 August 2017 9:13

Hmmm... I don't think I can check an entire group if it is on or off... so I took the status of one light of the group. Seems to work. Thanks!

Plantje
Posts: 128
Joined: Friday 16 October 2015 7:58
Target OS: Windows
Domoticz version:
Contact:

Re: Group logging flooded because of script

Post by Plantje » Friday 25 August 2017 9:23

Ok... that works for switching on the lights... And to some extend it works for switching off as well... the log is not flooded anymore, but the lights are not switching off as well. I have done two attempts for this...what am I missing?

Attempt 1:

Code: Select all

If ((Movement = off OR Lux > 50) AND Light = On)
Do Light = Off
I added the brackets because that is how I nested them. This doesn't flood the logging.

Attempt 2:

Code: Select all

If (Lux > 50 OR Movement = off)
Do If Light = On
Do Light = Off
The second attempt is still flooding the log. That is still strange I think.

Both scripts switch off the light now because the Lux > 50. I tried setting that to 1500 in the script at the moment, but every time I switch on the light using Domoticz right now (I am currently doing that remote) it switches off immediately. So it seems while I switch on the light this way it does work.

For switching on I've got

Code: Select all

If Light = Off AND (Lux < 50 AND Movement = On)
Do Light = On
That seems to be working fine and I guess it is because Movement "switching" to On does actually trigger something. If there has not been any movement for 4 minutes the "switch" goes to off without triggering the event...right?

So, there are still two issues:
-How come the log is still flooding with code attempt two? It shouldn't get to the second "If..do" logic while the light is off.
-How come if I trigger the light to switch on by moving around in the room, leave the room, seeing the movement "switch" go to off then the light doesn't switch off?

Plantje
Posts: 128
Joined: Friday 16 October 2015 7:58
Target OS: Windows
Domoticz version:
Contact:

Re: Group logging flooded because of script

Post by Plantje » Saturday 11 November 2017 10:25

Looked into this once again as some of my lights were not switching off. I had set them to switch of either if there is (no movement detected or the lux > 65) and if the KaKu light is set to more than (for example) 10%. However, it only does work if I alter the script to switch off in case (no movement is detected or the lux > 65) and if the KaKu light is not "off"

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest