[tuya] add support for extended services (#6808)

This commit is contained in:
august huber 2024-05-26 15:40:38 -04:00 committed by GitHub
parent 4125b48b86
commit 17c6bf57cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 31 additions and 0 deletions

View file

@ -269,6 +269,30 @@ void Tuya::handle_command_(uint8_t command, uint8_t version, const uint8_t *buff
ESP_LOGV(TAG, "Network status requested, reported as %i", wifi_status); ESP_LOGV(TAG, "Network status requested, reported as %i", wifi_status);
break; break;
} }
case TuyaCommandType::EXTENDED_SERVICES: {
uint8_t subcommand = buffer[0];
switch ((TuyaExtendedServicesCommandType) subcommand) {
case TuyaExtendedServicesCommandType::RESET_NOTIFICATION: {
this->send_command_(
TuyaCommand{.cmd = TuyaCommandType::EXTENDED_SERVICES,
.payload = std::vector<uint8_t>{
static_cast<uint8_t>(TuyaExtendedServicesCommandType::RESET_NOTIFICATION), 0x00}});
ESP_LOGV(TAG, "Reset status notification enabled");
break;
}
case TuyaExtendedServicesCommandType::MODULE_RESET: {
ESP_LOGE(TAG, "EXTENDED_SERVICES::MODULE_RESET is not handled");
break;
}
case TuyaExtendedServicesCommandType::UPDATE_IN_PROGRESS: {
ESP_LOGE(TAG, "EXTENDED_SERVICES::UPDATE_IN_PROGRESS is not handled");
break;
}
default:
ESP_LOGE(TAG, "Invalid extended services subcommand (0x%02X) received", subcommand);
}
break;
}
default: default:
ESP_LOGE(TAG, "Invalid command (0x%02X) received", command); ESP_LOGE(TAG, "Invalid command (0x%02X) received", command);
} }

View file

@ -60,6 +60,13 @@ enum class TuyaCommandType : uint8_t {
WIFI_RSSI = 0x24, WIFI_RSSI = 0x24,
VACUUM_MAP_UPLOAD = 0x28, VACUUM_MAP_UPLOAD = 0x28,
GET_NETWORK_STATUS = 0x2B, GET_NETWORK_STATUS = 0x2B,
EXTENDED_SERVICES = 0x34,
};
enum class TuyaExtendedServicesCommandType : uint8_t {
RESET_NOTIFICATION = 0x04,
MODULE_RESET = 0x05,
UPDATE_IN_PROGRESS = 0x0A,
}; };
enum class TuyaInitState : uint8_t { enum class TuyaInitState : uint8_t {