From 031b04fb536c5f7dbb5985d401411b0eedf1e2f7 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 16 Jul 2020 17:28:47 +0200 Subject: [PATCH] Add check for valid time --- tasmota/xdrv_16_tuyamcu.ino | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tasmota/xdrv_16_tuyamcu.ino b/tasmota/xdrv_16_tuyamcu.ino index 982a5c796..82bc4ef7f 100644 --- a/tasmota/xdrv_16_tuyamcu.ino +++ b/tasmota/xdrv_16_tuyamcu.ino @@ -802,8 +802,9 @@ void TuyaSetWifiLed(void) } #ifdef USE_TUYA_TIME -void TuyaSetTime(void) -{ +void TuyaSetTime(void) { + if (!RtcTime.valid) { return; } + uint16_t payload_len = 8; uint8_t payload_buffer[8]; payload_buffer[0] = 0x01; @@ -878,13 +879,13 @@ bool Xdrv16(uint8_t function) Tuya.heartbeat_timer = 0; TuyaSendCmd(TUYA_CMD_HEARTBEAT); } - #ifdef USE_TUYA_TIME +#ifdef USE_TUYA_TIME if (!(uptime % 60)) { TuyaSetTime(); } - #endif //USE_TUYA_TIME +#endif //USE_TUYA_TIME } else { - TuyaSendLowPowerSuccessIfNeeded(); + TuyaSendLowPowerSuccessIfNeeded(); } break; case FUNC_SET_CHANNELS: