I’d like to publish the contents of a binary file via MQTT as part of an automation. I don’t see how to get the contents of the file to the MQTT Publish service, and it looks like the service expects a string payload, not binary data. Am I missing something? If so, what?
I can use shell_command to run a python script that reads the file and publishes its contents using paho.mqtt.client. This works well, except that my python script has to hard-code the MQTT configuration. I’d rather not be doing that, especially since the MQTT server requires a username and password.
Thanks!