Got it. Yeah, I see that. I tried editing the script a bit, but I think it’s a bit out of my wheelhouse for now. Maybe later down the line I’ll give it another go. Thanks for your help!
Hi Joshua,
Thanks for the effort on this. I just got it working, sort of on my HA installation.
The problem I’m having is in the blueprint line 390~.
I’m using two instances of Z2M because of covering two separate buildings. One named -1 and the second -2.
Looks like it’s stripping that to go with “zigbee2mqtt.” I can get manually change it to “zigbee2mqtt-1” and get it to work in one instance. Can the full path be carried over to the command path?
I’m a nube with the code. Sugestions?
Les
- variables:
command_path: "{% if repeat.item in command_path_map %}\n {{ command_path_map[repeat.item]
}}\n{% else %}\n zigbee2mqtt-1/{{ device_attr(repeat.item, \"name\") }}/set\n{%
endif %}"
There isn’t a way to get the command path in the script, so I had to hard-code the MQTT path on the line you found.
You can edit the blueprint, but then it would only work for one of the Z2M instances.
You could also copy the blueprint and have 2 instances of it and create a script instance for each blueprint. But that seems kind of wasteful.
There is a third solution that is built into the blueprint script instance. You can use the “Command Path Map” field for a custom path per-light entity:
light.west_light: "zigbee2mqtt/living_room/lights/west_light/set"
light.east_light: "zigbee2mqtt/living_room/lights/east_light/set"
The only downside is you would be adding this list for each call to the script.
Now that I am writing this, I think there might be a way to add a global map to the blueprint.
When I get some time, I will look into this.
I went ahead and made a script blueprint for controlling Inovelli LED notifications via ZHA: ZHA - Inovelli VZM31-SN Blue Series 2-1 Switch LED Notification Script
Awesome! Glad one exists for ZHA now.
@zanixmechanix I reused a lot of your code for another blueprint that uses ZHA and takes your idea of iterating through targets (such as areas, devices, entities) to get all switches found that correspond with the target. Also took the opportunity to optimize a few things and make the script faster. Would love your feedback! Thanks.
ZHA - Inovelli Blue Series Animated Notifications to single or multiple switches simultaneously!
Awesome! Glad to hear my code helped.
I see the biggest changes are the payload construction was moved out of the repeat loop and the removal of the “entity_id” parameter (which is only there since I made this script initially without the target options).
Not having to rebuild the payload on each loop would be slightly faster. Thanks for catching that, now I’ll have to update my blueprint.
No thank you @zanixmechanix . Your code saved the day! I’d been looking for a way to achieve a multicast to all switches at once and your iteration idea is for sure the closest thing to it. In essence, here is what I modified:
- Converted from Z2M to ZHA
1.1 Command_path removed
1.2 Changed integration: zha
1.3 service: mqtt.publish replaced by zha.issue_zigbee_cluster_command - Removed the Off values from most config options except from Effect, to generate 1 standard way to stop an animation and avoid confusion
- Changed several Default values so that the script does a bare minimal animation with bare minimal configuration
- Remove the depricated Entity_ID parameter and extra logic
- Took the payload building out of the loop for faster iteration
The rest, is basically the same! Could this be the ZHA alternative you suggest in this post instead?
- I agree with the multiple “off” options, I will update my blueprint as well.
- My thought on the default values is that the switch should clear the current effect when nothing is passed, so mine is staying the same.
- I’m removing
entity_id
on my next update too. - I’m doing this as well
As for replacing the ZHA script I mentioned with yours, I would rather add yours as an option.
Thanks for not kicking mine out
I updated my script with some of the improvements @diegomorales17 made (and more).
At the end of the day, our versions accomplish slightly different objectives, so it’s good to point people to whichever one suits their needs best.
Blueprint updated
2023.10.1
Add Fan Switch, Optimize Loop, Cleanup
- Add support for the “Inovelli Fan Controller (VZM35-SN)”
- Optimize looping over multiple entities
- Remove
entity_id
from fields/parameters- Use
target: entity_id: <entity>
instead
- Use
- Remove “Off” option from “Color” and “Duration”
- Use “Effect” instead
- “Off” values are still accepted, just not selectable from the fields
- Change “Brightness level” default from 40 to 100
- Sort the “Effect” to group similar effects together
2023.10.2
Update model filter to only model numbers
- This fixes the fan switch not working with the latest Zigbee herdsman converters
I am working on getting my porch light LED bar to turn red whenever I have the door unlock, and green whenever the door is locked. I am trying to just call the service after I created the script but nothing happens. Is this blueprint still supported and working? Many thanks!
Yes and yes.
You need to set an effect otherwise the default is to clear all effects.
Genius, I somehow missed that. I have it working now - cheers!
I’m going to apologize upfront because I’m sure that I’m missing something and my issue is user error.
I found and just installed the blueprint this evening after trying to figure out how to set LEDs 1-3 to blink when my alarm is armed. By the way THANK YOU for creating this!
However the script doesn’t seem to be working and I’m getting an error in my scripts.yalm file.
Is there something missing trailing “use_bluprint:”?
Also, In my configuration.yalm I have “script: !include scripts.yaml”.
I’m not sure why you are getting that error. The yaml looks ok to me, here is my scripts.yaml
.
Does this script appear in Developer tools > Services?
Does the log show any errors when using the script?
Are there any errors in the Home Assistant log?
If not, you can check one other possibility.
Does the name of the switch in Home Assistant match the name in Z2M?
If not, you will need to override the command path when calling the script.
- Find the command path
- Settings > Devices > MQTT (click on “## Devices”) > DEVICE NAME
- Click on “More Info” and expand “Payload”
- Find
command_topic
and copy the value
- Enter the
entity_id
of the light entity and thecommand_topic
copied from the device and paste it into the “Command Path Map” field
Example:
light.west_light: "zigbee2mqtt/living_room/lights/west_light/set"
light.east_light: "zigbee2mqtt/living_room/lights/east_light/set"