def publish(self, topic, payload, retain, qos):
        MQTT_Base.publish(self, topic, payload, retain, qos)

        def p():
            self.mqtt_client.publish(topic, payload, retain=retain, qos=qos)

        wrapped = functools.partial(p)
        self.event_loop.call_soon_threadsafe(wrapped)
Beispiel #2
0
    def publish(self, topic, payload, retain, qos):
        MQTT_Base.publish(self, topic, payload, retain, qos)

        if self.mqtt_connected is True:
            wrapped = functools.partial(self.mqtt_client.publish,
                                        topic,
                                        payload,
                                        retain=retain,
                                        qos=qos)
            self.event_loop.call_soon_threadsafe(wrapped)
        else:
            logger.warning(
                "Device MQTT publish NOT CONNECTED: {}, retain {}, qos {}, payload: {}"
                .format(topic, retain, qos, payload))
Beispiel #3
0
 def publish(self, topic, payload, retain=True, qos=0):
     if isinstance(payload, bool):
         # boolean types must be sent as "true" or "false"
         payload = str(payload).lower()
     MQTT_Base.publish(self, topic, payload, retain, qos)
     self.mqtt_client.publish(topic, payload, retain=retain, qos=qos)
Beispiel #4
0
 def publish(self, topic, payload, retain=True, qos=0):
     MQTT_Base.publish(self, topic, payload, retain, qos)
     self.mqtt_client.publish(topic, payload, retain=retain, qos=qos)