Enabling/disabling switch planning ?.

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
jackyjoy123
Posts: 1
Joined: Friday 12 February 2021 10:45
Target OS: Linux
Domoticz version:

Enabling/disabling switch planning ?.

Post by jackyjoy123 »

Hello,

Does somebody knows if it is possible to enable/disable all actions in a planning of a switch at once, instead of having to change them one by one ?
The idea behind is to be able to enable or disable a set of actions, globally.
Practical example: I created a switch with several on/off actions to control the lights of my Christmas tree..... I won't need this again until next year.
Any idea ?


thanks
alexsunny
User avatar
waltervl
Posts: 5904
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Enabling/disabling switch planning ?.

Post by waltervl »

Yes, you can use Timer plans.
So fo christmas you make a copy of your current timer plan and add the christmas lights.
After christmas you switch back to the normal timer plan.
https://www.domoticz.com/wiki/Timer_Plan
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

Re: Enabling/disabling switch planning ?.

Post by Number8 »

For that I made some coding
Here is an excerpt. The idea :
- retrieve all timers for a specific IDX
- the set them Off or On

Code: Select all

local timerType
if item.switchType == "Selector" then
	timerType = "timers"
	_d.chauffageState = item.state
	dz.log ("selector level: " .. _d.chauffageState, dz.LOG_DEBUG)
elseif item.deviceSubType == "SetPoint" then
	timerType = "setpointtimers"
end
local url = "http://192.168.21.240:8080/json.htm?idx=" .. item.idx .. "&type=" .. timerType
-- retrieve timers IDX's
dz.openURL({
url = url,
callback = 'setTimers'
})
and then

Code: Select all

			
elseif item.trigger == "setTimers" then -- activate of deactivate all timers of a device (switch is supported)
	if item.ok and item.isJSON then
		if item.json.title == "Timers" then -- logic depends on type of timer
			local results = item.json.result
--			local flag
			dz.log ("_d.chauffageState value is: " .. _d.chauffageState, dz.LOG_DEBUG)
        		for i, node in pairs(results) do
				dz.log ("idx values: " .. node.idx .. " | Active: " .. node.Active, dz.LOG_DEBUG)				
					if node.Active == "true" then
						if _d.chauffageState == "Off" or _d.chauffageState == "HG" then
							dz.openURL("http://192.168.21.240:8080/json.htm?type=command&param=disabletimer&idx=" .. node.idx)
							dz.log ("Will disable timer of idx: " .. node.idx, dz.LOG_DEBUG)
						end
					else
						if _d.chauffageState == "-1°" or _d.chauffageState == "-2°" or _d.chauffageState == "Eco" or _d.chauffageState == "On" or _d.chauffageState == "HGt" then
							dz.openURL("http://192.168.21.240:8080/json.htm?type=command&param=enabletimer&idx=" .. node.idx)									
							dz.log ("Will enable timer of idx: " .. node.idx, dz.LOG_DEBUG)
						end
					end
        		end
Debian buster on NUC and three RPi with buster.
User avatar
waltervl
Posts: 5904
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Enabling/disabling switch planning ?.

Post by waltervl »

Another possibility is to create a group (of christmas lights) and switch them on and of according the group timer. After Christmas delete the group timer.

https://www.domoticz.com/wiki/Managing_ ... _Groups.29
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest