Hello,
I've found no easy way to enable/disable whole shedule in a switch:
-There is the possibility to switch between 2 schedules (normal+vacations), this may help but does not really does the job (maybe done by having more shedules & mapping a selector virtual switch on them, indeed).
-Through the json api, there is a way to do this. But as every line in a schedule looks to be triggered by a timer (each with it's own timer idx) & json api uses timer idx this is not easy to invalidate all a switch schedule this way.
-Reading forum, I tried to use one sideway that alters to domoticz db directly: Looks successfull when looking at the enable statuses but sometimes, all schedules are set back to on! Probably it's not very sane to alter domoticz db while running: This may be cached somewere and previous enable statuses set back. Yesterday, I had to replace windows & used the virtual switch triggered scripts that invalidate all floor heaters plannings + sets them to off... but they restarted later because switches schedules were re-enabled.
So my question is: Is there a way to do this I may have missed (quite new to Domoticz)? If not, could it make it's way in the feature list for next version?
BR
Way to enable/disable whole switch schedule...
Moderators: leecollings, remb0
-
- Posts: 156
- Joined: Monday 25 May 2015 22:44
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2020.2
- Location: Netherlands
- Contact:
Re: Way to enable/disable whole switch schedule...
*bump*
Did we ever find a solution to this?
Did we ever find a solution to this?
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Way to enable/disable whole switch schedule...
I use different timerplans to do just this. To give an idea how this can work..:
Below dzVents script change the timerplans based on the content of a domoticz text-device. This ensure that we are not waked too early by blinds going up when we do not have to work

Code: Select all
--[[ SetTimerplan.lua
]]--
return {
on = { variables = { 'GCal*' } },
logging = { level = domoticz.LOG_ERROR, -- DEBUG, ERROR or INFO
marker = "setTimerPlan" },
execute = function(dz)
dz.log ("Calender XXXX text: " .. dz.devices('Calender XXXX Text').text,dz.LOG_DEBUG)
local function setTimerplan(timerPlan)
local jsonString = dz.settings['Domoticz url'] .. "/json.htm?type=command¶m=setactivetimerplan&ActiveTimerPlan=" .. tostring(timerPlan)
dz.openURL(jsonString)
dz.variables('TimerPlan').set(timerPlan)
newTimerPlan = timerPlan
end
local function inString(text, searchString)
if string.find(string.lower( text),searchString ) ~= nil then
return true
else
return false
end
end
local XXXX = dz.devices('Calender XXXX Text').text -- Text from Google calendar
local ZZZZ = dz.devices('Calender XXXX en YYYY Text').text
local timerPlan = dz.variables('TimerPlan').value
local newTimerPlan = timerPlan
if dz.time.matchesRule('at 22:00-02:00') then
if (inString ( XXXX,"erken" ) or inString ( XXXX,"ursus" )) then
setTimerplan(0) -- XXXX at work so default TimerPlan
elseif (inString ( ZZZZ,"holiday" ) or inString ( ZZZZ,"vakantie" )) and timerPlan ~= 1 then
setTimerplan(1) -- It is a Holiday
elseif timerPlan ~= 2 then
setTimerplan(2) -- No Holiday but no working day either (including weekends)
end
end
dz.log ("timerPlan: " .. newTimerPlan,dz.LOG_DEBUG)
dz.log ("calendar XXXX: " .. XXXX,dz.LOG_DEBUG)
dz.log ("calendar XXXX en YYYY: " .. ZZZZ,dz.LOG_DEBUG)
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
- gizmocuz
- Posts: 2552
- Joined: Thursday 11 July 2013 18:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Top of the world
- Contact:
Re: Way to enable/disable whole switch schedule...
I suggest the following:
- Add a new Field in the DeviceStatus table, ScheduleActive (default true)
- In the "Edit Timer" GUI code, add a checkbox "Active" and use this to enable/disable all the timers of that device/switch
- When changing this checkbox, reload the schedules
Of course some code need to be adjusted as well to only load the timers if they are enabled for this device
And then of course a pull request on github would be appreciated
- Add a new Field in the DeviceStatus table, ScheduleActive (default true)
- In the "Edit Timer" GUI code, add a checkbox "Active" and use this to enable/disable all the timers of that device/switch
- When changing this checkbox, reload the schedules
Of course some code need to be adjusted as well to only load the timers if they are enabled for this device
And then of course a pull request on github would be appreciated
Quality outlives Quantity!
Who is online
Users browsing this forum: No registered users and 1 guest