Timer causing error on "Cancel"

When you’re editing rules that spawn long-running timers, beware orphaned timers.
If you edit/reload a rules file while a timer is waiting, it doesn’t go away. It will still execute at the appointed time but usually fail because the context was destroyed by rules reload.

I was assuming the error was “on cancel” because I get the error in openhab.log at the time the timer was due to end.

I DO NOT get logs (or push’s) however. I have stripped those for now.

rule "Its Hot Detection!"
when
    Item TadoFamilyRoom_Temperature changed
then
    if(TadoFamilyRoom_Temperature.state >= 21.00 | "°C") {
            if(tItsHot===null) {
                logInfo("EXTRA", "Temperature is high, the Hot toggle switch is now on until {}",now.plusHours(1))
				pushNotification("Temperature", "Breached threshold, toggle is ON")
                ItsHotTemperature.sendCommand(ON) //It's Hot toggle switch
                // first ON command, so create a timer to turn the switch off again
                tItsHot = createTimer(now.plusHours(1)) [|
                ItsHotTemperature.sendCommand(OFF)
                ]
            } else if(TadoFamilyRoom_Temperature.state <= 20.00 | "°C" && ItsHotTemperature==ON) {
                // remove any previously scheduled timer
                    if(tItsHot!==null) {
                    tItsHot.cancel
                    tItsHot = null
					ItsHotTemperature.sendCommand(OFF)
                    }	
                }
    }
end

I’m not actually 100% certain the item change and if statements are being met.

So thanks @5iver, I missed your original reply, but it seems to be working…

However, the problem I’m trying to get rid of, is, at present, I’m hammering my tado devices with changes, which in turn is hammering the batteries.

Just thinking now, if I ran the rule on a cron, every hour or 2, would it (at the time of running) check the state of TadoFamilyRoom_Temperature, or would I possibly need to persist the history of TadoFamilyRoom_Temperature?

Would it simply be enough to change

rule "Its Hot Detection!"
when
    Item TadoFamilyRoom_Temperature changed
then

to

rule "Its Hot Detection!"
when
    time cron 0 0 6-21 ? * * * //every hour between 6am & 9pm
then

or, am I missing something?

Neither of the suggested rule triggers do anything to any device. What do you mean here? Are you finding there is some problem with keep sending the same command in the rule,or something? Maybe the answer is not to do that - maybe check if something is already ON before commanding it ON etc.?

1 Like

On the back of ‘its hot’ being detected, I’m telling my 10 or so Tado devices to switch to manual mode. Effectively this is happening every time it’s hot is receiving a change from the “Tadofamilyroom” device. Hence me hammering the batteries :frowning:

Tadofamilyroom seems to be sending updates every 5 minutes or so (usually with tiny deviations to a decimal place). What I’m really wanting is to just check every hour or so if the temp of “tadofamilyroom” has vastly changed. And that’s what I’m struggling with.

I was initially doing the log directly with the tado items, but decided to use a pseudo switch (itshot). I can also manually toggle this. But what’s happening now, is I’m manually turning it’s hot on, but 2 minutes later tadofamilyroom sends an update and turns it back off.

I just need a way for “itshot” to ignore changes for a period of time. Which I thought I had done in previous rules, but apparently not!

I perhaps need to re-read my old thread I want my rule to just run the first time in a 24h window?

But you’ve got this one-hour timer running? Wouldn’t you check to see if the timer was running before doing the thing you don’t want?

cron is unlikely to help in these situations - the next cron run could be due in 20 minutes or 20 milliseconds time.

Yeah, I don’t think I’m going about it the right way?

Kinda seeking advice.

Would the one hour timer work, if I get the logic right?

Should I record the temp changes in persistence and check those at an interval I decide and then trigger?

It might help to set out your requirements clearly, before worrying at the “how”.

Presumably, you want a ‘thermostat’ - sensor too hot, do this; sensor too cold, do that. With a dead band, hysteresis, where you just keep doing whatever, no change. The hysteresis will eliminate any jitter, rapid fluctations.

I’m not sure where your timing requirement comes in. Want a manual override for a fixed time, I think? That’s fine, use the manual-initiating-action (whatever that is) to start a timer that locks out the usual thermostat action.

I doubt persistence comes into play, don’t you want to base all actions off of conditions “now” rather than “then”?

Ok, so rewind :slight_smile:

Unless you pay the tado subscription, you don’t seem to be able to utilise Geofencing and/or weather related on/off. So, no problem, I’ll do it with openhab…

So I currently have two rules;

rule "Its Hot Detection!"
when
    Item TadoFamilyRoom_Temperature changed
