How are you triggering?
Manually triggering works, thatās what Iām using to test.
I noticed something I thought was weird, and I donāt know if it is important.
entity_id": "script.inovelli_mass_configurator_duplicate",
my query was, why the reference to āduplicateā?
Anyway, my bedtime now, maybe someone else will spot something while I sleep. Wish I could be more help.
I duplicated the script so I could mess with it during testing. The one I posted here was the original script. The duplicate is the same as the original as well.
Just a wild guess - is this indicating that your device
variable is producing an empty list? Might want to check that part of the script
Why would this suddenly result in an empty list? It didnāt before.
Also this code syntax is proper. Any ideas?
The name of your dimmers probably changed in z2m. Adjust the code to look for the new names
I checked that too, it matches.
Thatās the only limiting factor in the code.
I know. Itās almost as if the code is failing to run at all. But there are no errors in any logs.
Probably because the message is successfully published to MQTT. Thereās just nothing happening after that, I suppose. The trace shows your script ran successfully. Youāll need to check the MQTT topics/config (I donāt know z2m). I think youāll find that if you manually publish your MQTT message via the dev tools that nothing will happen. Take it from there.
Did you try to test your template which creates the devices variable in devtools > templates?
In the trace it shows that it returned an empty list. Which would indeed result in your script doing nothing (the input for your first for_each
repeat is an empty list)
When pasting the whole script in Developer tools > template, I get:
ārepeatā is undefined.
Doesnāt make much sense, it is absolutely defined.
No thatās not the template I meant.
This template seems to be returning an empty list
{%- set device = iif(device is string, [device], device) -%}
{%- if (device | length > 0) -%}
{{ device }}
{%- else -%}
{%- set ns = namespace(devices=[]) -%}
{%- for device_id in integration_entities('mqtt') | map('device_id') | unique -%}
{%- if (device_attr(device_id, 'model') == 'Inovelli 2-in-1 switch + dimmer (VZM31-SN)') -%}
{%- set ns.devices = ns.devices + [device_id] -%}
{%- endif -%}
{%- endfor -%}
{{ ns.devices }}
{%- endif -%}
That just shows
[]
And Iāve changed the name to match model in Z2M in every way imaginable, it still shows
[]
What could this be? The code again seems to not be running at all.
Itās the device model, not the name
Yes, the device model matches whatās in Z2M.
Description: 2-in-1 switch + dimmer
Zigbee Model: VZM31-SN
Model: VZM31-SN
So thatās your issue, you are not providing any device for the repeat action
Your code is looking for this model.
I know, Iāve changed it to just VZM31-SN
Itās still showing
[]