mirror of
https://github.com/esphome/esphome.git
synced 2024-12-28 08:21:44 +01:00
And this
This commit is contained in:
parent
4c4ff0cfb9
commit
c2683f24dd
1 changed files with 24 additions and 19 deletions
|
@ -152,27 +152,32 @@ void EbyteLoraComponent::loop() {
|
||||||
ESP_LOGD(TAG, "GOT INFO ", data.size());
|
ESP_LOGD(TAG, "GOT INFO ", data.size());
|
||||||
uint8_t i = 1;
|
uint8_t i = 1;
|
||||||
while (i < data.size()) {
|
while (i < data.size()) {
|
||||||
ESP_LOGD(TAG, "PIN: %u ", data[i]);
|
for (auto *sensor : this->sensors_) {
|
||||||
ESP_LOGD(TAG, "VALUE: %u ", data[i + 1]);
|
if (sensor->get_pin() == data[i]) {
|
||||||
i = +2;
|
sensor->publish_state(data[i + 1]);
|
||||||
}
|
}
|
||||||
}
|
ESP_LOGD(TAG, "PIN: %u ", data[i]);
|
||||||
if (data.size() == 4) {
|
ESP_LOGD(TAG, "VALUE: %u ", data[i + 1]);
|
||||||
ESP_LOGD(TAG, "Total: %u ", data.size());
|
i = +2;
|
||||||
ESP_LOGD(TAG, "Start bit: ", data[0]);
|
|
||||||
ESP_LOGD(TAG, "PIN: %u ", data[1]);
|
|
||||||
ESP_LOGD(TAG, "VALUE: %u ", data[2]);
|
|
||||||
ESP_LOGD(TAG, "RSSI: %u % ", (data[3] / 255.0) * 100);
|
|
||||||
if (this->rssi_sensor_ != nullptr)
|
|
||||||
this->rssi_sensor_->publish_state((data[3] / 255.0) * 100);
|
|
||||||
|
|
||||||
for (auto *sensor : this->sensors_) {
|
|
||||||
if (sensor->get_pin() == data[1]) {
|
|
||||||
ESP_LOGD(TAG, "Updating switch");
|
|
||||||
sensor->got_state_message(data[2]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
send_switch_info_();
|
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]);
|
||||||
|
ESP_LOGD(TAG, "VALUE: %u ", data[2]);
|
||||||
|
ESP_LOGD(TAG, "RSSI: %u % ", (data[3] / 255.0) * 100);
|
||||||
|
if (this->rssi_sensor_ != nullptr)
|
||||||
|
this->rssi_sensor_->publish_state((data[3] / 255.0) * 100);
|
||||||
|
|
||||||
|
for (auto *sensor : this->sensors_) {
|
||||||
|
if (sensor->get_pin() == data[1]) {
|
||||||
|
ESP_LOGD(TAG, "Updating switch");
|
||||||
|
sensor->got_state_message(data[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
send_switch_info_();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void EbyteLoraComponent::send_switch_info_() {
|
void EbyteLoraComponent::send_switch_info_() {
|
||||||
|
|
Loading…
Reference in a new issue