then
    if (TadoFamilyRoom_Temperature.state >= 18.00 | "°C") {
        if (tItsHot === null) {
            logInfo("EXTRA", "Family Room Temperature is high ("+TadoFamilyRoom_Temperature.state+"), the It's Hot toggle switch is now on until {}", now.plusHours(1))
            pushNotification("Temperature", "Breached threshold, toggle is ON")
            ItsHotTemperature.sendCommand(ON) //It's Hot toggle switch
            // first ON command, so create a timer to turn the switch off again
            tItsHot = createTimer(now.plusHours(1)) [|
            ItsHotTemperature.sendCommand(OFF)
        	logInfo("EXTRA", "Family Room Temperature has dropped ("+TadoFamilyRoom_Temperature.state+"), It's Hot toggle switch is now off {}", now)
            pushNotification("Temperature", "Dropped below threshold, toggle is OFF")
            ]
        }
    } else if (TadoFamilyRoom_Temperature.state <= 17.99 | "°C") {
        // remove any previously scheduled timer
        if (tItsHot !== null) {
            tItsHot.cancel
            tItsHot = null
            logInfo("EXTRA", "Temperature Timer has stopped")
        }
        ItsHotTemperature.sendCommand(OFF)
		pushNotification("Temperature", "Dropped below threshold, toggle is OFF")
    }
end

and then, the following, which is controlled by the aforementioned ItsHotTemperature pseudo switch.

rule "Set tado to Manual Control 1.0"
when
	Item ItsHotTemperature received command
then
	if (receivedCommand == OFF) {
			logInfo("EXTRA", "tado: It's not too hot, so Tado is set to Schedule/Auto mode")
			pushNotification("tado", "It's not too hot, so Tado is set to Schedule/Auto mode")
			TadoFamilyRoom_ZoneOperationMode.sendCommand("SCHEDULE")
            TadoUtilityRoom_ZoneOperationMode.sendCommand("SCHEDULE")
            TadoMasterBedroom_ZoneOperationMode.sendCommand("SCHEDULE")
            TadoOffice_ZoneOperationMode.sendCommand("SCHEDULE")
            TadoHallway_ZoneOperationMode.sendCommand("SCHEDULE")
            TadoLivingRoom_ZoneOperationMode.sendCommand("SCHEDULE")
            TadoHallwayUpstairs_ZoneOperationMode.sendCommand("SCHEDULE")
            DiningRoomTado_ZoneOperationMode.sendCommand("SCHEDULE")
    } else if (receivedCommand == ON) {
			logInfo("EXTRA", "tado: It's Hot, so Tado is set to Off/Manual mode")
			pushNotification("tado", "It's Hot, so Tado is set to Off/Manual mode")		
			TadoFamilyRoom_ZoneOperationMode.sendCommand("MANUAL")
			TadoFamilyRoom_TargetTemperature.sendCommand("9")
            TadoUtilityRoom_ZoneOperationMode.sendCommand("MANUAL")
            TadoUtilityRoom_TargetTemperature.sendCommand("9")
            TadoMasterBedroom_ZoneOperationMode.sendCommand("MANUAL")
            TadoMasterBedroom_TargetTemperature.sendCommand("9")
            TadoOffice_ZoneOperationMode.sendCommand("MANUAL")
            TadoOffice_TargetTemperature.sendCommand("9")
            TadoHallway_ZoneOperationMode.sendCommand("MANUAL")
            TadoHallway_TargetTemperature.sendCommand("9")
            TadoLivingRoom_ZoneOperationMode.sendCommand("MANUAL")
            TadoLivingRoom_TargetTemperature.sendCommand("9")
            TadoHallwayUpstairs_ZoneOperationMode.sendCommand("MANUAL")
            TadoHallwayUpstairs_TargetTemperature.sendCommand("9")
            DiningRoomTado_ZoneOperationMode.sendCommand("MANUAL")
            DiningRoomTado_TargetTemperature.sendCommand("9")   
    } 
end

The problem is, my “Its Hot Detection!” rule, is being triggered/updated every time TadoFamilyRoom_Temperature receives an update, which is quite frequently.

Therefore, my second rule is spamming my tado devices, which in turn is chewing their batteries.

