Use the timer value in rules

I build a rule like this:

rule "Durchlueften"
    when
        Item s_durchlueften changed from OFF to ON
    then
        logInfo("Starte", "Durchlueften")
        AmazonEchoShow_tts.sendCommand("Please make sure to open all windows now!")
        //AmazonEcho_tts.sendCommand("Please make sure to open all windows, now!")
        Thermo_MasterBedroom_SetTemp.sendCommand(5)
        Thermo_Diningroom_SetTemp.sendCommand(5)
        Thermo_Kitchen_SetTemp.sendCommand(5)
        Thermo_Bathroom_SetTemp.sendCommand(5)
        lueftungsTimer = createTimer(now.plusMinutes(25), [|
            lueftungsTimer = null
            AmazonEchoShow_tts.sendCommand("Please make sure to close all windows now!")
            Thermo_MasterBedroom_SetTemp.sendCommand(20)
            Thermo_Diningroom_SetTemp.sendCommand(20)
            Thermo_Kitchen_SetTemp.sendCommand(20)
            Thermo_Bathroom_SetTemp.sendCommand(20)
            s_durchlueften.sendCommand(OFF)
        ])    
    end

I want to know, how many minutes are left before it ends. Is that possible?
Like this: c_durchlueften.state = lueftungsTimer.state

Thanks so much

Please use code fences when posting items, things, rules, sitemaps, etc… It’s the paper icon just right of the smiley face. This makes the rule much easier to read.

Thanks

1 Like

Thanks for the heads up :relaxed:

There’s been some discussion on this that you might want to look at. It’s mostly a looping timer. As far as I see there is no direct way to read the timer value, but the solutions work around that.

And the looping time design pattern: