Add a line in the template to output all the models that the code is seeing in the template editor
{%- 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') | reject('eq', None) | unique -%}
{%- if (device_attr(device_id, 'model') == 'VZM31-SN') -%}
{%- set ns.devices = ns.devices + [device_id] -%}
{%- endif -%}
{%- endfor -%}
{{ ns.devices }}
{%- endif -%}
Still not working.
How do I do that? Isn’t it already trying to output the list?
Well, until you find out the actual model name, the code won’t work. Output the models the code is iterating over
Did you create this template or copy/paste?
The model name shows a hyperlinked VZM31-SN.
I created it.
Then you should know how to add a line to just view all the model numbers. I’m on mobile and I’m not going to write the code out. Maybe thefes will
I’ve quickly changed your template so it outputs your device models
{% for device_id in integration_entities('mqtt') | map('device_id') | unique %}
{{ device_attr(device_id, 'model') }}
{% endfor %}
Shows all devices now.
This is the one:
2-in-1 switch + dimmer (VZM31-SN)
So that’s what you use in your original template
Yes, and it’s not working either.
Post what you tried
Now it works.
What changed?
{%- 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') | reject('eq', None) | unique -%}
{%- if (device_attr(device_id, 'model') == '2-in-1 switch + dimmer (VZM31-SN)') -%}
{%- set ns.devices = ns.devices + [device_id] -%}
{%- endif -%}
{%- endfor -%}
{{ ns.devices }}
{%- endif -%}
The word innovelli was in the model before. Now it’s apparently not. You can ask the people over at zigbee2mqtt why they changed that.
Yeah just realized that now, thanks again.
I must need more coffee.
This will be less prone for issues after change in Zigbee2MQTT naming
{%- if 'VZM31-SN' in device_attr(device_id, 'model') -%}
Told you it would get fixed while I was asleep.
And the trace wasn’t so useless after all
Meh - I’d still say it’s useless.
The developer tools were much more useful.