Subscribe not working?

I have the following code:

def subscribeSensorEvents() {
	for (def i = 0; i < fireplaces.size(); i++)
	{
		def sensorDevice = this.getProperty("fireplaceSensor${i}")
		if (sensorDevice != null)
		{
			log.debug "subscribing to power event for ${sensorDevice}"
			subscribe(sensorDevice, "power", powerMeterEventHandler)
		}
	}
}

My subscribe is called (I see the log.debug in the logs) and seems to succeed. However, my powerMeterEventHandler never gets called. Looking in live logs I can see that power events are occurring. Any idea why this might happen?

Why don't you just do this?

subscribe(fireplaceSensors, "power", powerMeterEventHandler)

And see what happens? What is the difference in your code between fireplaceSensors and fireplaces? Which are you trying to subscribe to?

fireplaceSensors are power meters. fireplaces is an actual list of Fireplace devices controlled via IR using a BOND Home Hub.

I may have figured it out. While the Aeon Power Meter looks like it is sending events, I guess the events only send if the power usage level actually changes. Once I force the wattage to change I get an event.

1 Like

All events are like this, no change in value, no event...
Remember this is an event driven automation system, not a data reporting engine.

2 Likes