Child State Variables From Parent Device

Attribute event updates take place at the time of the event (written immediately) and you can create custom attributes as needed.

I didn't realize this myself but I've never had reason to use atomicstate anyway. I always use regular state variables.

As far as I know, attributes are part of state, but should remain consistent since a sendEvent will cause the attribute to update then return from execution, at which point the data will be written to the database.

You're right, atomicState is only available to apps, modifying it will cause an immediate write to the database. I use it a lot - possibly too much - in my LIFX Master app, which coordinates the discovery process from a child device (LIFX Discovery) and also provides shared code for the various child devices it creates, some of which can cause changes to one or other atomicState variable.

atomicState is quite expensive and is best avoided unless you have a good reason to use it.

How can I specify WHICH of multiple children I want to update?

You would have to find() that specific child based on whatever criteria you used to distinguish them when they were created.

1 Like

@jrfarrar you can look at my now deprecated Kof Fan driver for an example. I used a data value to distinguish each of my fanSpeed and light child devices. Reference lines 58 and 59.

Thank you, I accomplished my goal! However the code could be much cleaner...but...it's working! I was working on a Aeon HEM 1 driver with a parent and two children one for each clamp. I only need power in watts out of it so that's all I got working in the children...but good enough. I have a septic pump that's wired directly to the panel and sometimes it fails. I'd rather know before it fills and the alarm goes off. This way I can track the pump going on/off and frequency.