-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sync time sets the time one hour ahead #307
Comments
i run into the same problem on C320WS.
In HA everything looks correct, i can't see the wrong cam time in the frontend, only in the cam diagnostics. |
Is this still an issue? |
I'm having the same issue with my C225 camera. Syncing through the tapo app results in the correct time, but syncing through home assistant results in an 1 hour offset where the camera is 1 hour ahead |
@JurajNyiri Yes, the issue is still there. I tried to play with it a little and I don't seem to be able to set correct time on my camera using built-in time-sync option: Current time: 22:00 Application TZ: Europe/Brussels (or any other UTC+01:00 TZ) Application TZ: UTC Application TZ: UTC (or any other UTC-00:00 TZ) Camera: Tapo C220 |
Tapo C320WS has the same issue. When it is connected to Home Assistant, the time is 1h ahead of the actual time Change timezone in Tapo Application to: Europe/Amsterdam (or any other UTC+01:00 TZ) Maybe an issue with daylight saving time? Camera: Tapo C320WS |
Came here to report a similar issue, but my Tapo C210 gets set 1 hour behind rather then ahead: Tapo C210, Internet access blocked due to current issues on newest firmware documented here: Home Assistant Time (correct): TapoCam after clicking "Sync Time" (1 hour behind): Any help would be much appreciated! Thanks so much for your continued hard work on this brilliant integration |
@JurajNyiri I can also confirm this is still an issue. It is caused by this line:
Clearly that DST logic is wrong. If I remove Could you please fix it? |
@xmikos thanks for pointing me in the right direction: I had to edit it differently than you for it to work for me: It looks like the logic has an issue in this area of the code? With the above edit to HomeAssistant-Tapo-Control/custom_components/tapo_control/utils.py the time now syncs correctly from home assistant to tapo cams. |
@JurajNyiri Thanks so much for your work on this integration. |
I hope I will get to it soon, but I've been very busy in work lately so I have very little time left. For now I would suggest changing the hour in the source code by adding an hour, or substracting it. Any PRs are welcomed as well, but we need to make sure it works well for all the timezones (and time savings) as there was a similar ticket in the past where it was one hour less. |
Just a quick note that the recent addition of a Note that in my C320WS, after upgrading to 5.6.3, sync initially did not work although the timezone in |
I have three C320WS cameras all with same firmware: Two of them shows the wrong time (one hour ahead) and one of them the correct one. Unfortunately the timezone select doesn't help fixing the timezone. I followed the suggestion from above by changing the timezone back and forth without luck. |
To move this issue forwards please post following template, below would be an example.
*** this is just an example and not an exact data set, it should be ignored from evaluation as my setup actually does not support time sync at all due to https. |
Dwo days ago summer time has ended, and that problem seems to be related to DST. |
@JurajNyiri as requested:
|
Thank you @CaptInsano that was helpful. Here is what I tried.
This was the request to camera:
I checked the time, and it is set correctly - it was 12:05.36 in Dublin. I tried playing with DaylightSavings setting it to True, or False and it has no effect on my camera. This is very strange. As a next step, please download https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/tree/time_sync_debug manually. You should see a bunch of warning logs like this.
Please post them here. |
I have added additional properties to Please post those as well on the latest code at https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/tree/time_sync_debug (install manually). |
Description
When enabling automatic time sync or tapping the sync time button, the time on the camera is set to one hour ahead. This is most likely caused by "Hour": now.hour if time.localtime().tm_isdst == 0 else now.hour + 1. When looking around the calls, I've noticed that the camera already has DST parameters.
Calling:
{"method":"multipleRequest","params":{"requests":[{"method":"getClockStatus","params":{"system":{"name":"clock_status"}}},{"method":"getDstRule","params":{"system":{"name":"dst"}}},{"method":"getTimezone","params":{"system":{"name":["basic"]}}}]}}
Returns:
{'result': {'responses': [{'method': 'getClockStatus', 'result': {'system': {'clock_status': {'seconds_from_1970': 1682072995, 'local_time': '2023-04-21 13:29:55'}}}, 'error_code': 0}, {'method': 'getDstRule', 'result': {'system': {'dst': {'enabled': '1', 'synced': '1', 'has_rule': '1', 'dst_rule': 'DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00'}}}, 'error_code': 0}, {'method': 'getTimezone', 'result': {'system': {'basic': {'timing_mode': 'ntp', 'zone_id': 'Europe/Athens', 'timezone': 'UTC+02:00'}}}, 'error_code': 0}]}, 'error_code': 0}
Reproduction Steps
Tap Sync Time button
Expected behavior
Sync to the current time
If applicable, add error logs.
No response
Device Firmware
C225 v1 1.0.17 Build 230222 Rel.34031n
Using stream component
Yes
Does camera work via official integrations?
Yes
Camera has all attributes filled out in developer tools
Yes
HASS Environment
Docker
Search for similar issues
Yes
Additional information
The one hour adjustment may still be needed on some cameras, but on c225 it seems to introduce an extra hour.
The text was updated successfully, but these errors were encountered: