Enable / Disable all events in a switch planning alltogether

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.
oliviers
Posts: 78
Joined: Wednesday 16 September 2015 22:10
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Paris area, France
Contact:

Enable / Disable all events in a switch planning alltogether

Post by oliviers » Wednesday 13 January 2016 10:16

Hi,
It would be nice to have the possibility to enable or disable all events in a switch planning at once. Currently, one must activate or deactivate events one by one.
Example of possible usage :
- Disable all events for a heating device during the summer / enable them in the winter
- Disable the watering of my land when it rains
- Disable a switch when not in use (ex: my Christmas tree lights)

Or is there already a way to do this ?

Thank you to the developers of this superb software, anyway.
Oliviers
Paris area
Raspberry Pi 2B - RFXComm 433 - IrTrans - Zwave

User avatar
Eduard
Posts: 287
Joined: Monday 19 January 2015 10:14
Target OS: Raspberry Pi
Domoticz version: V3.5877
Location: The Netherlands
Contact:

Re: Enable / Disable all events in a switch planning alltoge

Post by Eduard » Wednesday 13 January 2016 11:09

I use a bash-script to enable/disable timers via json.
Available methods are:
* enabletimer
* disabletimer
* enablescenetimer
* disablescenetimer

Use like:

http://<ip>:<port>/json.htm?type=command&param=enabletimer&idx=<id>

Good luck!
3x Raspberry Pi (Master, Slave & Test)
1x Test VM Windows (VS 2015)
1x Test VM Ubuntu

pvm
Posts: 857
Joined: Tuesday 17 June 2014 22:14
Target OS: NAS (Synology & others)
Domoticz version: Stable
Location: NL
Contact:

Re: Enable / Disable all events in a switch planning alltoge

Post by pvm » Wednesday 13 January 2016 16:09

Possible other solutions
oliviers wrote: - Disable all events for a heating device during the summer / enable them in the winter
Make the actions temperature dependent using blockly
oliviers wrote: - Disable the watering of my land when it rains
Measure soil moisture, or rain or retrieve rain from buienradar
oliviers wrote: - Disable a switch when not in use (ex: my Christmas tree lights)
Switch Christmastree based on date and time using blockly
Synology NAS, PI3, ZWave, Xiamo zigbee devices, BTLE plant sensor

oliviers
Posts: 78
Joined: Wednesday 16 September 2015 22:10
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Paris area, France
Contact:

Re: Enable / Disable all events in a switch planning alltoge

Post by oliviers » Wednesday 13 January 2016 19:20

Mmmmm.....
Thanks for the suggestions, but it isn't that easy....
For example, I can't just rely of the ground moisture for watering my land.... Even if it is very dry, I may want to turn watering off because I know that rain is coming tomorrow, for example. Or because I don't want to let it run when I'm away (what if the valve doesn't switch off for some reason??)
There are other cases where I would just like to "disable" a switch and all related actions temporarily. Ex: Don't turn that light on (my Chistmas tree!) because I'm away from home for the weekend.
Furthermore, calculations in Blockry are somehow difficult and cumbersome.... Never been able to do something reliable and ended up writing a Lua script.
It would be easier to just have a check box "switch active or not", isn't it ??? Or scenario/scene active or not.
Oliviers
Paris area
Raspberry Pi 2B - RFXComm 433 - IrTrans - Zwave

User avatar
Egregius
Posts: 2384
Joined: Thursday 09 April 2015 12:19
Target OS: Raspberry Pi
Domoticz version: BetaRPi2
Location: Beitem, BE
Contact:

Re: Enable / Disable all events in a switch planning alltoge

Post by Egregius » Wednesday 13 January 2016 19:50

Just use some dummy switches. Easy and very reliable.

oliviers
Posts: 78
Joined: Wednesday 16 September 2015 22:10
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Paris area, France
Contact:

Re: Enable / Disable all events in a switch planning alltoge

Post by oliviers » Wednesday 13 January 2016 23:43

Could you please elaborate a little bit ? How can I do that with a dummy switch ? And without having to write tens of Lua scripts ..?
Paris area
Raspberry Pi 2B - RFXComm 433 - IrTrans - Zwave

User avatar
Egregius
Posts: 2384
Joined: Thursday 09 April 2015 12:19
Target OS: Raspberry Pi
Domoticz version: BetaRPi2
Location: Beitem, BE
Contact:

Re: Enable / Disable all events in a switch planning alltoge

Post by Egregius » Thursday 14 January 2016 8:33

