Skip to content

Commit

Permalink
Fix: Time synchronisation for daylight saving
Browse files Browse the repository at this point in the history
  • Loading branch information
JurajNyiri committed May 6, 2021
1 parent 06455fb commit fe14ff7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion custom_components/tapo_control/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"documentation": "https://github.com/JurajNyiri/HomeAssistant-Tapo-Control",
"issue_tracker": "https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues",
"codeowners": ["@JurajNyiri"],
"version": "3.3",
"version": "3.3.2",
"requirements": [
"pytapo==1.2.1",
"onvif-zeep-async==1.0.0",
Expand Down
7 changes: 6 additions & 1 deletion custom_components/tapo_control/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import urllib.parse
import socket
import datetime
import time
from onvif import ONVIFCamera
from pytapo import Tapo
from .const import (
Expand Down Expand Up @@ -197,7 +198,11 @@ async def syncTime(hass, entry):
time_params.DaylightSavings = True
time_params.UTCDateTime = {
"Date": {"Year": now.year, "Month": now.month, "Day": now.day},
"Time": {"Hour": now.hour, "Minute": now.minute, "Second": now.second},
"Time": {
"Hour": now.hour if time.localtime().tm_isdst == "0" else now.hour + 1,
"Minute": now.minute,
"Second": now.second,
},
}
await device_mgmt.SetSystemDateAndTime(time_params)
hass.data[DOMAIN][entry.entry_id][
Expand Down

0 comments on commit fe14ff7

Please sign in to comment.