I’ve been searching for this and have yet to figure it out. I understand I can set config parameters in HA. What I haven’t figured out is how to template a list of entity id’s based on a zwave model so I can write the automation once and than bulk update config parameters without have to manually search entity id’s etc.
ie. I want to grab all the HS-WD100+ in HA, loop through them and set the config parameters without having to list the entity_id’s manually.
Here’s a pure template service call that I think does what you want.
service: zwave_js.set_config_parameter
data:
parameter: 4
value: 'No'
device_id: >
{% set ns = namespace(devices=[]) %}
{% for id in integration_entities("zwave_js") %}
{% if device_attr(id, "model") == "14294 / ZW3005" %}
{% set ns.devices = ns.devices + [device_id(id)] %}
{% endif %}
{% endfor %}
{{ ns.devices | unique | list }}
It loops through all of the entities for the Z-Wave JS integration and for each entity, queries the entity’s device model, and if it’s the desired model name ("14294 / ZW3005" in the example) adds the entity’s device ID to a list of device IDs. At the end, it reduces the list to the unique set of device IDs. That set is then the target of the service call.
Another non-template approach would be to just create a group consisting of one entity from each desired device, and just pass the group entity ID to the service call instead.
Was looking for a solution to simplify an automation where I update a ZWave parameter for a large number of devices and this worked PERFECTLY. Wanted to say THANK YOU to freshcoat for this snippet of code that made things a ton easier as I migrated some automations from HomeSeer to HomeAssistant!