Well, you create a dummy switch and then use that status in blockly/lua/php/... to act on it.

Example:
Switch "Heating" -> If Heating == On set setpoint 20...
Switch "Rainexpected" -> If Rainexpected == Off switch watering on

If you want some more advanced stuff you'll have to code some blockly/lua/php scripts.
I handle EVERYTHING with one PHP file.

User avatar
jannl
Posts: 797
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Geleen
Contact:

Re: Enable / Disable all events in a switch planning alltoge

Post by jannl » Thursday 14 January 2016 9:30

I use a dummy switch called Override. When I (or someone else) sets this to On, events are not handled anymore.
Every event has a check for this switch.

Comes in very usefull when I missed/made a program error or missed some special situation to prevent things from happening.
Or when the daily schedule is completely different because of some situation.

oliviers
Posts: 78
Joined: Wednesday 16 September 2015 22:10
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Paris area, France
Contact:

Re: Enable / Disable all events in a switch planning alltoge

Post by oliviers » Thursday 14 January 2016 14:32

OK, and thanks for your suggestions !

I agree with you that I can solve my problem by writing scripts. Although the scripts could be quite complex. For some of my switches, I have ten or more scheduled events which would all need to be activated or deactivated. It's not, like you wrote, Egregius, "switch watering off", but rather "Do not execute any of the twelve events that I have declared in the switch "planning" screen. Not the one scheduled at 20:00, not the one scheduled at 20:15, not the one scheduled at 20:30, .... and so forth.

So, back to my original suggestion: It would be nice to have a checkbox, in the switch configuration panel, which would globally enable or disable the switch and all its related events. Would be easier and more accessible for non-programmers than writing scripts, isn't it ???

Best regards,
Oliviers
Paris area
Raspberry Pi 2B - RFXComm 433 - IrTrans - Zwave

oliviers
Posts: 78
Joined: Wednesday 16 September 2015 22:10
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Paris area, France
Contact:

Re: Enable / Disable all events in a switch planning alltoge

Post by oliviers » Saturday 16 January 2016 20:16

Hi everybody,
Finally I found a solution to do this.... Update the switch configuration in the domoticz.db database directly.

1. I started by installing sqlite3 on my raspberry pi:

Code: Select all

sudo apt-get update
sudo apt-get install sqlite3
2. I wrote two bash scripts, one to turn all events from my real switch to "Active", the other one to turn them to "Inactive": (in this example, "Talus" is the name of my real switch)

Code: Select all

#!/bin/bash
sqlite3 /home/pi/domoticz/domoticz.db 'update timers set active=1 where devicerowid in (select id from devicestatus where name = "Talus");'
and

Code: Select all

#!/bin/bash
sqlite3 /home/pi/domoticz/domoticz.db 'update timers set active=0 where devicerowid in (select id from devicestatus where name = "Talus");'
3. I created a Virtual switch and assigned these two scripts to "Action On" and "Action off":
Capture1.PNG
Capture1.PNG (55.65 KiB) Viewed 2672 times
4. When that virtual switch is turned ON, all planning events of the real switch are activated:
Capture2.PNG
Capture2.PNG (24.89 KiB) Viewed 2672 times
....and they are deactivated when that virtual swith is set to OFF:
Capture3.PNG
Capture3.PNG (24.5 KiB) Viewed 2672 times
Looks like my "problem" is solved !

Best regards to all, and sorry for the screenshots in French!
Oliviers
Paris area
Raspberry Pi 2B - RFXComm 433 - IrTrans - Zwave

Number8
Posts: 261
Joined: Friday 23 May 2014 7:55
Target OS: Raspberry Pi
Domoticz version: 3.5103
Location: Saint Pierre de Jards
Contact:

Re: Enable / Disable all events in a switch planning alltogether

Post by Number8 » Thursday 07 April 2016 9:11

I use a bash-script to enable/disable timers via json.
Available methods are:
* enabletimer
* disabletimer
* enablescenetimer
* disablescenetimer
This does not work for SetPoint thermostat. I noticed that the javascript function is updateSetpointTimer, so I tried enablesetpointtimer and enabletimer as well, but it does not work. Any clue what would be the right method if any?

User avatar
Eduard
Posts: 287
Joined: Monday 19 January 2015 10:14
Target OS: Raspberry Pi
Domoticz version: V3.5877
Location: The Netherlands
Contact:

Re: Enable / Disable all events in a switch planning alltogether

Post by Eduard » Thursday 07 April 2016 9:59

