I want to find all switches manufactured by Aeotec and a specific model number (I’m writing an automaton to set their configuration properties).
This works, but I want the two device attribute checks as part of the filter query if that makes any sense? A single query, ideally, that produces entity_id list (comma separated) that I’ll pass to the zwave_js_configure method. Thanks!!!
Copy-paste the following template into the Template Editor and confirm it reports the information you want.
{% set ns = namespace(switches=[]) %}
{% for s in states.switch
if is_device_attr(s.entity_id, 'manufacturer', 'Aeotec Ltd.')
and is_device_attr(s.entity_id, 'model', 'ZWA023') %}
{% set ns.switches = ns.switches + [s.entity_id] %}
{%- endfor %}
{{ ns.switches }}
I wasn’t sure if I can mark both of yours a solution. I think they are both solutions. I will probably do what @petro put because it’ll be very clean passing it to the service to set the settings.
Wow this is awesome Petro! Thanks so much I didn’t know you could do this!
I’ll add in the multiple entity IDs as well from our previous conversation in this thread. I’m hoping it doesn’t generate too much traffic. I have the 2 second delay since I’ve noticed sending lots of Z-Wave commands tends to slow things down. Under the hood, does the set_config_parameter script have a “for” loop over all the entity IDs that you pass it, if you pass multiple? Hopefully that still works OK. I tested the script last night on the single entity ID and it worked well.
Thanks @petro . From the documentation, it does say that you can pass multiple entities. Can you not pass multiple entities? I’ll try it out, but if it only works with 1, maybe we need to update the docs?
Basically what I am doing, I am going to have this script run about once a week or so. I’ve found that I get new plugs every so often, and the default on these is actually a 0 watt and 0 amp change to send a Z-wave signal, so I noticed that VERY often (every few seconds) the plugs would be updating the Z Wave hub even if there was no change. This clogs the Z-wave network.
So I wanted a script that would replace my manual config in the Z-wave settings page (you can do what I’m doing from the UI).
The other benefit is that if I have to factory reset a device, I can restore my preferred settings repeatedly and without error.
I plan to make one of these scripts for each type of Z-wave plug I have that measures current.
I hope that makes sense. LMK if you think it’s a bad idea. I wouldn’t call it often, maybe not even automate it, but can do it if I change my setup and then it sets across the board.