Hmm this is a bit to complex for me, hopefully someone that
knows what/how you are trying to accomplish this will chip in.
I don’t know as I’m still not sure how the relay is connected to HA.
To find out if cloud MQTT is connected I would call a notify service to send a message/text (like push bullet or the persistant notify service) when the trigger is triggered. I assume you have a cloud app that sends a http request to HA via cloud MQTT to HA when you click a button.
listen_port (Optional): The port the Hue bridge API web server will run on. If not specified, this defaults to 8300. This can be any free port on your system.