N00b MQTT question.
Situation: I have a network of The Things Network lorawan sensors connected to HA. TTN has an MQTT broker which publishes the uplink data. Roughly following this blog, I have my own MQTT broker on my local network which subscribes to the TTN Broker, and then relays the messages to HA. This all works OK.
Aim: What I am now trying to do is send data the other way: i.e. send downlink commands from HA to one of the nodes my Things Network. I have this working from the command line in my MQTT broker. (Probably not hugely important to this query, but this is the CLI command which works as expected):
mosquitto_pub -d -h MYTENANT.eu2.cloud.thethings.industries -u 'MYAPP@MYTENANT' -P 'REDACTEDPASSWORD' -t 'v3/MYAPP@MYTENANT/devices/orchard-controller/down/push' -m '{"downlinks":[{"f_port": 1,"frm_payload":"BQASdTA=","priority": "NORMAL"}]}'
Problem: I cannot figure out how to send this within HA. If I go to ‘Publish a packet’ under my MQTT integration, the ‘broker address’ is the address of my local broker, not the TTN host that I am trying to reach (MYTENANT.eu2.cloud.thethings.industries). Do I need to modify the relay script running on my local MQTT broker? Or can I create a second MQTT integration within HA which points directly to TTN’s broker? Or am I missing something else altogether?