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

Motion Detection ON constantly. #330

Closed
sca075 opened this issue May 4, 2023 · 7 comments · Fixed by #331
Closed

Motion Detection ON constantly. #330

sca075 opened this issue May 4, 2023 · 7 comments · Fixed by #331
Assignees
Labels
Bug Something isn't working

Comments

@sca075
Copy link

sca075 commented May 4, 2023

Description

Since the fix for HA 2023.5 the C100 motion sensor become duplicated and remain always in ON, the TAPO app send the notification of motion detected, but it seams there is no feedback when the motion ended. Would be happy to help to fix this issue but I didn´t get how this part in your code is working..

Reproduction Steps

1.Reload the component
2.Delete the duplicate motion sensor entity.
3. Reload the component
4. Sensor unavailable
5. create motion in the room
6. a new sensor is created and become clear.

Expected behavior

normal detection state as before.

If applicable, add error logs.

No response

Device Firmware

1.1.15

Using stream component

Yes

Does camera work via official integrations?

N/A

Camera has all attributes filled out in developer tools

Yes

HASS Environment

Docker

Search for similar issues

No

Additional information

No response

@JurajNyiri
Copy link
Owner

JurajNyiri commented May 4, 2023

The issue is in upstream onvif (and poor firmware). I am working with @bdraco to fix this.

@JurajNyiri JurajNyiri added the Bug Something isn't working label May 4, 2023
@JurajNyiri JurajNyiri self-assigned this May 4, 2023
@JurajNyiri
Copy link
Owner

JurajNyiri commented May 5, 2023

After investigating this further with great help of @bdraco we found out that:

  • C200 HW 1.0 1.3.6 is broken and times out
  • Webhooks are broken in general, so shall not be used on Tapo cameras. Pullpoints shall only be used.
  • The new onvif introduced in 2023.5.0 which has periodic renewals causes this issue. The reason is, renewals usually fail on Tapo cameras, and they happen every 90 seconds now. If they fail, we stop receiving events and the status gets stuck (until next event is sent once the connection is reestabilished).
  • Thus draft PR was created. It implements retries on renewals which seems to fix it on some cameras (HW 3.0 1.3.4 inconsistent between 2 models, one times out, one works better and C320 works too), while wrecks havoc on different ones with infinite retry loops (1.1.18 C200 HW 1.0).

Solutions

  • One of the solutions could be using old onvif-zeep-sync. We would need to include it in this component. That would leave us stuck at one point and we would not be able to use the latest and greatest onvif improvements in HA. This would mean the Tapo cameras would not work with official onvif integration so that is not a good solution.
  • Ideally we want to use onvif from HA, so we could override these renewals to essentially never happen. That would be SUBSCRIPTION_TIME and SUBSCRIPTION_RELATIVE_TIME override, maybe some other methods too? This has disadvantage that if user restarts HA too much during one day camera will stop sending events, until it is restarted (like it was always before). This would still leave official onvif with the bug.
  • Even better solution would be figuring it out and fixing in onvif. The renewals are failing most of the time. Retries seem to break old firmwares... TBD.

@macbih
Copy link

macbih commented May 5, 2023

Same here for a Tapo C110 with firmware 1.1.12. Since the HA update 2023.5 the motion sensor will be triggered just once and stays on forever, i.e. until restart of HA or the camera itself.

Thanks a lot @JurajNyiri and @bdraco for looking into this!

@JurajNyiri
Copy link
Owner

Continue at home-assistant/core#92604

JurajNyiri added a commit that referenced this issue May 5, 2023
@sca075
Copy link
Author

sca075 commented May 5, 2023

@JurajNyiri

Thanks really much Man! it works like a charm now :)

@Tontze
Copy link

Tontze commented Oct 25, 2023

Problem renewed ? My C100, both of them, motion detecttions are constantly on ...

@sca075
Copy link
Author

sca075 commented Oct 25, 2023

Problem renewed ? My C100, both of them, motion detecttions are constantly on ...

I stuck to 5.2.3 there the motion sensor works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants