Page 1 of 1
Blockly Script automatic home / away / override
Posted: Monday 12 September 2016 15:23
by Cletus
Hello Guys,
Question!
I have created a Home button in Domoticz so that i can say to the system if i'm "Home / Away / Night / Holiday / Override"
This is created by a Virtual Selector switch.
And i created attached Blockly (In device mode) for it:
Which basically does the following:
If me or my wife are gone based on telephone not at home via Geocaching the setting automatically goes to Away,
When one of us or both are back the settings goes to Home
But the following problem arises:
When putting the blockly without the "Handbediening (override)" code i can't put it on override because the script is triggered every time. When i do it via above blockly the logfile is being spammed with triggers because obviously it triggers every second or so. Is there a way around this? I can imagine that this is quite intensive for the system?
- Spoiler: show
- 2016-09-12 15:23:04.827 EventSystem: Event triggered: Paul en Irene Thuis_1
2016-09-12 15:23:04.813 (Dummy Switches) Light/Switch (Huis)
2016-09-12 15:23:05.845 EventSystem: Event triggered: Paul en Irene Thuis_1
2016-09-12 15:23:05.831 (Dummy Switches) Light/Switch (Huis)
2016-09-12 15:23:06.158 (Stroommeter) P1 Smart Meter (Stroomverbruik)
2016-09-12 15:23:06.865 EventSystem: Event triggered: Paul en Irene Thuis_1
2016-09-12 15:23:06.850 (Dummy Switches) Light/Switch (Huis)
2016-09-12 15:23:07.883 EventSystem: Event triggered: Paul en Irene Thuis_1
2016-09-12 15:23:07.869 (Dummy Switches) Light/Switch (Huis)
2016-09-12 15:23:08.902 EventSystem: Event triggered: Paul en Irene Thuis_1
2016-09-12 15:23:08.887 (Dummy Switches) Light/Switch (Huis)
2016-09-12 15:23:09.921 EventSystem: Event triggered: Paul en Irene Thuis_1
2016-09-12 15:23:09.906 (Dummy Switches) Light/Switch (Huis)
2016-09-12 15:23:10.941 EventSystem: Event triggered: Paul en Irene Thuis_1
2016-09-12 15:23:10.925 (Dummy Switches) Light/Switch (Huis)
2016-09-12 15:23:11.959 EventSystem: Event triggered: Paul en Irene Thuis_1
2016-09-12 15:23:11.945 (Dummy Switches) Light/Switch (Huis)
2016-09-12 15:23:12.978 EventSystem: Event triggered: Paul en Irene Thuis_1
2016-09-12 15:23:12.963 (Dummy Switches) Light/Switch (Huis)
2016-09-12 15:23:13.996 EventSystem: Event triggered: Paul en Irene Thuis_1
2016-09-12 15:23:13.982 (Dummy Switches) Light/Switch (Huis)
2016-09-12 15:23:15.006 EventSystem: Event triggered: Paul en Irene Thuis_1
2016-09-12 15:23:15.000 (Dummy Switches) Light/Switch (Huis)
2016-09-12 15:23:16.644 EventSystem: Event triggered: Paul en Irene Thuis_1
Looking forward to an answer!
Thanks! Paul
Re: Blockly Script automatic home / away / override
Posted: Tuesday 13 September 2016 1:13
by cyberclwn
Hey,
I'm not sure, i'm not that good with Blockly, but I think it is doing what you ask.
IF HUIS is not equal "Handbediening" AND ((Paul thuis = ON) OR (Irene Thuis = ON)) Then set HUIS = Thuis
So now HUIS will be "Thuis", and that is not equal to "Handbediening".
Let's do the loop again ...
IF HUIS is not equal "Handbediening" AND ((Paul thuis = ON) OR (Irene Thuis = ON)) Then set HUIS = Thuis
So now HUIS will be "Thuis", and that is not equal to "Handbediening".
I think you might need another AND there ...
if HUIS is not equal "Handbediening" AND huis is not equal "Thuis" AND ((Paul thuis = ON) OR (Irene Thuis = ON)) Then set HUIS = Thuis
Sorry if this wasn't helpful, but i thought i try help anyway.
Re: Blockly Script automatic home / away / override
Posted: Tuesday 13 September 2016 11:01
by Cletus
Hello Cyberclwn,
Thanks for your answer! I've created the blockly now like this. I think this is working fine after some basic testing.
Other problem i have now is that if i want to do something with groups i end up with a script that contantly is triggering itself because of the state of the system. Is there any way where this can only be triggered if it detects change on the "huis" state? Please note that it's a device script rather than all or time script.
Thanks!!!
Regards, Paul
Re: Blockly Script automatic home / away / override
Posted: Tuesday 13 September 2016 11:57
by cyberclwn
Hi Paul,
That is beyond my knowledge of the Blockly-system. I only use LUA for my scripts, I find that easier then the Blockly.
So I can't help you with the last question, but I am sure there are others active on the forum that can help you with this.
Re: Blockly Script automatic home / away / override
Posted: Tuesday 13 September 2016 12:55
by Cletus
Thanks! Are you maybe in the mood for helping me with a bit of LUA in this case?

Re: Blockly Script automatic home / away / override
Posted: Wednesday 14 September 2016 13:00
by cyberclwn
You can try

Re: Blockly Script automatic home / away / override
Posted: Wednesday 14 September 2016 13:39
by Cletus
Haha, can i PM you or should we do this live on the forum?

Re: Blockly Script automatic home / away / override
Posted: Wednesday 14 September 2016 15:45
by cyberclwn
Toss it in a PM. If it is really interesting you can make a new topic for it later and share the knowledge.
That is what the forum is ment for