Number8 wrote:
I use a bash-script to enable/disable timers via json.
Available methods are:
* enabletimer
* disabletimer
* enablescenetimer
* disablescenetimer
This does not work for SetPoint thermostat. I noticed that the javascript function is updateSetpointTimer, so I tried enablesetpointtimer and enabletimer as well, but it does not work. Any clue what would be the right method if any?
I think it was not implemented. I will look into that...
3x Raspberry Pi (Master, Slave & Test)
1x Test VM Windows (VS 2015)
1x Test VM Ubuntu

Number8
Posts: 261
Joined: Friday 23 May 2014 7:55
Target OS: Raspberry Pi
Domoticz version: 3.5103
Location: Saint Pierre de Jards
Contact:

Re: Enable / Disable all events in a switch planning alltogether

Post by Number8 » Thursday 07 April 2016 10:31

Great, thank you

User avatar
Eduard
Posts: 287
Joined: Monday 19 January 2015 10:14
Target OS: Raspberry Pi
Domoticz version: V3.5877
Location: The Netherlands
Contact:

Re: Enable / Disable all events in a switch planning alltogether

Post by Eduard » Thursday 07 April 2016 14:02

Number8 wrote:Great, thank you
yw ;)

PullRequest already commited: https://github.com/domoticz/domoticz/pull/600
Should be available in next beta.
3x Raspberry Pi (Master, Slave & Test)
1x Test VM Windows (VS 2015)
1x Test VM Ubuntu

Number8
Posts: 261
Joined: Friday 23 May 2014 7:55
Target OS: Raspberry Pi
Domoticz version: 3.5103
Location: Saint Pierre de Jards
Contact:

Re: Enable / Disable all events in a switch planning alltogether

Post by Number8 » Thursday 07 April 2016 14:10

Thanks Eduard, I'll wait next beta, should'nt take that long ;)
Shall I use enabletimer in the JSON request as for the switch timer or another keyword?
Cheers

User avatar
Eduard
Posts: 287
Joined: Monday 19 January 2015 10:14
Target OS: Raspberry Pi
Domoticz version: V3.5877
Location: The Netherlands
Contact:

Re: Enable / Disable all events in a switch planning alltogether

Post by Eduard » Thursday 07 April 2016 14:18

Number8 wrote: Shall I use enabletimer in the JSON request as for the switch timer or another keyword?
The available methods are
* enabletimer
* disabletimer
* enablescenetimer
* disablescenetimer
* enablesetpointtimer (*)
* disablesetpointtimer (*)

[EDIT] (*) Available in next beta
3x Raspberry Pi (Master, Slave & Test)
1x Test VM Windows (VS 2015)
1x Test VM Ubuntu

User avatar
Eduard
Posts: 287
Joined: Monday 19 January 2015 10:14
Target OS: Raspberry Pi
Domoticz version: V3.5877
Location: The Netherlands
Contact:

Re: Enable / Disable all events in a switch planning alltogether

Post by Eduard » Saturday 09 April 2016 8:10

New beta is availanle. Does it work?
3x Raspberry Pi (Master, Slave & Test)
1x Test VM Windows (VS 2015)
1x Test VM Ubuntu

Number8
Posts: 261
Joined: Friday 23 May 2014 7:55
Target OS: Raspberry Pi
Domoticz version: 3.5103
Location: Saint Pierre de Jards
Contact:

Re: Enable / Disable all events in a switch planning alltogether

Post by Number8 » Saturday 09 April 2016 8:21

I just upgraded this early morning. Both functions work just great. Thanks Eduard.

User avatar
Eduard
Posts: 287
Joined: Monday 19 January 2015 10:14
Target OS: Raspberry Pi
Domoticz version: V3.5877
Location: The Netherlands
Contact:

Re: Enable / Disable all events in a switch planning alltogether

Post by Eduard » Saturday 09 April 2016 9:39

Number8 wrote:I just upgraded this early morning. Both functions work just great. Thanks Eduard.
:D
3x Raspberry Pi (Master, Slave & Test)
1x Test VM Windows (VS 2015)
1x Test VM Ubuntu

maluko
Posts: 221
Joined: Monday 03 February 2014 0:57
Target OS: Raspberry Pi
Domoticz version:
Location: Portugal
Contact:

Re: Enable / Disable all events in a switch planning alltogether

Post by maluko » Wednesday 14 September 2016 1:40

is the disablescenetimer/enablescenetimer working fine?

i cant get this working.

the status are fine but the timer dont change.

{
status: "OK",
title: "DisableSceneTimer"
}

thanks

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests