NRF52 Zigbee time component not syncing - Error in Realtimeclock::synchronize_epoch
The problem
If I send a mqtt message to a device such as zigbee2mqtt/device_id/set with the appropriate json payload, I see
[I][zigbee:114][0x20001f48]: zcl_device_cb id 0, cluster_id 10, attr_id 0, endpoint: 1 [I][zigbee.time:064][0x20001f48]: Synchronize time to 1786732950 [D][time:104]: Synchronized time: 1969-12-31 23:59:59
in the device logs which is the correct unix time that I just synchronized via the mqtt message, but not the correct synchronized time. If I check to see if the time in my zigbee time component is valid, it isn't. It is always 1969-12-31 23:59:59 as reported in the log. How do I access the correct synchronized time within my ESPHOME yaml? I am testing the time validity as follows:
- lambda: |-
auto t = id(time_zigbee_1).now();
ESP_LOGI("custom", "Unix Time: %lld", id(time_zigbee_1).now().timestamp);
int my_hour = t.hour;
ESP_LOGD("time", "Current Time: %s", id(time_zigbee_1).now().strftime("%Y-%m-%d %H:%M:%S").c_str());
if (t.is_valid()) {
// t is never valid
}Which version of ESPHome has the issue?
Latest version of ESPHome
What type of installation are you using?
Home Assistant Add-on
What platform are you using?
Other
Component causing the issue
No response
YAML Config
# Board: Seeed XIAO nRF52840
# Definition: definitions/boards/xiao_ble/manifest.yaml
esphome:
name: nrf-light-sensor
friendly_name: nrf light sensor
nrf52:
board: xiao_ble
logger:
level: VERBOSE
zigbee:
id: nrf_lux_1
model: "XIAO-LuxSensor-1"
time:
- platform: zigbee
id: time_zigbee_1
interval:
- interval: 20s
then:
- lambda: |-
auto t = id(time_zigbee_1).now();
ESP_LOGI("custom", "Unix Time: %lld", id(time_zigbee_1).now().timestamp);
int my_hour = t.hour;
ESP_LOGD("time", "Current Time: %s", id(time_zigbee_1).now().strftime("%Y-%m-%d %H:%M:%S").c_str());
if (t.is_valid()) {
int my_hour = t.hour;
// If it is night time (e.g., after 19:00 or before 04:00)
if (t.hour >= 19 || t.hour < 4) {
// Sleep for 120 minutes
} else {
// Sleep for 5 minutes
}
}Anything in the logs that might be useful for us?
[11:41:39][C][zigbee:227]: Zigbee
[11:41:39][C][zigbee:227]: Wipe on boot: NO
[11:41:39][C][zigbee:227]: Device is joined to the network: YES
[11:41:39][C][zigbee:227]: Sleep time: 1s
[11:41:39][C][zigbee:227]: RX ON when idle: YES
[11:41:39][C][zigbee:227]: Current channel: 11
[11:41:39][C][zigbee:227]: Current page: 0
[11:41:39][C][zigbee:227]: Sleep threshold: 20ms
[11:41:39][C][zigbee:227]: Role: end device
[11:41:39][C][zigbee:227]: Long addr: 0xf4ce365d89e48318
[11:41:39][C][zigbee:227]: Short addr: 0x1388
[11:41:39][C][zigbee:227]: Long pan id: 0xa57b2faa8c3b7210
[11:41:39][C][zigbee:227]: Short pan id: 0x0263
[11:41:40][C][zigbee.time:033]: Zigbee Time
[11:41:40][C][zigbee.time:033]: Endpoint: 1
[11:41:40][C][time:055]: Current time: 1969-12-31 23:59:59
[11:42:30][I][zigbee:114][0x20001f48]: zcl_device_cb id 0, cluster_id 10, attr_id 0, endpoint: 1
[11:42:30][I][zigbee.time:064][0x20001f48]: Synchronize time to 1786732950
[11:42:30][D][time:104]: Synchronized time: 1969-12-31 23:59:59
[11:42:30][D][zigbee.time:082][0x20001f48]: Zcl_device_cb_ status: 0Additional information
No response
Source: esphome/esphome