From 6ffdd099c9d3a072d6fa0ff21d3d680ae01b7074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Koek?= Date: Tue, 26 Mar 2024 18:41:32 +0000 Subject: [PATCH] Update lora.cpp --- esphome/components/lora/lora.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/esphome/components/lora/lora.cpp b/esphome/components/lora/lora.cpp index 13f179a28e..72590c1736 100644 --- a/esphome/components/lora/lora.cpp +++ b/esphome/components/lora/lora.cpp @@ -162,8 +162,12 @@ void Lora::loop() { ESP_LOGD(TAG, "PIN: %u ", data[1]); ESP_LOGD(TAG, "VALUE: %u ", data[2]); ESP_LOGD(TAG, "RSSI: %#02x ", data[3]); - this->rssi_sensor_->publish_state(data[3]); - this->message_text_sensor_->publish_state("Got something"); + if (this->rssi_sensor_ != nullptr) + this->rssi_sensor_->publish_state(data[3]); + if (this->message_text_sensor_ != nullptr) + this->message_text_sensor_->publish_state("Got something"); + if (this->pcf8574_ != nullptr) + this->pcf8574_->digital_write(data[1], data[2]); } else { ESP_LOGD(TAG, "WEIRD"); }