Hey, quick question. Are we able to separate LED brightness for when a light switch is On and when it is Off? Currently, it looks like the LED brightness is the same for both.
Edit: Now that I have been playing around with the script for a bit. I see how the notification feature functions. I was looking for a way to change just the default LED color to a different one temporarily For example, while the door is unlocked all LED bars turn red. When locked, they turn back to blue.
While this script does give that functionality, making it a notification causes the loss of different brightnesses for when a switch is on or off and it loses the ability to see the current brightness of a light on the light switch.
Would you happen to know how easy or hard it would be to convert the script from notifications to regular LED colors?
You are correct, this Blueprint script only sets led_effect and individual_led_effect in Z2M.
If you want to set the default LED values, you can set the entities provided by the MQTT integration.
To find these, go to the device in Settings > Devices > MQTT > Device Name you will find LedColorWhenOff/On, LedIntensityWhenOff/On, and the per-LED variants DefaultLed#ColorWhenOff/On and DefaultLed#IntensityWhenOff/On.
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!
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:
@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.
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 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!
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.