I want to reduce the amount of data I’m sending to my tado devices. So I though that if I introduced an hour long timer (in which I had hoped to blank out the ItsHotTemperature switch, so it ignored actions within the following hour.

After thinking some more, this doesn’t seem the best approach (or even the right approach).

Having the ability to manually toggle this isn’t a huge priority. Once I get something that works, I guess I could alter the ItsHotTemperature rule to work on a Setpoint I can define over time. Whilst some days are hot by the thermostat, they don’t always feel hot…

For now, I am happy to let this automate itself, based on TadoFamilyRoom_Temperature.state >= 18.00 | “°C” and TadoFamilyRoom_Temperature.state <= 17.99 | “°C”. I just need to reduce the comms between openhab and the tado units.

It would even be enough to define the tado comms are only sent hourly, if that’s even possible. I don’t know if that’s controlled within openhab, or dictated by the tado API/stats themselves.

I’ve found an old rule I used, with a boolean var, would this potentially work?

var boolean ItsHotruleLock = false

rule "Its Hot Detection!"
when
Item TadoFamilyRoom_Temperature changed
then
if (TadoFamilyRoom_Temperature.state >= 18.00 | "°C" && !ItsHotruleLock) {
    if (tItsHot === null) {
        logInfo("EXTRA", "Family Room Temperature is high ("+TadoFamilyRoom_Temperature.state+"), the It's Hot toggle switch is now on until {}", now.plusHours(1))
        pushNotification("Temperature", "Breached threshold, toggle is ON")
        ItsHotTemperature.sendCommand(ON) //It's Hot toggle switch
			ItsHotruleLock = true 
        // first ON command, so create a timer to turn the switch off again
        tItsHot = createTimer(now.plusHours(1)) [|
        ItsHotTemperature.sendCommand(OFF)
    	logInfo("EXTRA", "Family Room Temperature has dropped ("+TadoFamilyRoom_Temperature.state+"), It's Hot toggle switch is now off {}", now)
        pushNotification("Temperature", "Dropped below threshold, toggle is OFF")
			ItsHotruleLock = false
        ]
    }
} else if (TadoFamilyRoom_Temperature.state <= 17.99 | "°C") {
    // remove any previously scheduled timer
    if (tItsHot !== null) {
        tItsHot.cancel
        tItsHot = null
        logInfo("EXTRA", "Temperature Timer has stopped")
    }
    ItsHotTemperature.sendCommand(OFF)
		pushNotification("Temperature", "Dropped below threshold, toggle is OFF")
}
end

Okay. That’s no problem at all. But what is about it what the rule does that is the problem?

Alright. So let’s not do that.
What triggers 2nd rule?
Commands.
So go back … why are we sending lots of commands?
Rule 1 sends commands if “this” or if “that”.
But let’s guess your requirement is to only send a new command if the new desired command is different from last time.
How can we remember what we did last time?
Well, if the Item in question is a Switch type, and if it has the usual default autoupdate action … the state will reflect the last command.
Last command =ON , current state = ON
How do we exploit that? It’s not hard

// arrive here if the code has decided it wants to command ON
// but only send the command if needed
if (myItem.state != ON) { myItem.sendCommand(ON) }

The spamming must be coming from timer cancellation section, since the ON will only be sent before a timer is created. To limit the OFF commands, move it and the pushNotification into the timer cancellation block. This is basically implementing what @rossko57 was teaching you, but using the existing timer cancellation block instead of adding a separate one for the switch itself.

As far as I can’t tell from the logs, its just circling (albeit correctly from a “rule point of view”), the problem is I need/want to slow it.

2020-06-05 09:51:20.216 [ome.event.ItemCommandEvent] - Item 'ItsHotTemperature' received command ON
2020-06-05 09:51:20.219 [ome.event.ItemCommandEvent] - Item 'TadoHeatingControl' received command OFF
2020-06-05 09:51:20.232 [ome.event.ItemCommandEvent] - Item 'TadoFamilyRoom_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:20.253 [ome.event.ItemCommandEvent] - Item 'TadoFamilyRoom_TargetTemperature' received command 10
2020-06-05 09:51:20.277 [ome.event.ItemCommandEvent] - Item 'TadoUtilityRoom_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:20.301 [nt.ItemStatePredictedEvent] - TadoFamilyRoom_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:20.317 [ome.event.ItemCommandEvent] - Item 'TadoUtilityRoom_TargetTemperature' received command 10
2020-06-05 09:51:20.338 [ome.event.ItemCommandEvent] - Item 'TadoMasterBedroom_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:20.357 [ome.event.ItemCommandEvent] - Item 'TadoMasterBedroom_TargetTemperature' received command 10
2020-06-05 09:51:20.377 [ome.event.ItemCommandEvent] - Item 'TadoOffice_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:20.396 [ome.event.ItemCommandEvent] - Item 'TadoOffice_TargetTemperature' received command 10
2020-06-05 09:51:20.418 [ome.event.ItemCommandEvent] - Item 'TadoRozSOffice_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:20.437 [ome.event.ItemCommandEvent] - Item 'TadoRozSOffice_TargetTemperature' received command 10
2020-06-05 09:51:20.457 [ome.event.ItemCommandEvent] - Item 'TadoHallway_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:20.476 [ome.event.ItemCommandEvent] - Item 'TadoHallway_TargetTemperature' received command 10
2020-06-05 09:51:20.496 [ome.event.ItemCommandEvent] - Item 'TadoLivingRoom_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:20.514 [ome.event.ItemCommandEvent] - Item 'TadoLivingRoom_TargetTemperature' received command 10
2020-06-05 09:51:20.534 [ome.event.ItemCommandEvent] - Item 'TadoBenjiSRoom_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:20.552 [nt.ItemStatePredictedEvent] - TadoFamilyRoom_TargetTemperature predicted to become 10
2020-06-05 09:51:20.569 [ome.event.ItemCommandEvent] - Item 'TadoBenjiSRoom_TargetTemperature' received command 10
2020-06-05 09:51:20.589 [ome.event.ItemCommandEvent] - Item 'TadoHallwayUpstairs_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:20.608 [ome.event.ItemCommandEvent] - Item 'TadoHallwayUpstairs_TargetTemperature' received command 10
2020-06-05 09:51:20.627 [ome.event.ItemCommandEvent] - Item 'DiningRoomTado_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:20.646 [ome.event.ItemCommandEvent] - Item 'DiningRoomTado_TargetTemperature' received command 10
2020-06-05 09:51:20.666 [nt.ItemStatePredictedEvent] - TadoUtilityRoom_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:20.679 [nt.ItemStatePredictedEvent] - TadoUtilityRoom_TargetTemperature predicted to become 10
2020-06-05 09:51:20.697 [nt.ItemStatePredictedEvent] - TadoMasterBedroom_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:20.710 [nt.ItemStatePredictedEvent] - TadoMasterBedroom_TargetTemperature predicted to become 10
2020-06-05 09:51:20.730 [nt.ItemStatePredictedEvent] - TadoOffice_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:20.744 [nt.ItemStatePredictedEvent] - TadoOffice_TargetTemperature predicted to become 10
2020-06-05 09:51:20.763 [nt.ItemStatePredictedEvent] - TadoRozSOffice_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:20.776 [nt.ItemStatePredictedEvent] - TadoRozSOffice_TargetTemperature predicted to become 10
2020-06-05 09:51:20.796 [nt.ItemStatePredictedEvent] - TadoHallway_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:20.810 [nt.ItemStatePredictedEvent] - TadoHallway_TargetTemperature predicted to become 10
2020-06-05 09:51:20.832 [nt.ItemStatePredictedEvent] - TadoLivingRoom_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:20.845 [nt.ItemStatePredictedEvent] - TadoLivingRoom_TargetTemperature predicted to become 10
2020-06-05 09:51:20.864 [nt.ItemStatePredictedEvent] - TadoBenjiSRoom_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:20.877 [nt.ItemStatePredictedEvent] - TadoBenjiSRoom_TargetTemperature predicted to become 10
2020-06-05 09:51:20.897 [nt.ItemStatePredictedEvent] - TadoHallwayUpstairs_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:20.910 [nt.ItemStatePredictedEvent] - TadoHallwayUpstairs_TargetTemperature predicted to become 10
2020-06-05 09:51:21.022 [nt.ItemStatePredictedEvent] - DiningRoomTado_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:21.035 [nt.ItemStatePredictedEvent] - DiningRoomTado_TargetTemperature predicted to become 10
2020-06-05 09:51:21.196 [vent.ItemStateChangedEvent] - Z_Socket_FF_Office_Power changed from 11 to 12.4
2020-06-05 09:51:22.470 [vent.ItemStateChangedEvent] - HueHallwayDownstairsMotionSensor_Motion changed from ON to OFF
2020-06-05 09:51:22.474 [vent.ItemStateChangedEvent] - hue_0107_001788a09e37_53_presence changed from ON to OFF
2020-06-05 09:51:24.094 [vent.ItemStateChangedEvent] - HueHallwayDownstairsMotionSensor_Motion changed from OFF to ON
2020-06-05 09:51:24.096 [vent.ItemStateChangedEvent] - hue_0107_001788a09e37_53_presence changed from OFF to ON
2020-06-05 09:51:25.205 [vent.ItemStateChangedEvent] - Z_Socket_FF_Office_Power changed from 12.4 to 11
2020-06-05 09:51:25.490 [ome.event.ItemCommandEvent] - Item 'ItsHotTemperature' received command ON
2020-06-05 09:51:25.497 [ome.event.ItemCommandEvent] - Item 'TadoHeatingControl' received command OFF
2020-06-05 09:51:25.536 [ome.event.ItemCommandEvent] - Item 'TadoFamilyRoom_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:25.562 [ome.event.ItemCommandEvent] - Item 'TadoFamilyRoom_TargetTemperature' received command 10
2020-06-05 09:51:25.595 [ome.event.ItemCommandEvent] - Item 'TadoUtilityRoom_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:25.612 [ome.event.ItemCommandEvent] - Item 'TadoUtilityRoom_TargetTemperature' received command 10
2020-06-05 09:51:25.654 [nt.ItemStatePredictedEvent] - TadoFamilyRoom_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:25.670 [ome.event.ItemCommandEvent] - Item 'TadoMasterBedroom_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:25.693 [ome.event.ItemCommandEvent] - Item 'TadoMasterBedroom_TargetTemperature' received command 10
2020-06-05 09:51:25.722 [ome.event.ItemCommandEvent] - Item 'TadoOffice_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:25.755 [ome.event.ItemCommandEvent] - Item 'TadoOffice_TargetTemperature' received command 10
2020-06-05 09:51:25.775 [ome.event.ItemCommandEvent] - Item 'TadoRozSOffice_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:25.793 [ome.event.ItemCommandEvent] - Item 'TadoRozSOffice_TargetTemperature' received command 10
2020-06-05 09:51:25.815 [ome.event.ItemCommandEvent] - Item 'TadoHallway_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:25.846 [ome.event.ItemCommandEvent] - Item 'TadoHallway_TargetTemperature' received command 10
2020-06-05 09:51:25.867 [ome.event.ItemCommandEvent] - Item 'TadoLivingRoom_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:25.885 [ome.event.ItemCommandEvent] - Item 'TadoLivingRoom_TargetTemperature' received command 10
2020-06-05 09:51:25.906 [ome.event.ItemCommandEvent] - Item 'TadoBenjiSRoom_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:25.926 [ome.event.ItemCommandEvent] - Item 'TadoBenjiSRoom_TargetTemperature' received command 10
2020-06-05 09:51:25.948 [ome.event.ItemCommandEvent] - Item 'TadoHallwayUpstairs_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:25.967 [nt.ItemStatePredictedEvent] - TadoFamilyRoom_TargetTemperature predicted to become 10
2020-06-05 09:51:25.985 [ome.event.ItemCommandEvent] - Item 'TadoHallwayUpstairs_TargetTemperature' received command 10
2020-06-05 09:51:26.006 [ome.event.ItemCommandEvent] - Item 'DiningRoomTado_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:26.026 [ome.event.ItemCommandEvent] - Item 'DiningRoomTado_TargetTemperature' received command 10
2020-06-05 09:51:26.052 [nt.ItemStatePredictedEvent] - TadoUtilityRoom_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:26.082 [nt.ItemStatePredictedEvent] - TadoUtilityRoom_TargetTemperature predicted to become 10
2020-06-05 09:51:26.110 [nt.ItemStatePredictedEvent] - TadoMasterBedroom_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:26.125 [nt.ItemStatePredictedEvent] - TadoMasterBedroom_TargetTemperature predicted to become 10
2020-06-05 09:51:26.143 [nt.ItemStatePredictedEvent] - TadoOffice_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:26.184 [nt.ItemStatePredictedEvent] - TadoOffice_TargetTemperature predicted to become 10
2020-06-05 09:51:26.209 [nt.ItemStatePredictedEvent] - TadoRozSOffice_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:26.232 [nt.ItemStatePredictedEvent] - TadoRozSOffice_TargetTemperature predicted to become 10
2020-06-05 09:51:26.254 [nt.ItemStatePredictedEvent] - TadoHallway_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:26.273 [nt.ItemStatePredictedEvent] - TadoHallway_TargetTemperature predicted to become 10
2020-06-05 09:51:26.291 [nt.ItemStatePredictedEvent] - TadoLivingRoom_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:26.308 [nt.ItemStatePredictedEvent] - TadoLivingRoom_TargetTemperature predicted to become 10
2020-06-05 09:51:26.327 [nt.ItemStatePredictedEvent] - TadoBenjiSRoom_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:26.348 [nt.ItemStatePredictedEvent] - TadoBenjiSRoom_TargetTemperature predicted to become 10
2020-06-05 09:51:26.370 [nt.ItemStatePredictedEvent] - TadoHallwayUpstairs_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:26.384 [nt.ItemStatePredictedEvent] - TadoHallwayUpstairs_TargetTemperature predicted to become 10
2020-06-05 09:51:26.405 [nt.ItemStatePredictedEvent] - DiningRoomTado_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:26.418 [nt.ItemStatePredictedEvent] - DiningRoomTado_TargetTemperature predicted to become 10
2020-06-05 09:51:26.442 [ome.event.ItemCommandEvent] - Item 'ItsHotTemperature' received command ON
2020-06-05 09:51:26.448 [ome.event.ItemCommandEvent] - Item 'TadoHeatingControl' received command OFF
2020-06-05 09:51:26.452 [ome.event.ItemCommandEvent] - Item 'ItsHotTemperature' received command ON
2020-06-05 09:51:26.456 [ome.event.ItemCommandEvent] - Item 'TadoHeatingControl' received command OFF
2020-06-05 09:51:26.472 [ome.event.ItemCommandEvent] - Item 'TadoFamilyRoom_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:26.496 [ome.event.ItemCommandEvent] - Item 'TadoFamilyRoom_TargetTemperature' received command 10
2020-06-05 09:51:26.519 [ome.event.ItemCommandEvent] - Item 'TadoUtilityRoom_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:26.538 [ome.event.ItemCommandEvent] - Item 'TadoUtilityRoom_TargetTemperature' received command 10
2020-06-05 09:51:26.559 [ome.event.ItemCommandEvent] - Item 'TadoMasterBedroom_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:26.577 [ome.event.ItemCommandEvent] - Item 'TadoMasterBedroom_TargetTemperature' received command 10
2020-06-05 09:51:26.597 [ome.event.ItemCommandEvent] - Item 'TadoOffice_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:26.612 [ome.event.ItemCommandEvent] - Item 'TadoOffice_TargetTemperature' received command 10
2020-06-05 09:51:26.631 [nt.ItemStatePredictedEvent] - TadoFamilyRoom_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:26.644 [ome.event.ItemCommandEvent] - Item 'TadoFamilyRoom_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:26.664 [ome.event.ItemCommandEvent] - Item 'TadoFamilyRoom_TargetTemperature' received command 10
2020-06-05 09:51:26.680 [ome.event.ItemCommandEvent] - Item 'TadoUtilityRoom_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:26.700 [ome.event.ItemCommandEvent] - Item 'TadoUtilityRoom_TargetTemperature' received command 10
2020-06-05 09:51:26.723 [ome.event.ItemCommandEvent] - Item 'TadoRozSOffice_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:26.740 [ome.event.ItemCommandEvent] - Item 'TadoMasterBedroom_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:26.758 [ome.event.ItemCommandEvent] - Item 'TadoMasterBedroom_TargetTemperature' received command 10
2020-06-05 09:51:26.778 [ome.event.ItemCommandEvent] - Item 'TadoRozSOffice_TargetTemperature' received command 10
2020-06-05 09:51:26.795 [ome.event.ItemCommandEvent] - Item 'TadoOffice_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:26.813 [ome.event.ItemCommandEvent] - Item 'TadoHallway_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:26.832 [ome.event.ItemCommandEvent] - Item 'TadoHallway_TargetTemperature' received command 10
2020-06-05 09:51:26.850 [ome.event.ItemCommandEvent] - Item 'TadoOffice_TargetTemperature' received command 10
2020-06-05 09:51:26.869 [ome.event.ItemCommandEvent] - Item 'TadoRozSOffice_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:26.888 [ome.event.ItemCommandEvent] - Item 'TadoLivingRoom_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:26.906 [ome.event.ItemCommandEvent] - Item 'TadoRozSOffice_TargetTemperature' received command 10
2020-06-05 09:51:26.925 [ome.event.ItemCommandEvent] - Item 'TadoLivingRoom_TargetTemperature' received command 10
2020-06-05 09:51:26.944 [ome.event.ItemCommandEvent] - Item 'TadoBenjiSRoom_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:26.962 [nt.ItemStatePredictedEvent] - TadoFamilyRoom_TargetTemperature predicted to become 10
2020-06-05 09:51:26.979 [ome.event.ItemCommandEvent] - Item 'TadoBenjiSRoom_TargetTemperature' received command 10
2020-06-05 09:51:26.998 [ome.event.ItemCommandEvent] - Item 'TadoHallway_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:27.017 [ome.event.ItemCommandEvent] - Item 'TadoHallwayUpstairs_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:27.036 [ome.event.ItemCommandEvent] - Item 'TadoHallway_TargetTemperature' received command 10
2020-06-05 09:51:27.055 [ome.event.ItemCommandEvent] - Item 'TadoHallwayUpstairs_TargetTemperature' received command 10
2020-06-05 09:51:27.084 [ome.event.ItemCommandEvent] - Item 'TadoLivingRoom_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:27.101 [ome.event.ItemCommandEvent] - Item 'DiningRoomTado_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:27.120 [ome.event.ItemCommandEvent] - Item 'TadoLivingRoom_TargetTemperature' received command 10
2020-06-05 09:51:27.139 [ome.event.ItemCommandEvent] - Item 'DiningRoomTado_TargetTemperature' received command 10
2020-06-05 09:51:27.157 [ome.event.ItemCommandEvent] - Item 'TadoBenjiSRoom_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:27.174 [ome.event.ItemCommandEvent] - Item 'TadoBenjiSRoom_TargetTemperature' received command 10
2020-06-05 09:51:27.193 [ome.event.ItemCommandEvent] - Item 'TadoHallwayUpstairs_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:27.208 [ome.event.ItemCommandEvent] - Item 'TadoHallwayUpstairs_TargetTemperature' received command 10
2020-06-05 09:51:27.230 [nt.ItemStatePredictedEvent] - TadoUtilityRoom_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:27.243 [ome.event.ItemCommandEvent] - Item 'DiningRoomTado_ZoneOperationMode' received command MANUAL
2020-06-05 09:51:27.266 [ome.event.ItemCommandEvent] - Item 'DiningRoomTado_TargetTemperature' received command 10
2020-06-05 09:51:27.285 [nt.ItemStatePredictedEvent] - TadoUtilityRoom_TargetTemperature predicted to become 10
2020-06-05 09:51:27.300 [nt.ItemStatePredictedEvent] - TadoMasterBedroom_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:27.318 [nt.ItemStatePredictedEvent] - TadoMasterBedroom_TargetTemperature predicted to become 10
2020-06-05 09:51:27.335 [nt.ItemStatePredictedEvent] - TadoOffice_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:27.348 [nt.ItemStatePredictedEvent] - TadoOffice_TargetTemperature predicted to become 10
2020-06-05 09:51:27.367 [nt.ItemStatePredictedEvent] - TadoFamilyRoom_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:27.380 [nt.ItemStatePredictedEvent] - TadoFamilyRoom_TargetTemperature predicted to become 10
2020-06-05 09:51:27.399 [nt.ItemStatePredictedEvent] - TadoUtilityRoom_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:27.418 [nt.ItemStatePredictedEvent] - TadoUtilityRoom_TargetTemperature predicted to become 10
2020-06-05 09:51:27.439 [nt.ItemStatePredictedEvent] - TadoRozSOffice_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:27.452 [nt.ItemStatePredictedEvent] - TadoMasterBedroom_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:27.470 [nt.ItemStatePredictedEvent] - TadoMasterBedroom_TargetTemperature predicted to become 10
2020-06-05 09:51:27.488 [nt.ItemStatePredictedEvent] - TadoRozSOffice_TargetTemperature predicted to become 10
2020-06-05 09:51:27.502 [nt.ItemStatePredictedEvent] - TadoOffice_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:27.521 [nt.ItemStatePredictedEvent] - TadoHallway_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:27.535 [nt.ItemStatePredictedEvent] - TadoHallway_TargetTemperature predicted to become 10
2020-06-05 09:51:27.553 [nt.ItemStatePredictedEvent] - TadoOffice_TargetTemperature predicted to become 10
2020-06-05 09:51:27.568 [nt.ItemStatePredictedEvent] - TadoRozSOffice_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:27.586 [nt.ItemStatePredictedEvent] - TadoLivingRoom_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:27.602 [nt.ItemStatePredictedEvent] - TadoRozSOffice_TargetTemperature predicted to become 10
2020-06-05 09:51:27.619 [nt.ItemStatePredictedEvent] - TadoLivingRoom_TargetTemperature predicted to become 10
2020-06-05 09:51:27.637 [nt.ItemStatePredictedEvent] - TadoBenjiSRoom_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:27.652 [nt.ItemStatePredictedEvent] - TadoBenjiSRoom_TargetTemperature predicted to become 10
2020-06-05 09:51:27.669 [nt.ItemStatePredictedEvent] - TadoHallway_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:27.682 [nt.ItemStatePredictedEvent] - TadoHallwayUpstairs_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:27.703 [nt.ItemStatePredictedEvent] - TadoHallway_TargetTemperature predicted to become 10
2020-06-05 09:51:27.721 [nt.ItemStatePredictedEvent] - TadoHallwayUpstairs_TargetTemperature predicted to become 10
2020-06-05 09:51:27.738 [nt.ItemStatePredictedEvent] - TadoLivingRoom_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:27.752 [nt.ItemStatePredictedEvent] - DiningRoomTado_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:27.768 [nt.ItemStatePredictedEvent] - TadoLivingRoom_TargetTemperature predicted to become 10
2020-06-05 09:51:27.786 [nt.ItemStatePredictedEvent] - DiningRoomTado_TargetTemperature predicted to become 10
2020-06-05 09:51:27.809 [nt.ItemStatePredictedEvent] - TadoBenjiSRoom_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:27.824 [nt.ItemStatePredictedEvent] - TadoBenjiSRoom_TargetTemperature predicted to become 10
2020-06-05 09:51:27.842 [nt.ItemStatePredictedEvent] - TadoHallwayUpstairs_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:27.856 [nt.ItemStatePredictedEvent] - TadoHallwayUpstairs_TargetTemperature predicted to become 10
2020-06-05 09:51:27.876 [nt.ItemStatePredictedEvent] - DiningRoomTado_ZoneOperationMode predicted to become MANUAL
2020-06-05 09:51:27.889 [nt.ItemStatePredictedEvent] - DiningRoomTado_TargetTemperature predicted to become 10
2020-06-05 09:51:28.193 [vent.ItemStateChangedEvent] - Z_Socket_FF_Office_Power changed from 11 to 12.1
2020-06-05 09:51:31.918 [ome.event.ItemCommandEvent] - Item 'ItsHotTemperature' received command ON
2020-06-05 09:51:31.927 [ome.event.ItemCommandEvent] - Item 'TadoHeatingControl' received command OFF

My previous post will help.

That’s purely because the room temp at the time was <=17.99, I’ve got/had ON logs…

So this is what we’re saying?

rule "Its Hot Detection - v31782636289698"
when
    Item TadoFamilyRoom_Temperature changed
then
    if (TadoFamilyRoom_Temperature.state >= 18.00 | "°C" && ItsHotTemperature.state != ON) {
            logInfo("EXTRA", "Family Room Temperature is high ("+TadoFamilyRoom_Temperature.state+"), the It's Hot toggle switch is now ON")
            pushNotification("Temperature", "Breached threshold, It's Hot toggle is ON -- tado should be OFF/Manual")
            ItsHotTemperature.sendCommand(ON) //It's Hot toggle switch
        }
    } else if (TadoFamilyRoom_Temperature.state <= 17.99 | "°C" && ItsHotTemperature.state = ON) {
        	logInfo("EXTRA", "Family Room Temperature has dropped ("+TadoFamilyRoom_Temperature.state+"), It's Hot toggle switch is now OFF")
            pushNotification("Temperature", "Dropped below threshold, It's Hot toggle is OFF -- tado should be ON/Scheduled")
       		ItsHotTemperature.sendCommand(OFF)
    }
