MQTT Json Light Retain

I currently have a DIY lighting strip with an NodeMCU
Occasionally, it restarts,
Is it possible to get home-assistant to publish with the retain flag?
I have tried retain: true in the config but it doesn’t seem to work.

The retain flag works fine for me. Which broker are you using? I seem to remember the internal broker doesn’t handle this.

Perhaps you can publish this part of your config so we can see any differences? And what do you get when you subscribe to the topic with a command line tool such as mosquitto_sub?