OK, so I have a custom device connected to Cayenne through MQTT. It has a digital pin, and I’d like to be notified whenever its state changes. Unfortunately, apparently I can’t set a trigger explicitely to only fire on state changes - it will fire on every update from the device whenever the pin value is what I specified in the trigger.
From what I’ve learnt browsing around here on the forums, the suggested solution is to only send updates from the device when the state actually changes. I have two issues with this approach however.
First, if there are only data points on state changes, then the chart on the dashboard will “interpolate” between these points, showing like it would’ve gradually transitioned from the previous state over the whole time span. Makes it reading quite difficult.
The other problem is that from what I’ve observed, these updates are not always entirely reliable. My device might have connectivity issues, or for any other reason, a specific update might fail. If I only attempt to send updates on explicit state changes, then in case there’s a temporary failure at the time of the change, I’ll never get notified.
A solution might be that I chechk the state update operation for failure - but for some (to me incomprehensible) reason the Cayenne.virtualWrite() method returns void, despite the underlying method it uses does return a status code, which is promptly discarded. So I don’t even have the means to check whether the write succeeded.
So, all in all, how am I supposed to get notified of digital pin state changes? The best option would be if we had a trigger type explicitely for that (I guess this scenario must be quite common).