end

Assuming the temp is >=18 and the Toggle is ON, the rule will be ignored? (and vice versa, <=17 and OFF)

Nope… I was saying…

rule "Its Hot Detection!"
when
    Item TadoFamilyRoom_Temperature changed
then
    if (TadoFamilyRoom_Temperature.state >= 18.00 | "°C") {
        if (tItsHot === null) {
            ItsHotTemperature.sendCommand(ON) //It's Hot toggle switch
            pushNotification("Temperature", "Breached threshold, toggle is ON")
            // first ON command, so create a timer to turn the switch off again
            tItsHot = createTimer(now.plusHours(1)) [|
                ItsHotTemperature.sendCommand(OFF)
                pushNotification("Temperature", "Dropped below threshold, toggle is OFF")
                logInfo("EXTRA", "Family Room Temperature has dropped ("+TadoFamilyRoom_Temperature.state+"), It's Hot toggle switch is now off {}", now)
            ]
            logInfo("EXTRA", "Family Room Temperature is high ("+TadoFamilyRoom_Temperature.state+"), the It's Hot toggle switch is now on until {}", now.plusHours(1))
        }
    } else if (TadoFamilyRoom_Temperature.state <= 17.99 | "°C") {
        // remove any previously scheduled timer
        if (tItsHot !== null) {
            tItsHot.cancel
            tItsHot = null
            ItsHotTemperature.sendCommand(OFF)
            pushNotification("Temperature", "Dropped below threshold, toggle is OFF")
            logInfo("EXTRA", "Temperature Timer has stopped")
        }
    }
