INNER CODE UNIT · Python

_publish_monitor_message

bkbilly/lnxlink · lnxlink/__main__.py:231

    def _publish_monitor_message(self, topic, pub_data, retain):
        """Publish a monitor value and cache only transport-accepted data."""
        if retain:
            self.monitor_topics[topic] = pub_data
        delivery_token = self.mqtt.delivery_token
        msg_info = self.mqtt.publish(topic, pub_data, retain)
        if self.mqtt.publish_accepted(msg_info):
            self.prev_publish[topic] = pub_data
            self.prev_publish_transport[topic] = delivery_token
        else:
            self.prev_publish.pop(topic, None)
            self.prev_publish_transport.pop(topic, None)

    def run_module(self, name, method, retain=True, force_update=False, **kwargs):
        """Runs the method of a module"""
        coalesce = kwargs.get("coalesce", True)
        max_failures = 5
        if self.module_failures.get(name, 0) >= max_failures:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…