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.

Moderators: leecollings, remb0

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

Enable / Disable all events in a switch planning alltogether

Post by oliviers »

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 4 - RFXComm 433 - IrTrans - Zwave
Eduard
Posts: 139
Joined: Monday 19 January 2015 9:14
Target OS: -
Domoticz version:

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

Post by Eduard »

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!
pvm
Posts: 550
Joined: Tuesday 17 June 2014 22:14
Target OS: NAS (Synology & others)
Domoticz version: 4.10538
Location: NL
Contact:

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

Post by pvm »

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, slave PI3, ZWave (Fibaro), Xiaomi zigbee devices, BTLE plant sensor, DzVents, Dashticz on tablet, Logitech Media Server
oliviers
Posts: 73
Joined: Wednesday 16 September 2015 22:10
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Paris area, France
Contact:

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

Post by oliviers »

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 4 - RFXComm 433 - IrTrans - Zwave
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

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

Post by Egregius »

Just use some dummy switches. Easy and very reliable.
oliviers
Posts: 73
Joined: Wednesday 16 September 2015 22:10
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Paris area, France
Contact:

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

Post by oliviers »

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 4 - RFXComm 433 - IrTrans - Zwave
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

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

Post by Egregius »

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.
jannl
Posts: 625
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

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

Post by jannl »

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: 73
Joined: Wednesday 16 September 2015 22:10
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Paris area, France
Contact:

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

Post by oliviers »

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 4 - RFXComm 433 - IrTrans - Zwave
oliviers
Posts: 73
Joined: Wednesday 16 September 2015 22:10
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Paris area, France
Contact:

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

Post by oliviers »

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 7092 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 7092 times
....and they are deactivated when that virtual swith is set to OFF:
Capture3.PNG
Capture3.PNG (24.5 KiB) Viewed 7092 times
Looks like my "problem" is solved !

Best regards to all, and sorry for the screenshots in French!
Oliviers
Paris area
Raspberry Pi 4 - RFXComm 433 - IrTrans - Zwave
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

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

Post by Number8 »

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?
Debian buster on NUC and three RPi with buster.
Eduard
Posts: 139
Joined: Monday 19 January 2015 9:14
Target OS: -
Domoticz version:

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

Post by Eduard »

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...
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

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

Post by Number8 »

Great, thank you
Debian buster on NUC and three RPi with buster.
Eduard
Posts: 139
Joined: Monday 19 January 2015 9:14
Target OS: -
Domoticz version:

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

Post by Eduard »

Number8 wrote:Great, thank you
yw ;)

PullRequest already commited: https://github.com/domoticz/domoticz/pull/600
Should be available in next beta.
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

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

Post by Number8 »

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
Debian buster on NUC and three RPi with buster.
Eduard
Posts: 139
Joined: Monday 19 January 2015 9:14
Target OS: -
Domoticz version:

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

Post by Eduard »

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
Eduard
Posts: 139
Joined: Monday 19 January 2015 9:14
Target OS: -
Domoticz version:

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

Post by Eduard »

New beta is availanle. Does it work?
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

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

Post by Number8 »

I just upgraded this early morning. Both functions work just great. Thanks Eduard.
Debian buster on NUC and three RPi with buster.
Eduard
Posts: 139
Joined: Monday 19 January 2015 9:14
Target OS: -
Domoticz version:

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

Post by Eduard »

Number8 wrote:I just upgraded this early morning. Both functions work just great. Thanks Eduard.
:D
maluko
Posts: 105
Joined: Sunday 02 February 2014 23:57
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Portugal
Contact:

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

Post by maluko »

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 0 guests