No call to mode change event, nor installed() / updated()

Hi, all. Two issues:
(1) I'm trying to get the mode change event to trigger, but it won't.
(2) I also don't see any call to installed() or updated() when I change the code (there's nothing logged as the code below would imply).
Is there something obvious that I've got wrong?
Thanks for the help!

definition(
name: "Temperature Manager",
namespace: "ns",
author: "Len Hodder",
description: "Building Temperature Manager",
iconUrl: "",
iconX2Url: "",
iconX3Url: "",
singleInstance: true)

preferences {
page(name: "pageConfig")
}

def pageConfig() {
dynamicPage(name: "", title: "", install: true, uninstall: true, refreshInterval:0) {

section("Inputs") {
  input "disableSchedule", "capability.switch", title: "Disable Schedule", required: true
    input "officeThermostat", "capability.thermostat", title: "Office Thermostat", required: true
    input "eastShopThermostat", "capability.thermostat", title: "East Shop Thermostat", required: true
    input "westShopThermostat", "capability.thermostat", title: "West Shop Thermostat", required: true
}

}
}

def installed() {
log.debug "installed"
initialize()
}
def updated() {
log.debug "updated"
unsubscribe()
initialize()
}
def initialize() {
log.debug "initialize"
unschedule()
runEvery1Minute(checkDevices)

subscribe(location, "mode", modeEvent)
//if(modes) subscribe(location, modeEvent)
//Refresh devices
subscribeNow()
runRefresh()
}
def uninstalled() {
log.debug "uninstalled"
}

// Schedule refresh
def modeEvent(evt) {
log.info "New mode at " + now() + " is " + location.mode
// Force Refresh now!
refresh()
}

def checkDevices() {
log.debug "checkDevices" + disableSchedule
log.debug "office setpoint " + officeThermostat.currentValue("heatingSetpoint")
}

def refresh() {
log.debug "refresh"
}

def runRefresh() {
log.debug "runRefresh"
}

installed() is called the first time Done is hit in the app, and only then. updated() is called every subsequent time Done is hit.

Look at the App Status page (gear icon) to see if there is an Event Subscription for location mode. Like this:

1 Like

Thanks for the reply.

By “done” do you mean “save”?

I’m showing “no event subscriptions set”. Do I need to do something special outside the code to allow the subscription? If it’s not calling updated() then it probably isn’t registering the subscribe?

OK... now I see. Just saving the code isn't enough to trigger updated(). I also have to go to Apps -> (my app) -> Done to get it to actually update.

Once I did that, I see the call to update() in the log and I see the new event subscription appear.

Thanks for the help.