Read newline delimited data from stdin as a message and publish it to sensors/temperature topic

mosquitto_pub

  • A simple MQTT version 3.1.1 client that will publish a single message on a topic and exit.
    More information: <https://mosquitto.org/man/mosquitto_pub-1.html>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

{{echo data.txt}} | mosquitto_pub -t {{sensors/temperature}} -l

click the source code to copy install mosquitto_pub on any operating system with command-not-found.com