[Request] Run schedule once and then disable

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

Post Reply
calania
Posts: 25
Joined: Friday 17 April 2020 21:02
Target OS: Windows
Domoticz version:
Contact:

[Request] Run schedule once and then disable

Post by calania »

Hello!

I have a morning wakeup schedule in Domoticz that opens my blinds, turns on a few lights, starts my radio etc that I use every morning. Some days however I, like everyone else, has to wake up earlier than usual and then I often change the time of my original schedule. When I do this there is a 99% chance that I will forget to change it back and will wake up earlier than I wanted the next day. A lot of difference apps like Sonos and Xiaomi have the option to set a schedule/alarm to only run once and when it has run it will be disabled. This is something I miss a lot in Domoticz. It would be so nice if when I made a schedule I could set something like "only run X times" and also the inverse "disable for x runs"
User avatar
imautohuttraeger
Posts: 474
Joined: Saturday 14 March 2020 13:40
Target OS: Raspberry Pi / ODroid
Domoticz version: lat.beta
Location: Germany
Contact:

Re: [Request] Run schedule once and then disable

Post by imautohuttraeger »

May this procedure could solve this without a built-in function in Domoticz:

Make a virtual switch "Morning routine standard"

Create script that triggers the standard morning routine only, when the switch in "on". Else trigger the exceptional routine.

Set this switch to "off" when the exceptional routine is wanted.

Include a step in the script, that automatically sets the switch "on" every day e.g. at 11:00 AM
Stop, look and listen.
calania
Posts: 25
Joined: Friday 17 April 2020 21:02
Target OS: Windows
Domoticz version:
Contact:

Re: [Request] Run schedule once and then disable

Post by calania »

Didn't think about that! Sounds absolutely doable but it would be nice if it was a feature when modifying a schedule :)
lost
Posts: 727
Joined: Thursday 10 November 2016 9:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [Request] Run schedule once and then disable

Post by lost »

calania wrote: Thursday 19 November 2026 10:14 I often change the time of my original schedule.
Do you know you can setup as many timer plans as you need? So instead of changing some timers inside a plan, an alternative would be to have several alternate plans and switch them as you need.

To ease switching, just create a virtual with this kind of action (for N=0 to you max plans nb):

Code: Select all

http://127.0.0.1:8080/json.htm?type=command&param=setactivetimerplan&ActiveTimerPlan=N
After that, to auto-switch a timer plan set to "late_wakeup" back to "normal_wakeup", make a lua/dzvent script that, at 22h00 (for instance), if currrent is "late_wakeup" timer plan will set back "normal_wakeup" using the virtual selector levels.

I myself had a use-case for this (for now disabled as no more using such contract) when I had variable electric prices: Tempo contract in France, with day kWh prices according to a 'day color" that can be blue (most of the year, cheap), white (average prices), red (heavy prices).

According to the next-day (J1) pricing color, If needed was switching timer plans in the evening to tune heating. Here is the code snippet in pure Lua (timerPlanSw is the variable that hosts the name for the virtual selector used to switch plans) from the time script doing this:

Code: Select all

-- Need to switch to 'red' timerplan (if feature active)?
if ((time.hour == redHourSwTime['to'][1]) and (time.min == redHourSwTime['to'][2])) then
    if (uservariables[tempoVarJ1] == "ROUGE") and (timerPlanSw ~= nil) and (toTimPlans[otherdevices[timerPlanSw]][1]) then
        -- Switch current timer-plan to "TempoR"
        print('Switch current timer-plan '..otherdevices[timerPlanSw]..' -> TempoR.')
        commandArray[#commandArray+1]={[timerPlanSw]='Set Level: '..toTimPlans.TempoR[2]}
        commandArray[#commandArray+1]={['SendEmail']='TEMPO Planning!#'..uservariables[tempoVarJ1]..' => TempoR!!!#'..emailNotifyAlarm}
    end
end

-- Need to switch from 'red' timerplan (if feature active)?
if ((time.hour == redHourSwTime['from'][1]) and (time.min == redHourSwTime['from'][2])) then
    tempoJ1 = uservariables[tempoVarJ1]
    if (tempoJ1 ~= "ROUGE") and (timerPlanSw ~= nil) and (otherdevices[timerPlanSw] == "TempoR") then
        -- Switch (back) "TempoR" timer-plan (always) to "Norm"
        print('Switch current timer-plan '..otherdevices[timerPlanSw]..' -> Norm.')
        commandArray[#commandArray+1]={[timerPlanSw]='Set Level: '..toTimPlans.Norm[2]}
        commandArray[#commandArray+1]={['SendEmail']='TEMPO Planning!#'..uservariables[tempoVarJ1]..' => Norm!!!#'..emailNotifyAlarm}
    end
    -- Change tempoVarJ1 that is now tempoVarJ & may be used by tempoWarn companion device script before daily refresh.
    commandArray[#commandArray+1]={['Variable:'..tempoVarJ] = tempoJ1}
end
That'll not be the right logic for you, but the way to check/modify current plan is there (even sending a mail notification of the change).
Post Reply