mirror of
https://github.com/esphome/esphome.git
synced 2024-11-28 09:44:12 +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);
|
this->repeat_message_(data);
|
||||||
}
|
}
|
||||||
// only configs with switches should sent too
|
// only configs with switches should sent too
|
||||||
// #ifdef USE_SWITCH
|
// #ifdef USE_SWITCH
|
||||||
// // Make sure it is not itself
|
// // Make sure it is not itself
|
||||||
// if (network_id_ != data[1]) {
|
// if (network_id_ != data[1]) {
|
||||||
// ESP_LOGD(TAG, "Got switch info to process");
|
// ESP_LOGD(TAG, "Got switch info to process");
|
||||||
// // last data bit is rssi
|
// // last data bit is rssi
|
||||||
// for (int i = 2; i < data.size() - 1; i = i + 2) {
|
// for (int i = 2; i < data.size() - 1; i = i + 2) {
|
||||||
// uint8_t pin = data[i];
|
// uint8_t pin = data[i];
|
||||||
// bool value = data[i + 1];
|
// bool value = data[i + 1];
|
||||||
// for (auto *sensor : this->sensors_) {
|
// for (auto *sensor : this->sensors_) {
|
||||||
// if (pin == sensor->get_pin()) {
|
// if (pin == sensor->get_pin()) {
|
||||||
// sensor->publish_state(value);
|
// sensor->publish_state(value);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// ESP_LOGD(TAG, "Updated all");
|
// ESP_LOGD(TAG, "Updated all");
|
||||||
// this->send_switch_info();
|
// this->send_switch_info();
|
||||||
// }
|
// }
|
||||||
// #endif
|
// #endif
|
||||||
break;
|
break;
|
||||||
case PROGRAM_CONF:
|
case PROGRAM_CONF:
|
||||||
ESP_LOGD(TAG, "GOT PROGRAM_CONF");
|
ESP_LOGD(TAG, "GOT PROGRAM_CONF");
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "esphome/core/component.h"
|
#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
|
#ifdef USE_SENSOR
|
||||||
#include "esphome/components/sensor/sensor.h"
|
#include "esphome/components/sensor/sensor.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,11 +14,6 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "esphome/core/helpers.h"
|
|
||||||
#include "esphome/components/uart/uart.h"
|
|
||||||
#include "esphome/core/log.h"
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace ebyte_lora {
|
namespace ebyte_lora {
|
||||||
|
@ -51,14 +50,13 @@ class EbyteLoraComponent : public PollingComponent, public uart::UARTDevice {
|
||||||
void loop() override;
|
void loop() override;
|
||||||
void dump_config() override;
|
void dump_config() override;
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_SENSOR
|
#ifdef USE_SENSOR
|
||||||
void add_sensor(const char *id, sensor::Sensor *sensor) {
|
void add_sensor(const char *id, sensor::Sensor *sensor) {
|
||||||
Sensor st{sensor, id, true};
|
Sensor st{sensor, id, true};
|
||||||
this->sensors_.push_back(st);
|
this->sensors_.push_back(st);
|
||||||
}
|
}
|
||||||
void add_remote_sensor(const char *hostname, const char *remote_id, sensor::Sensor *sensor) {
|
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;
|
this->remote_sensors_[hostname][remote_id] = sensor;
|
||||||
}
|
}
|
||||||
#endif
|
#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) {
|
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;
|
this->remote_binary_sensors_[hostname][remote_id] = sensor;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue