Node-Red, Shelly and MQTT

Hi!

If anyone can help me to change brightness in a Shelly bulb via mqtt using the home assistant node in node-red I would be very grateful.

I have tried for a couple of days now to get my Shelly Color Bulb to dimmer on command from node-red.
I am new to node-red however I have some experience with programming and I believe I should be able to get this to work. I think I have tried every possible solution there is and that has resulted in me misunderstanding the whole thing, digging myself deeper and have become extremely frustrated…

I have integrated the bulb with home assistant using the mqtt discovery script. I have also tried adding it to the configuration file using this configuration., but it seems to not make a difference. Please correct me if I’m wrong.

So the thing is that when I try to change brightness using the home assistant call service node, I can’t get it to work. I can turn it on and off, so the communication is there, but I can’t seem to figure out how to inject “brightness” to the light.

If I inject “gain” in to the mqtt publish node it works just fine, but I would rather use the home assistant call service node (the communication protocol is still mqtt) so I can see the change in the entity in home assistant. This doesn’t seem to be the case when communicating directly with the device from node red using mqtt.

If it helps, my end-goal is to create a wake-up light effect where the lights gradually increase brightness over time. I haven’t figured out how to do this yet either, but first I need to be able to change brightness. Then the question is how to change the payload from the dynamic dimmer node to that value…