end
1 Like

That’s bad syntax, you’d use double == for testing equal.
However, better to use != OFF for not-off. It’s not quite the same effect, as it will still work as desired if the Item happened to start out as NULL

Use hysteresis! Even mechanical thermostats include that, a “dead zone” where no change is commanded, the system is left to continue doing what it was doing. It stops the system rattling from one state to the other.
e.g.
> 18.2 or < 17.8 gives you 0.4 degrees of hysteresis

Thanks – I have implemented that change in the previous “rule” which I currently have commented out. But in theory, based on where @rossko57 is leading me (I think), I probably won’t need the timer?

I’m not sure what hysteresis is, but sounds like you’re recommending it – and I’m definitely leaning on recommendations right now!

How about this;

rule "Its Hot Detection - v31782636289698"
when
    Item TadoFamilyRoom_Temperature changed
then
    if (TadoFamilyRoom_Temperature.state >= 18.25 | "°C" && ItsHotTemperature.state != ON) {
            logInfo("EXTRA", "Family Room Temperature is high ("+TadoFamilyRoom_Temperature.state+"), the It's Hot toggle switch is now ON")
            pushNotification("Temperature", "Breached threshold, It's Hot toggle is ON -- tado should be OFF/Manual")
            ItsHotTemperature.sendCommand(ON)
	} else if (TadoFamilyRoom_Temperature.state <= 17.75 | "°C" && ItsHotTemperature.state != OFF) {
        	logInfo("EXTRA", "Family Room Temperature has dropped ("+TadoFamilyRoom_Temperature.state+"), It's Hot toggle switch is now OFF")
            pushNotification("Temperature", "Dropped below threshold, It's Hot toggle is OFF -- tado should be ON/Scheduled")
       		ItsHotTemperature.sendCommand(OFF)
    }
end