Rule for devices battery level ?
-
Ian thank you. I thought it would be the battery_power capability, but I didn't know how to write that in an expression. I will try it now.
-
-
@cw-kid You could also do all that in one expression if you prefer and are not using the other ones for anything else.
join( each id in matchEntities( { controller: 'vera', capability: 'battery_power' } ): do device=getEntity( id ), device.attributes.battery_power.level > 0.1 ? null : device.name + " at " + device.attributes.battery_power.level * 100 + " percent" done, ", " )
-
toggledbitswrote on Nov 10, 2021, 5:59 PM last edited by toggledbits Nov 10, 2021, 1:54 PM
Just a point here: why limit
matchEntities()
to one controller? Would you not perhaps want an alert for a device on any controller that has a low battery level?Also, don't forget about the
format()
function, which is meant for things like this...device.attributes.battery_power.level > 0.1 ? null : format( "{} at {:.1%}", device.name, device.attributes.battery_power.level )
Oh, and in my home, any battery-operated device would be long dead if it was reporting 10% (0.1). Most of mine seem to start to malfunction below 50%.
-
@toggledbits I'm trying to understand the pros and cons of using this vs the new DynamicGroupController, could you give a short summation?
-
Hi @crille !
In this post we are having this discussion about Dynamic, I am having a hard time getting it to work, but it will be very good, the concept is great and this will make it much easier.
https://smarthome.community/topic/793/multidimensional-array/17?_=1638031443562&loggedin=true
-
@wmarcolin Yes, but the goal seems to be the same so what's the pros of doing it in the DynamicGroupController? More efficient, more dynamic, less complex etc, than a global expression like the one above?
I'm all up for new improved ways of doing things just need an explanation of why -
In my opinion, everything you put in: more efficient, more dynamic, less complex. Below is a screenshot of how I do it today, and it would be replaced only by the format expression already directly inside a message as per telegram.
I will also use it to easily know all the devices that will be tripped in the house, see the other post for what I am adding after the battery. Besides this, unifying devices that for example are triggered by a contact or movement and have different expressions, will help unify and set up the alarm trigger management.
-
-