Executing the "GoodNight" routine causes my water heater switch to get turned on


(Dave) #1

So… when I tap the “GoodNight” routine, it turns on my Intermatic Relay switch that controls my water heater. Except the water heater isn’t part of the Good Night routine.

Any idea how I can troubleshoot this?
I do have a custom smartapp that controls my water heater on a 5-2 schedule, turning it on and off, twice a day on both the weekdays and the weekends… but again, that shouldn’t have anything to do with the built-in GoodNight routine.

I’m stumped.

Thanks in advance!


(Convinced ST will never be unbroken…) #2

Operations from Routines have been flaky for me the last few days. While you could try and reset up the Routine, it’s probably just another SmartThings glitch.


(Tim) #3

@dsevern While your Intermatic water heater switch might not be directly reference in the routine, have you considered whether any other SmartApp might be triggering on the change of modes? One place I would look is on the Intermatic device and confirm where it is being used. You can do this on the graph.api.smarthings.com site under the device… last row will list “In use by” apps.

Or alternatively from the mobile client, you can open the device and switch from “right now” to “SmartApps” in the ribbon. Any listed SmartApp may be effecting change. Check that those SmartApps aren’t triggered by a mode change.

To the point raised by @scottinpollock , there have been some issues with routines today… but my experience has been that routines are not triggering at all rather than falsely triggering actions.

Hope this helps

-Tim


(Dave) #4

As I mentioned, the water heater switch IS controlled by a SmartApp that I downloaded from someone else in this forum.
It’s a 5-2 day routine that causes the water heater to be turned on, twice a day, M-F and then Sat & Sun.

Here is the link to that code:

But again, I don’t see where/why this would have any connection to the GoodNight routine?!?!?!


#5

You can check the event log for the Intermatic device to see what requested that it turn on.

One) open the mobile app

Two) select my home/rooms (icon with four little squares at the bottom)

Three) Choose things

Four) find the Intermatic in the list and click on its name (not the icon on the left or right of the name, just the name itself) and this will open its details page.

  1. on the details page, click “recently” at the top right and you will see the list of events for that device. That should tell you if a specific smart app or routine sent the on message to the device.

(Dave) #6

So…checking the “Recently” list, as you advised…
I can see that at 12:21am the Water Heater switch was turned ON.

I can see that the “5-2 Water Heater Schedule” is what turned it on… apparently… but I don’t understand why that code would get triggered by my executing the “GoodNight” routine.

I then manually turned it off, after hearing the audible “click” from the Relay that told me it had been turned on by the GoodNight routine.
I hate to ask, but can someone help me debug that code in 5-2 Water Heater Schedule to figure out why it’s doing that?!?!


#7

Did you check which smart apps the water heater is connected to?


#8

OK, well at least now we know that it’s the smartapp.

This is almost always a mode issue.

Check the good night routine and see what if any mode it is changing to.

Check the water heater smart app and see what if any modes it runs in and what it doesn’t run in.

Also check the notifications to see what modes it saw.

  1. Open the mobile app

Two) click on the context menu icon in the upper right (three vertical dots or three horizontal lines depending on the version)

Three) select notifications. You should see a notification when the good night routine ran and it should tell you if it changed the mode.


(Dave) #9

I can see that the “GoodNight” routine changes the mode from Home to Night.

I just looked at the code for the 5-2 Water Heater schedule and I see no reference to “mode”, “home” or “night” anywhere in the code.


#10

Can you show us the screen shots for the water heater timer smart app? The ones where you set up the schedule?

If again you go to the details page for the Intermatic, instead of clicking “recently” at the top of that page , Click “smart apps” and it will show you the list of smart apps associated with that device. Then click on the water heater timer and it will open up the set up screens for it.


#11

Go into your water heater device in the ST App and go to the smart apps tab. See which apps the heater is connected to.


(Dave) #12

Well (feeling kind of embarassed)… I see it now. It shows that the SmartApp has the ability to assign it to specific modes.
I have it assigned to “Home” and “Night”… but… when I try to update it and remove any assignment to a specific mode, it doesn’t seem to save the change. It acts like it does but it just stays set at Home & Night.
I could uninstall the smartapp and re-install it and NOT set those modes when I re-install it… but that seems like the blunt force way to fix this. Any other ideas?




#13

No need to feel embarrassed, we’ve all done that at sometime. :sunglasses:

As far as saving it, one of the quirks of SmartThings is is that you have to tap done or next at the top right of every page as you go through for many smart apps, if you just click one of the return options at the top left, your stuff doesn’t get saved.

So the first thing is just to make sure that you are clicking the top right option every time it is presented to you.

I know there are some problems with android saving some data for some smart apps, but honestly I don’t know any more details than that. Uninstalling and reinstalling should solve that issue, though.


(Dave) #14

Yea. I used Next & Done and it still won’t save.

I wish I understood the code better to know why it’s causing it to turn on during a mode change.

I can see this is where the issue is:

def subscribeToEvents() {
subscribe(location, modeChangeHandler)

initialize()

}

// Handle mode changes, reinitialize the current temperature and
timers after a mode change, this is to workaround the issue of the last
timer firing while in a non running mode, resume operations when
supported modes are set
def modeChangeHandler(evt) {
log.debug “Reinitializing thermostat on mode change notification, new mode $evt.value”
//sendNotificationEvent("$thermostat Reinitializing on mode change notification, new mode $evt.value")
initialize()
}


#15

I can’t really follow code because I rely on text to speech, so someone else will have to help you, but it sounds to me (literally) like this is probably the issue:

reinitialize the current temperature and timers after a mode change,

That is, when the mode changes, it restarts the timers.

As I said, others will have to help you figure out exactly what’s going on, but it looks like this is one of those “my use cases not your use case” situations where somebody set up the code to fix a specific mode change problem they had run into at their house and the fix isn’t necessarily universally desirable.


(Barry) #16

I found the culprit (I think) - if the time is after midnight and before the first scheduled ON, the code sets up the schedule, then turns on the switch instead of turning it OFF.

see here:

    }
    else if (timeNow >= (midnightToday - 1).time && timeNow < timeToday(time1, location.timeZone).time) { // Are we between midnight yesterday and 1st time, schedule today
		schedule(timeToday(time1, location.timeZone), initialize)
        log.info("$thermostat Scheduled next adjustment for ${timeToday(time1, location.timeZone).format("EEE MMM dd yyyy HH:mm z", location.timeZone)}")
        //sendNotificationEvent("$thermostat Scheduled next adjustment for ${timeToday(time1, location.timeZone).format("EEE MMM dd yyyy HH:mm z", location.timeZone)}")
		log.debug "Turning on water heater"
		switches.on()
    }
	break

case Calendar.FRIDAY:

That last switches.on() should be switches.off() - you’ll have to make this edit in 4 places within the switch() statement (for the 4 different cases).


(Dave) #17

Thanks! I’ll give this a shot and see if it solves the issue!