Help with events and subscriptions

In looking at the logs for one of my SmartSense motion/temperature sensors it looks like the criteria for when a temperature event is posted is once per hour unless the temperature hasn’t changed at least 1°. Is this a function of the platform or a function of the sensor? If I didn’t have this device and the ability to review a log, how would I get this information?

Is it correct to say that if I wanted more frequent reports from the sensor I could query it on another schedule in a SmartApp?

Is it possible to subscribe to a condition. For example, is this valid:

subscribe(TemperatureSensors, (temperature.value < 33), WhenItsFreezingHandler)

. . . meaning that the platform would post an event every time the expression (temperature.value < 33) changes from true to false and vice versa.

I know I could subscribe the the temperature and just evaluate whether or not its below 33 every time but that seems less efficient.

I believe you have to go at it the less efficient way

… . after thinking about it some more, I don’t really think the idea of the platform deriving events from a conditional expression is reasonable . . . so, yea, subscribe and evaluate seems to be the best approach.

However. . .

I would still really like to know what, in the system, is imposing the rule. The rule for this device seems to be to post an event every hour unless the value hasn’t changed. Is the sensor imposing this rule and pushing updates back to the hub based on this rule? Or, is the platform using some sort of scheduling engine to generate polls to the sensor, then comparing to the last value, then deciding whether or not to post an event?

I there a detailed technical spec somewhere for the SmartSense motion/temperature sensor that gets to some of the details. I’m also interested in raw format of the temperature data coming from the sensor itself.

Any help, re-direct, insight, would be greatly appreciated.

That I don’t know…

Paging @urman

1 Like

the rules are configurations sent to device during pairing, and live on the device itself. The device sends mandatory hourly reports on temp, unless there is a sensor change of 1 degree. On that change, the result is sent within 5 minutes.

Motion events are sent immediately.

It is not a platform based schedule or logic to poll around. The configure() block of the device type shows the configure messages and have some comments. They are ZigBee specific protocol level messages.

1 Like

@urman - Much appreciated. This was just enough to get me on a path to learn something.

I found the ST Zigbee primer but it is very much just an introduction. It did lead me to the Zigbee Cluster Library . . . well, the link was broken in the docs but I did find it here. I looked at the configure() block in the code and tried to find references in the ZCL. I quickly discovered that there must be an ST interpretation layer between the groovy code and the actual messages going out over the Zigbee network. I did not find any documentation of the interpretation layer.

I did find references to min and max reporting intervals and found values in the code that correspond to the 5 and 60 minute and 1° rules you mentioned.

However, the log of my Motion/Temperature sensor does not reflect these rules. So, it seems like there must be another rules layer. Maybe the sensor reports every hour no mater what but the platform is looking at the last event and, if there has been no change, decides not to declare an event for this hour.

So, I now have some vague understanding of how this works. The rest, I think, will have to come with time, experience, and improved documentation. @Jim

@AaronZON if an event is the same as the last event its not a “displayed” event. If you want to see the logs you will have to go to the “display all” tab of the logs page. You can also turn on extra events in the mobile clients.

The extra layer is the Ember stack. You can see the message here in the Ember Application Framework document:

Page 46 has the documentation for send-me-a-report

@urman, thanks for pointing me to the Ember documentation. This makes a lot more sense now. Much appreciated.

I’m still having trouble reconciling this:

to this:

Is this the ‘display all’ view you referenced? Notice the 2 hour gap between the event 1 hour ago and the next one 3 hours ago.

click on “from device”

Same gap. Sorry to keep beating this dead horse. . . just trying to understand.

maybe I’m misunderstanding the question?

That screenshot appears to have the temperature reports every hour at around 18-19 minutes passed the hour.

Since time had passed, you have look at the bottom of the second screenshot to see the gap that is greater than one hour.

I checked the logs, just now, for the 2 motion sensors I have and they show regular reporting as is defined in the DeviceType. So, maybe something abnormal was causing the inconsistency I observed in the logs yesterday. I’m prepared to call this good and move on to the next opportunity. Thanks for hangin’ with me on this, @urman.

ain’t NO thang but a chicken wing brutha

1 Like