|
| 1 | +--- |
| 2 | +description: "BM8563 Time Source" |
| 3 | +title: "BM8563 Time Source" |
| 4 | +--- |
| 5 | + |
| 6 | +You first need to set up the {{< docref "/components/i2c" "I2C" >}} component. |
| 7 | + |
| 8 | +```yaml |
| 9 | +# Example configuration entry |
| 10 | +time: |
| 11 | + - platform: bm8563 |
| 12 | + id: bm8563_time |
| 13 | +``` |
| 14 | +
|
| 15 | +## Configuration variables |
| 16 | +
|
| 17 | +- **address** (*Optional*, int): Manually specify the I²C address of the RTC. Defaults to `0x51`. |
| 18 | +- **sleep_duration** (*Optional*, [Time](#config-time)): Configure a deep sleep duration for devices that support it. |
| 19 | +- All other options from [Base Time Configuration](#base_time_config). |
| 20 | + |
| 21 | +{{< anchor "bm8563-write_time_action" >}} |
| 22 | + |
| 23 | +## `bm8563.write_time` Action |
| 24 | + |
| 25 | +This [Action](#config-action) triggers a synchronization of the current system time to the RTC hardware. |
| 26 | + |
| 27 | +> [!NOTE] |
| 28 | +> The BM8563 component will *not* write the RTC clock if not triggered *explicitly* by this action. |
| 29 | + |
| 30 | +```yaml |
| 31 | +on_...: |
| 32 | + - bm8563.write_time |
| 33 | +
|
| 34 | + # in case you need to specify the BM8563 id |
| 35 | + - bm8563.write_time: |
| 36 | + id: bm8563_time |
| 37 | +``` |
| 38 | + |
| 39 | +{{< anchor "bm8563-read_time_action" >}} |
| 40 | + |
| 41 | +## `bm8563.read_time` Action |
| 42 | + |
| 43 | +This [Action](#config-action) triggers a synchronization of the current system time from the RTC hardware. |
| 44 | + |
| 45 | +> [!NOTE] |
| 46 | +> The BM8563 component will automatically read the RTC clock every 15 minutes by default and synchronize the |
| 47 | +> system clock when a valid timestamp was read from the RTC. (The `update_interval` can be changed.) |
| 48 | +> This action can be used to trigger *additional* synchronizations. |
| 49 | + |
| 50 | +```yaml |
| 51 | +on_...: |
| 52 | + - bm8563.read_time |
| 53 | +
|
| 54 | + # in case you need to specify the BM8563 id |
| 55 | + - bm8563.read_time: |
| 56 | + id: bm8563_time |
| 57 | +``` |
| 58 | + |
| 59 | +{{< anchor "bm8563-apply_sleep_duration_action" >}} |
| 60 | + |
| 61 | +## `bm8563.apply_sleep_duration` Action |
| 62 | + |
| 63 | +This [Action](#config-action) configures the RTC alarm for deep sleep functionality. |
| 64 | + |
| 65 | +```yaml |
| 66 | +on_...: |
| 67 | + - bm8563.apply_sleep_duration: |
| 68 | + sleep_duration: 60s |
| 69 | +
|
| 70 | + # in case you need to specify the BM8563 id |
| 71 | + - bm8563.apply_sleep_duration: |
| 72 | + id: bm8563_time |
| 73 | + sleep_duration: 60s |
| 74 | +``` |
| 75 | + |
| 76 | +{{< anchor "bm8563-config_example" >}} |
| 77 | + |
| 78 | +## Full Configuration Example |
| 79 | + |
| 80 | +In a typical setup, you will have at least one additional time source to synchronize the RTC with. Such an |
| 81 | +external time source might not always be available e.g. due to a limited network connection. |
| 82 | +In order to have a valid, reliable system time, the system should read the RTC once at start and then try to |
| 83 | +synchronize with an external reliable time source. |
| 84 | +When a synchronization to another time source was successful, the RTC can be resynchronized. |
| 85 | + |
| 86 | +```yaml |
| 87 | +esphome: |
| 88 | + on_boot: |
| 89 | + then: |
| 90 | + # read the RTC time once when the system boots |
| 91 | + bm8563.read_time: |
| 92 | +
|
| 93 | +time: |
| 94 | + - platform: bm8563 |
| 95 | + # repeated synchronization is not necessary unless the external RTC |
| 96 | + # is much more accurate than the internal clock |
| 97 | + update_interval: never |
| 98 | + - platform: homeassistant |
| 99 | + # instead try to synchronize via network repeatedly ... |
| 100 | + on_time_sync: |
| 101 | + then: |
| 102 | + # ... and update the RTC when the synchronization was successful |
| 103 | + bm8563.write_time: |
| 104 | +``` |
| 105 | + |
| 106 | +## See Also |
| 107 | + |
| 108 | +- {{< docref "/components/i2c" "I2C Bus" >}} |
| 109 | +- {{< docref "/components/time" "Time Component" >}} |
| 110 | +- {{< docref "/components/deep_sleep" "Deep Sleep Component" >}} |
0 commit comments