From 1f88438dd9bf3ca7ea42942fb47883a6f8a94e64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Koek?= Date: Thu, 19 Sep 2024 16:45:11 +0100 Subject: [PATCH] not sure why but i guess this works! --- .../ebyte_lora/ebyte_lora_component.cpp | 36 +++++++++---------- .../ebyte_lora/ebyte_lora_component.h | 14 ++++---- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/esphome/components/ebyte_lora/ebyte_lora_component.cpp b/esphome/components/ebyte_lora/ebyte_lora_component.cpp index f5d9921d65..3fb6f2cd9b 100644 --- a/esphome/components/ebyte_lora/ebyte_lora_component.cpp +++ b/esphome/components/ebyte_lora/ebyte_lora_component.cpp @@ -414,24 +414,24 @@ void EbyteLoraComponent::loop() { this->repeat_message_(data); } // only configs with switches should sent too -// #ifdef USE_SWITCH -// // Make sure it is not itself -// if (network_id_ != data[1]) { -// ESP_LOGD(TAG, "Got switch info to process"); -// // last data bit is rssi -// for (int i = 2; i < data.size() - 1; i = i + 2) { -// uint8_t pin = data[i]; -// bool value = data[i + 1]; -// for (auto *sensor : this->sensors_) { -// if (pin == sensor->get_pin()) { -// sensor->publish_state(value); -// } -// } -// } -// ESP_LOGD(TAG, "Updated all"); -// this->send_switch_info(); -// } -// #endif + // #ifdef USE_SWITCH + // // Make sure it is not itself + // if (network_id_ != data[1]) { + // ESP_LOGD(TAG, "Got switch info to process"); + // // last data bit is rssi + // for (int i = 2; i < data.size() - 1; i = i + 2) { + // uint8_t pin = data[i]; + // bool value = data[i + 1]; + // for (auto *sensor : this->sensors_) { + // if (pin == sensor->get_pin()) { + // sensor->publish_state(value); + // } + // } + // } + // ESP_LOGD(TAG, "Updated all"); + // this->send_switch_info(); + // } + // #endif break; case PROGRAM_CONF: ESP_LOGD(TAG, "GOT PROGRAM_CONF"); diff --git a/esphome/components/ebyte_lora/ebyte_lora_component.h b/esphome/components/ebyte_lora/ebyte_lora_component.h index b020086892..0091406c1a 100644 --- a/esphome/components/ebyte_lora/ebyte_lora_component.h +++ b/esphome/components/ebyte_lora/ebyte_lora_component.h @@ -1,6 +1,10 @@ #pragma once #include "esphome/core/component.h" +#include "esphome/core/helpers.h" +#include "esphome/components/uart/uart.h" +#include "esphome/core/log.h" +#include "config.h" #ifdef USE_SENSOR #include "esphome/components/sensor/sensor.h" #endif @@ -10,11 +14,6 @@ #include #include #include -#include "esphome/core/helpers.h" -#include "esphome/components/uart/uart.h" -#include "esphome/core/log.h" -#include "config.h" - namespace esphome { namespace ebyte_lora { @@ -51,14 +50,13 @@ class EbyteLoraComponent : public PollingComponent, public uart::UARTDevice { void loop() override; void dump_config() override; - #ifdef USE_SENSOR void add_sensor(const char *id, sensor::Sensor *sensor) { Sensor st{sensor, id, true}; this->sensors_.push_back(st); } void add_remote_sensor(const char *hostname, const char *remote_id, sensor::Sensor *sensor) { - //this->add_provider(hostname); + // this->add_provider(hostname); this->remote_sensors_[hostname][remote_id] = sensor; } #endif @@ -69,7 +67,7 @@ class EbyteLoraComponent : public PollingComponent, public uart::UARTDevice { } void add_remote_binary_sensor(const char *hostname, const char *remote_id, binary_sensor::BinarySensor *sensor) { - // this->add_provider(hostname); + // this->add_provider(hostname); this->remote_binary_sensors_[hostname][remote_id] = sensor; } #endif