def publish(self, topic, message):
        """Publish an MQTT message to a topic."""
        self.connect()
        log.info('publish {}'.format(message))
        self.client.publish(topic, message)
Publish an MQTT message to a topic.