INNER CODE UNIT · Python

temp_connection_callback

bkbilly/lnxlink · lnxlink/__main__.py:381

    def temp_connection_callback(self, status):
        """Report the connection status to MQTT server"""
        logger.info("Got Temp Connection Callback with status %s", status)
        self.kill = True
        if status:
            logger.info("Power Down detected.")
            self.mqtt.is_disconnecting = True
            if hasattr(self.mqtt.client, "is_disconnecting"):
                self.mqtt.client.is_disconnecting = True
            self.mqtt.send_lwt("OFF")
            if self.config["mqtt"]["clear_on_off"]:
                for topic, message in self.monitor_topics.items():
                    message = self.replace_values_with_none(message)
                    self.mqtt.publish(topic, message)
        else:
            logger.info("Power Up detected.")
            self.invalidate_publish_cache()
            self.mqtt.is_disconnecting = False

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…