|
| 1 | +--- |
| 2 | +description: "RX8130 Time Source" |
| 3 | +title: "RX8130 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: rx8130 |
| 12 | + id: rx8130_time |
| 13 | +``` |
| 14 | +
|
| 15 | +## Configuration variables |
| 16 | +
|
| 17 | +- **address** (*Optional*, int): Manually specify the I²C address of the RTC. Defaults to `0x32`. |
| 18 | +- All other options from [Base Time Configuration](#base_time_config). |
| 19 | + |
| 20 | +{{< anchor "rx8130-write_time_action" >}} |
| 21 | + |
| 22 | +## `rx8130.write_time` Action |
| 23 | + |
| 24 | +This [Action](#config-action) triggers a synchronization of the current system time to the RTC hardware. |
| 25 | + |
| 26 | +{{< note >}} |
| 27 | +The RX8130 component will *not* write to the RTC clock if not triggered *explicitly* by this action. |
| 28 | + |
| 29 | +{{< /note >}} |
| 30 | + |
| 31 | +```yaml |
| 32 | +on_...: |
| 33 | + - rx8130.write_time |
| 34 | +
|
| 35 | + # in case you need to specify the RX8130 id |
| 36 | + - rx8130.write_time: |
| 37 | + id: rx8130_time |
| 38 | +``` |
| 39 | + |
| 40 | +{{< anchor "rx8130-read_time_action" >}} |
| 41 | + |
| 42 | +## `rx8130.read_time` Action |
| 43 | + |
| 44 | +This [Action](#config-action) triggers a synchronization of the current system time from the RTC hardware. |
| 45 | + |
| 46 | +{{< note >}} |
| 47 | +The RX8130 component will automatically read the RTC clock every 15 minutes by default and synchronize the |
| 48 | +system clock when a valid timestamp is read from the RTC. (The `update_interval` can be changed.) |
| 49 | +This action can be used to trigger *additional* synchronizations. |
| 50 | + |
| 51 | +{{< /note >}} |
| 52 | + |
| 53 | +```yaml |
| 54 | +on_...: |
| 55 | + - rx8130.read_time |
| 56 | +
|
| 57 | + # in case you need to specify the RX8130 id |
| 58 | + - rx8130.read_time: |
| 59 | + id: rx8130_time |
| 60 | +``` |
| 61 | + |
| 62 | +{{< anchor "rx8130-config_example" >}} |
| 63 | + |
| 64 | +## Full Configuration Example |
| 65 | + |
| 66 | +In a typical setup, you will have at least one additional time source to synchronize the RTC with. Such an |
| 67 | +external time source might not always be available e.g. due to a limited network connection. |
| 68 | +In order to have a valid, reliable system time, the system should read the RTC once at start and then try to |
| 69 | +synchronize with an external reliable time source. |
| 70 | +When a synchronization to another time source was successful, the RTC can be resynchronized. |
| 71 | + |
| 72 | +```yaml |
| 73 | +esphome: |
| 74 | + on_boot: |
| 75 | + then: |
| 76 | + # read the RTC time once when the system boots |
| 77 | + rx8130.read_time: |
| 78 | +
|
| 79 | +time: |
| 80 | + - platform: rx8130 |
| 81 | + # repeated synchronization is not necessary unless the external RTC |
| 82 | + # is much more accurate than the internal clock |
| 83 | + update_interval: never |
| 84 | + - platform: homeassistant |
| 85 | + # instead try to synchronize via network repeatedly ... |
| 86 | + on_time_sync: |
| 87 | + then: |
| 88 | + # ... and update the RTC when the synchronization was successful |
| 89 | + rx8130.write_time: |
| 90 | +``` |
| 91 | + |
| 92 | +## See Also |
0 commit comments