pvvx / ATC_MiThermometer

Custom firmware for the Xiaomi Thermometers and Telink Flasher
https://github.com/pvvx/pvvx.github.io/tree/master/ATC_MiThermometer
Other
2.88k stars 200 forks source link

Daylight saving time #261

Open tomaszduda23 opened 1 year ago

tomaszduda23 commented 1 year ago

It would be nice if clock adjust automatically for https://en.wikipedia.org/wiki/Daylight_saving_time_by_country

pvvx commented 1 year ago

The thermometer does not have such resources and Internet access.

tomaszduda23 commented 1 year ago

It can be done offline.

https://github.com/nayarsystems/posix_tz_db/blob/master/zones.csv https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html

As alternative I use esp32 which updates time once a day.

bvermes17 commented 1 year ago

@tomaszduda23 Could you share the script or config for the ESP that upgrades the time on the device once a day? I am currently trying to do the same, but did not find a solution yet.

Thanks!

tomaszduda23 commented 1 year ago
esp32_ble:
  io_capability: keyboard_only

esp32_ble_tracker:
  scan_parameters:
    interval: 1100ms
    window: 1100ms
    active: true

bluetooth_proxy:

external_components:
  - source: github://pr#4258
    components: [ble_client, esp32_ble, esp32_ble_client, esp32_ble_tracker]
    refresh: always

ble_client:
- mac_address: "XX:XX:XX:XX:XX:XX" # <- mac address
  id: pvvx_ble_display
  on_passkey_request:
    then:
      - logger.log: "Authenticating with passkey"
      - ble_client.passkey_reply:
          id: pvvx_ble_display
          passkey: xxxxx #<- paring key if you have one

display:
- platform: pvvx_mithermometer
  ble_client_id: pvvx_ble_display
  update_interval: 24h
  validity_period: 0s
  disconnect_delay: 30s
  time_id: homeassistant_time
Ircama commented 1 year ago

It can be done offline.

You might also check "Setting the device date to the host system's date":

atc_mi_config -m A4:C1:38:AA:BB:CC -D
tomaszduda23 commented 2 months ago

just for reference https://github.com/josmithua/utz it seems that 3KB is needed for timezone db