Hello,
I am using an esp32 with esp-idf framework and thinger.io latest iotmp library taken from github.
My device is a sort of automatic gate which makes some move (open/close) 3-4 times a day. When a move is done, a bunch of statistic data are generated (ex. maximum current drawn, maximum temperature reached and things like that); those statistics are to be collected, but does not make sense to collect them “every 15 minutes” or similar.
My aim is to initiate a refresh of those resources (statistics) when the move is done. For example, I declared a resource like this:
thing["openclose"] = [](thinger::iotmp::output& out) {
out["value"] = st_aprchi;
};
For what I undestand, “openclose” is the name of the resource, and the resource can contain a few fields - I used just once for now, a numeric value 2=closed, 1=opened, 0=unknown.
What I want is that, when the device completes a move (commanded locally, not remotely), the new status is published suddenly, but I don’t see a way to do it. I prepared a data bucket:

and set the refresh mode as “stream by device”. But how can the device start to stream this resource? And, “stream” is not the proper term for what I want to do: I want to update the value just few times a day, it’s more like an event to say “the status has changed” or a “publish” (event+value). I tried to force a refresh using:
thing.stream(“openclose”);
but it doesn’t seem to work. Also, I’ve seen a similar (old) message on this very forum (Unsuccessfully trying to make dashboard snappier), but didn’t understand much and, while the author addressed exactly my same problem, it seems a different conclusion came out.
Thank you in advance.