Frequent events & flash wear?

Hi, I’m developing an Edge driver and am concerned about potential flash wear on the hub.

If a device emits attribute values very frequently (e.g., multiple updates in a short period, like a temperature or wind speed by a weather station), does this trigger more frequent saves of the driver’s state to flash? Or does the frequency of device:emit_event() calls not directly influence how often the state is persisted?

Thanks!

You don’t need to worry about flash wear unless you’re forcing the persistent flag with each event. Hubcore takes care of the rest to avoid excessive wear, when to flush the cache and write to the flash.

1 Like

Keep in mind that you can bring the network down to its knees if you saturate it with messages. The events need to be processed on the hub and this can cause slowdowns. What do you mean with “very frequently”?

temperature or wind speed

Do you really need to send this - say - multiple times per minute?

1 Like

Thanks for the quick help, @RBoy! That’s what I thought. My understanding is that __state_cache is only written to flash at set intervals, so how often the cache itself is updated (in memory) shouldn’t increase flash writes…

@Andreas_Roedl, good question. By ‘very frequently,’ I mean receiving multiple updates for sensor values (e.g., temperature, wind speed, illuminance) within a minute. The exact frequency can fluctuate depending on weather conditions.

My setup involves a SmartThings Edge driver that listens via WebSocket to a local LAN-based IoT gateway. This gateway, which has devices like a weather station connected to it, pushes new WebSocket messages with sensor data whenever the data changes. My driver then processes these messages and emits the updates for the respective SmartThings devices.

I had considered implementing rate-limiting on these messages, but I figured that would primarily be necessary if issues like excessive flash wear or, as you mentioned, high network traffic on the hub became a concern. Not sure what is considered best practice here. :slight_smile: