Also fake status pin

This commit is contained in:
Piotr Szulc 2024-07-01 21:16:57 +02:00
parent da3abf07c3
commit 2a69352c56
2 changed files with 2 additions and 6 deletions

View file

@ -2,7 +2,6 @@
#include "esphome/core/gpio.h" #include "esphome/core/gpio.h"
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include "esphome/core/util.h"
namespace esphome { namespace esphome {
namespace tuya { namespace tuya {
@ -484,15 +483,14 @@ void Tuya::send_empty_command_(TuyaCommandType command) {
} }
void Tuya::set_status_pin_() { void Tuya::set_status_pin_() {
bool is_network_ready = network::is_connected() && remote_is_connected(); this->status_pin_->digital_write(true);
this->status_pin_->digital_write(is_network_ready);
} }
uint8_t Tuya::get_wifi_status_code_() { uint8_t Tuya::get_wifi_status_code_() {
uint8_t status = NET_STATUS_WIFI_CONNECTED; uint8_t status = NET_STATUS_WIFI_CONNECTED;
// Protocol version 3 also supports specifying when connected to "the cloud" // Protocol version 3 also supports specifying when connected to "the cloud"
if (this->protocol_version_ >= 0x03 && remote_is_connected()) { if (this->protocol_version_ >= 0x03) {
status = NET_STATUS_CLOUD_CONNECTED; status = NET_STATUS_CLOUD_CONNECTED;
} }

View file

@ -32,6 +32,4 @@ bool mqtt_is_connected() {
return false; return false;
} }
bool remote_is_connected() { return api_is_connected() || mqtt_is_connected(); }
} // namespace esphome } // namespace esphome