mirror of
https://github.com/esphome/esphome.git
synced 2024-12-01 03:04:12 +01:00
Update ebyte_lora.cpp
This commit is contained in:
parent
c2683f24dd
commit
5f9d702287
1 changed files with 15 additions and 17 deletions
|
@ -147,21 +147,6 @@ void EbyteLoraComponent::loop() {
|
|||
}
|
||||
if (data[0] == SWITCH_PUSH) {
|
||||
ESP_LOGD(TAG, "GOT SWITCH PUSH ", data.size());
|
||||
}
|
||||
if (data[0] == SWITCH_INFO) {
|
||||
ESP_LOGD(TAG, "GOT INFO ", data.size());
|
||||
uint8_t i = 1;
|
||||
while (i < data.size()) {
|
||||
for (auto *sensor : this->sensors_) {
|
||||
if (sensor->get_pin() == data[i]) {
|
||||
sensor->publish_state(data[i + 1]);
|
||||
}
|
||||
ESP_LOGD(TAG, "PIN: %u ", data[i]);
|
||||
ESP_LOGD(TAG, "VALUE: %u ", data[i + 1]);
|
||||
i = +2;
|
||||
}
|
||||
}
|
||||
if (data.size() == 4) {
|
||||
ESP_LOGD(TAG, "Total: %u ", data.size());
|
||||
ESP_LOGD(TAG, "Start bit: ", data[0]);
|
||||
ESP_LOGD(TAG, "PIN: %u ", data[1]);
|
||||
|
@ -178,6 +163,19 @@ void EbyteLoraComponent::loop() {
|
|||
}
|
||||
send_switch_info_();
|
||||
}
|
||||
if (data[0] == SWITCH_INFO) {
|
||||
ESP_LOGD(TAG, "GOT INFO ", data.size());
|
||||
uint8_t i = 1;
|
||||
while (i < data.size()) {
|
||||
for (auto *sensor : this->sensors_) {
|
||||
if (sensor->get_pin() == data[i]) {
|
||||
sensor->publish_state(data[i + 1]);
|
||||
}
|
||||
ESP_LOGD(TAG, "PIN: %u ", data[i]);
|
||||
ESP_LOGD(TAG, "VALUE: %u ", data[i + 1]);
|
||||
i = +2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void EbyteLoraComponent::send_switch_info_() {
|
||||
|
|
Loading…
Reference in a new issue