mirror of
https://github.com/esphome/esphome.git
synced 2024-11-24 07:58:09 +01:00
not sure why but i guess this works!
This commit is contained in:
parent
8fb544b4cf
commit
1f88438dd9
2 changed files with 24 additions and 26 deletions
|
@ -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");
|
||||
|
|
|
@ -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 <utility>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#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
|
||||
|
|
Loading…
Reference in a new issue