sendLocationEvent not triggering location handler

I have two test apps.

Location Client:
def initialize() {
// TODO: subscribe to attributes, devices, locations, etc.
log.debug location
subscribe(location, locHandler)
}

// TODO: implement event handlers
def locHandler(evt)
{
log.debug evt.name
log.debug evt.value
}

and LocationSender:

def clickHandler(evt)
{
log.debug "sending location event"
def event = [
name: “alarmSystemStatus”,
value: name,
isStateChange: true,
displayed: true,
description: “alarm system status is ${name}”,
]
sendLocationEvent(event)
}

The location handler is never called when I tap the LocationSender app to make it send a Location event. isStateChange is also set to true. What could be wrong with these apps?

Update:

turns out the name of the event matters. I missed that subscribe(location, handler) is a shortcut for subscribe(location, “mode”, handler). My event name is not “mode”. Once I change the name of the event to “mode”, then everything works fine.

1 Like