Blockly Script automatic home / away / override

Moderator: leecollings

Post Reply
Cletus
Posts: 54
Joined: Wednesday 17 August 2016 9:32
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Purmerend, Netherlands
Contact:

Blockly Script automatic home / away / override

Post 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.

Image

And i created attached Blockly (In device mode) for it:

Image

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
This is our world now... the world of the electron and the switch, the beauty of the baud.
User avatar
cyberclwn
Posts: 105
Joined: Thursday 20 August 2015 22:53
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: The Netherlands
Contact:

Re: Blockly Script automatic home / away / override

Post 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.
3xPi 2B (Domoticz "live", Domoticz "sandbox", PhotoFrame)
RFXCom433(E), KaKu, Oregon Scientific, Keyes 2-relay, Logitech Media Server, MiLight, Smartwares heating controller(2x), IR Send/Receive, Keyes PIR, XH-M131 DuskSensor, DHT22/11
Cletus
Posts: 54
Joined: Wednesday 17 August 2016 9:32
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Purmerend, Netherlands
Contact:

Re: Blockly Script automatic home / away / override

Post 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.

Image

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.

Image

Thanks!!!

Regards, Paul
This is our world now... the world of the electron and the switch, the beauty of the baud.
User avatar
cyberclwn
Posts: 105
Joined: Thursday 20 August 2015 22:53
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: The Netherlands
Contact:

Re: Blockly Script automatic home / away / override

Post 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.
3xPi 2B (Domoticz "live", Domoticz "sandbox", PhotoFrame)
RFXCom433(E), KaKu, Oregon Scientific, Keyes 2-relay, Logitech Media Server, MiLight, Smartwares heating controller(2x), IR Send/Receive, Keyes PIR, XH-M131 DuskSensor, DHT22/11
Cletus
Posts: 54
Joined: Wednesday 17 August 2016 9:32
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Purmerend, Netherlands
Contact:

Re: Blockly Script automatic home / away / override

Post by Cletus »

Thanks! Are you maybe in the mood for helping me with a bit of LUA in this case? :)
This is our world now... the world of the electron and the switch, the beauty of the baud.
User avatar
cyberclwn
Posts: 105
Joined: Thursday 20 August 2015 22:53
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: The Netherlands
Contact:

Re: Blockly Script automatic home / away / override

Post by cyberclwn »

You can try :)
3xPi 2B (Domoticz "live", Domoticz "sandbox", PhotoFrame)
RFXCom433(E), KaKu, Oregon Scientific, Keyes 2-relay, Logitech Media Server, MiLight, Smartwares heating controller(2x), IR Send/Receive, Keyes PIR, XH-M131 DuskSensor, DHT22/11
Cletus
Posts: 54
Joined: Wednesday 17 August 2016 9:32
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Purmerend, Netherlands
Contact:

Re: Blockly Script automatic home / away / override

Post by Cletus »

Haha, can i PM you or should we do this live on the forum? :)
This is our world now... the world of the electron and the switch, the beauty of the baud.
User avatar
cyberclwn
Posts: 105
Joined: Thursday 20 August 2015 22:53
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: The Netherlands
Contact:

Re: Blockly Script automatic home / away / override

Post 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 :)
3xPi 2B (Domoticz "live", Domoticz "sandbox", PhotoFrame)
RFXCom433(E), KaKu, Oregon Scientific, Keyes 2-relay, Logitech Media Server, MiLight, Smartwares heating controller(2x), IR Send/Receive, Keyes PIR, XH-M131 DuskSensor, DHT22/11
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest