Managing events on device state changes

Is it possible to update the state of a device without logging an event, or alternatively control on a per-event basis the retention? The scenario is I've written a custom driver for monitoring a Cummins standby generator. Some state changes such as utility power loss or generator start I'd like to have a long retention on. Other state changes such as last update time, voltage, frequency change all the time and the history is less interesting. I'm using sendEvent for sending the state changes. It's marked as TBD in the docs so I'm guessing what the various options are in the samples.

Once I have the driver fully stabilized, I'll post it to github.

HE is a event driven model, so no way of updating the current state (i.e. attribute values) without using an event. Note that, by default, events only get recorded in the system if the attribute changes value. The retention is set by device, but is regulated by number of events which means that an attribute that updates less frequently will have event values that are available for a longer time frame that those who update frequently.

Gotcha, so this is the one knob to control?

image

Related to this, is there documentation on sendEvent for what the parameter are? I've been using it by looking at other drivers as samples.

Download the Hubitat app