Skip to content
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 results in Error #854

Open
some-guy-23 opened this issue Feb 3, 2025 · 8 comments
Open

Sync Time results in Error #854

some-guy-23 opened this issue Feb 3, 2025 · 8 comments

Comments

@some-guy-23
Copy link

Description

Not sure when this started, but at some point the "Sync Time" button started to give an error for me (I have an automation setup to press it each minute).

Oddly this is only happening for my C120 cameras. I have a single C101 and it is still able to Sync Time for whatever reason. I've tried the usual rebooting cameras, rebooting HA, updating integration to latest 6.09 version.

HA Versions -

Core
2024.12.5
Supervisor
2024.12.3
Operating System
14.0

Happy to provide more logs / info if I can!

Reproduction Steps

  1. Go to Camera Device
  2. Press "Sync Time" button

Expected behavior

Date & Time on Camera is synced

If applicable, add error logs.

File "/config/custom_components/tapo_control/init.py", line 485, in async_update_data
await syncTime(hass, entry.entry_id)
File "/config/custom_components/tapo_control/utils.py", line 1512, in syncTime
await device_mgmt.SetSystemDateAndTime(time_params)
File "/usr/local/lib/python3.13/site-packages/zeep/proxy.py", line 64, in call
return await self._proxy._binding.send_async(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<5 lines>...
)
^
File "/usr/local/lib/python3.13/site-packages/zeep/wsdl/bindings/soap.py", line 164, in send_async
return self.process_reply(client, operation_obj, response)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/zeep/wsdl/bindings/soap.py", line 229, in process_reply
return self.process_error(doc, operation)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/zeep/wsdl/bindings/soap.py", line 391, in process_error
raise Fault(
...<5 lines>...
)
zeep.exceptions.Fault: error time

Device Firmware

1.2.3 Build 241119 Rel. 41818n

Integration Version

6.0.9

Using stream component

Yes

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

HAOS

Search for similar issues

Yes

Additional information

No response

@JurajNyiri
Copy link
Owner

Please provide full error logs.

@some-guy-23
Copy link
Author

Sorry for ignorance, but can you steer me towards the right place to retrieve them? The above logs are the output of going to Tapo Integration -> Enable debug logging, then letting the error occur. Is there a better place to get the full error log?

@JurajNyiri
Copy link
Owner

@some-guy-23
Copy link
Author

Thanks, I had to enable debug logging for the ONVIF integration, as that's where the bad request seems to be getting sent from. I assume that means it it outside the scope of this project?

In case it isn't, here is the SOAP request body being sent -

<soap-env:Body>
    <ns0:SetSystemDateAndTime xmlns:ns0="http://www.onvif.org/ver10/device/wsdl">
        <ns0:DateTimeType>Manual</ns0:DateTimeType>
        <ns0:DaylightSavings>true</ns0:DaylightSavings>
        <ns0:UTCDateTime>
            <ns1:Time xmlns:ns1="http://www.onvif.org/ver10/schema">
                <ns1:Hour>20</ns1:Hour>
                <ns1:Minute>50</ns1:Minute>
                <ns1:Second>0</ns1:Second>
            </ns1:Time>
            <ns2:Date xmlns:ns2="http://www.onvif.org/ver10/schema">
                <ns2:Year>2025</ns2:Year>
                <ns2:Month>2</ns2:Month>
                <ns2:Day>3</ns2:Day>
            </ns2:Date>
        </ns0:UTCDateTime>
    </ns0:SetSystemDateAndTime>
</soap-env:Body>

Which returns a 400 Status Code, with following response body -

<SOAP-ENV:Body>
    <SOAP-ENV:Fault>
        <SOAP-ENV:Code>
            <SOAP-ENV:Value>SOAP-ENV:Sender</SOAP-ENV:Value>
            <SOAP-ENV:Subcode>
                <SOAP-ENV:Value>ter:InvalidArgVal</SOAP-ENV:Value>
                <SOAP-ENV:Subcode>
                    <SOAP-ENV:Value>ter:InvalidDateTime</SOAP-ENV:Value>
                </SOAP-ENV:Subcode>
            </SOAP-ENV:Subcode>
        </SOAP-ENV:Code>
        <SOAP-ENV:Reason>
            <SOAP-ENV:Text xml:lang="en">error time</SOAP-ENV:Text>
        </SOAP-ENV:Reason>
    </SOAP-ENV:Fault>
</SOAP-ENV:Body>

@JurajNyiri
Copy link
Owner

Not necessarily, it seems that they changed what Camera accepts via Onvif, possibly in the new firmware you have in your camera. I do not have this firmware yet so I cannot check.

But what you can do is check https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/blob/main/custom_components/tapo_control/utils.py#L1495
The spec is available here https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl

See if you can play around with the payload there to get it to save something (change the utils.py file in your filesystem, restart HA, try pushing the button). Otherwise it might be possible they no longer support this or broke it recently by accident. If that is the case, we will need to open a support ticket to TPLink.

@some-guy-23
Copy link
Author

Well the strange thing is I only got the cameras last month (January) and the Sync Time worked at that point. They are blocked from internet access, so I don't believe firmware has been updated. I also haven't updated Home Assistant (and only updated this add-on after I noticed the problem). So I'm pretty lost as to what changed. tinkering SOAP payload doesn't seem to result in any different response.

I noticed using the 'GetNTP' endpoint that they are set to use NTP server provided by DHCP. So I went down the rabbit hole of trying to run local NTP server, but no matter if I set that local server under DHCP settings on router, the cameras still just return '0.0.0.0' -

<tds:NTPInformation>
    <tt:FromDHCP>true</tt:FromDHCP>
    <tt:NTPFromDHCP>
        <tt:Type>IPv4</tt:Type>
        <tt:IPv4Address>0.0.0.0</tt:IPv4Address>
    </tt:NTPFromDHCP>
</tds:NTPInformation>

I know that's probably unrelated, but just thought it was strange... and kind of goes back to the issue of why I need the manual sync-time job, having them blocked from internet and unable to set local NTP server.

@fcastilloec
Copy link

fcastilloec commented Feb 4, 2025

I have the same problem, but the error started showing right after I upgraded the integration to v6.0.10. I have two C120 with the same firmware as mentioned here. The cameras are working well, and the sensors are populated. I haven't tried all features but seems ok so far.
The error is shown as soon as I restarted after upgrading, it showed 27 errors, and by the time I came to look for the error in this repo, it's climbed to 79, and it's still going. I didn't have to interact with the camera at all, or press the "Sync Time" button. (maybe the title of this issue should be changed to reflect the type of error thrown rather than make it about sync time button)
I've had these cameras for months, but after the big fix from Tapo, I've enabled internet access and allowed automatic firmware upgrade, so I don't know if a new firmware was installed recently, or if it's this integration's fault. I suspect is the firmware.

Device Firmware: 1.2.3 Build 241119 Rel.41818n
Integration Version: 6.0.10
HASS Environment: Supervised
Core: 2025.1.4
Supervisor: 2024.12.3

EDIT: Forgot to mention that I have homeassistant.components.onvif: debug for my logs, but I don't see anything there, only the zeep.exceptions.Fault: error time

@JurajNyiri
Copy link
Owner

Last integration update changed only config flow, which is not related to this at all by any chance - it is not executed unless reconfiguring the camera.

@some-guy-23 some-guy-23 changed the title Sync Time button returning error Sync Time results in Error Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants