You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Receives UTC time (and optional timezone / DST offsets) from a Matter controller via the Time Synchronization cluster on the root endpoint (not a bridged appliance). Currently enabled for Arduino Nano Matter.
488
+
489
+
The device does not pull time by itself. A Matter controller that supports time sync must push `SetUTCTime` (and, when the TimeZone feature is advertised, `SetTimeZone` / `SetDSTOffset`). Use `request_time()` to emit a `TimeFailure` event so a supporting controller can push time again.
490
+
491
+
### Enabling time sync in Home Assistant
492
+
493
+
Requires Matter Server **1.2.0+** (Home Assistant Matter Server app **9.1.0+**).
494
+
495
+
#### Home Assistant OS / Supervised (Matter Server add-on)
496
+
497
+
1. Open **Settings → Add-ons → Matter Server → Configuration**.
498
+
2. Set **`time_sync`** to one of:
499
+
-`auto` (default) — enable only when the host clock is NTP synchronized
500
+
-`on` — always enable (use this if sync never starts under `auto`)
501
+
-`off` — disable time sync
502
+
3. Ensure Home Assistant’s timezone is set correctly under **Settings → System → General** (the add-on uses the host timezone for `SetTimeZone` / DST).
Time sync is **off by default** in the container image. Enable it with environment variables:
508
+
509
+
```yaml
510
+
services:
511
+
matterjs-server:
512
+
image: ghcr.io/matter-js/matterjs-server:stable
513
+
network_mode: host
514
+
restart: unless-stopped
515
+
volumes:
516
+
- "${HOME}/.matterjs-server:/data"
517
+
environment:
518
+
ENABLE_TIME_SYNC: "true"
519
+
TZ: "Europe/Budapest"# IANA zone; required for correct local offsets
520
+
```
521
+
522
+
Or with `docker run`:
523
+
524
+
```bash
525
+
docker run -d \
526
+
--name matterjs-server \
527
+
--restart=unless-stopped \
528
+
--network=host \
529
+
-v ${HOME}/.matterjs-server:/data \
530
+
-e ENABLE_TIME_SYNC=true \
531
+
-e TZ=Europe/Budapest \
532
+
ghcr.io/matter-js/matterjs-server:stable
533
+
```
534
+
535
+
After changing `TZ` / `ENABLE_TIME_SYNC`, recreate the container so the environment is applied (`docker compose up -d --force-recreate`). Verify inside the container:
`TZ`must be non-empty and resolve to your IANA zone (not `UTC`), or timezone/DST offsets pushed to the device will be zero.
542
+
543
+
#### Notes
544
+
545
+
- After a device reflash/reboot, some Matter Server versions may skip re-sync for up to 24 hours (cooldown). Restarting the Matter Server clears that state. See [matter-js/matterjs-server#938](https://github.com/matter-js/matterjs-server/issues/938).
546
+
- In Matter Server logs, a successful push looks like `timeSynchronization.setUtcTime` (and `setTimeZone` / `setDstOffset` when timezone is supported) with `status: Success`.
547
+
548
+
```bool request_time();```
549
+
Emits a `TimeFailure` event on the root endpoint so a supporting controller can push time again. Rate-limited to once per 60 seconds. Returns `false` if skipped by the rate limit or if logging fails. Controllers may still ignore the event during their own cooldown windows.
550
+
551
+
```bool has_time();```
552
+
Returns whether a valid wall-clock time is available.
553
+
554
+
```uint32_t get_unix_time();```
555
+
Returns seconds since 1970-01-01 UTC, or 0 if time is not available.
556
+
557
+
```uint64_t get_unix_time_millis();```
558
+
Returns milliseconds since 1970-01-01 UTC, or 0 if time is not available.
559
+
560
+
```bool has_timezone();```
561
+
Returns whether the controller has set a timezone via `SetTimeZone`.
562
+
563
+
```int32_t get_timezone_offset_seconds();```
564
+
Returns the active timezone base offset in seconds east of UTC (excluding DST), or 0 if unavailable.
565
+
566
+
```int32_t get_dst_offset_seconds();```
567
+
Returns the currently applicable DST offset in seconds, or 0 if unavailable / not in DST.
568
+
569
+
```int32_t get_local_offset_seconds();```
570
+
Returns timezone + DST offset in seconds east of UTC.
571
+
572
+
```uint32_t get_local_unix_time();```
573
+
Returns local Unix time in seconds (UTC + offsets). If timezone is not set yet, returns UTC.
574
+
575
+
```uint64_t get_local_unix_time_millis();```
576
+
Returns local Unix time in milliseconds (UTC + offsets). If timezone is not set yet, returns UTC.
0 commit comments