JurajNyiri / HomeAssistant-Tapo-Control

Control for Tapo cameras as a Home Assistant component
Apache License 2.0
1.08k stars 85 forks source link

C320ws (HWv2-FWv1.0.5) goes offline for several hours within the day. #362

Closed krasatos closed 6 months ago

krasatos commented 1 year ago

Description

Hey there, I have 11 Tapo Cameras wired through ethernet on my network. Two c310-fw1.3.2, and 9 c320ws (two of them are hw2-fw1.0.5, the remaining 7 are hw1-fw1.3) They are wired with passive POE splitters and they all stream to a frigate machine.

I noticed that the cameras would go offline for several hours and then suddenly reappear again. The leds on them seemed to work ok, but i couldnt access the cameras (from app/frigate/ha)

It seemed strange as only the two hw2/fw1.0.5 cameras did this.

I removed just those two units from the HA intergration and now it seems i've gone 10h with no interuption.

Could be the hw or the fw i dont know, just thought i should let you know, perhaps it helpse someone out in the future.

Reproduction Steps

Camera goes offline randomly 2-3 times during the day for several hours each time. Then comes back and works ok for a while.

Expected behavior

.

If applicable, add error logs.

No response

Device Firmware

1.0.5

Using stream component

Yes

Does camera work via official integrations?

No

Camera has all attributes filled out in developer tools

No

HASS Environment

Supervised

Search for similar issues

Yes

Additional information

No response

michbeck100 commented 10 months ago

I am using the beta version 1.0.9. and the new firmware is not showing up for me. Is that because of the existing beta version? Anyone having the same problem?

rschildmeijer commented 10 months ago

one out of two c320ws got the update (so far) to 1.0.10. Both were on 1.0.5

Necunet commented 10 months ago

Hello. Since the last update of the 5.4.4 integration, I have more crashes of my cameras: C520WS Firmware: 1.0.11 Build 230621 Rel.72773n, connected by ethernet cable and C320WS 1.0.5 Build 230316 Rel.55457n connected to wifi. I have disabled all unnecessary entities. My C210 and C500 cameras work perfectly.

rschildmeijer commented 10 months ago

any recommendations (or thoughts) about using this integration together with the (native/mobile) Tapo application? Could potentially cause issues since its not really recommended to digest the rtsp stream from more than one place?

Fettkeewl commented 10 months ago

any recommendations (or thoughts) about using this integration together with the (native/mobile) Tapo application? Could potentially cause issues since its not really recommended to digest the rtsp stream from more than one place?

I'd bet on the stuff mentioned in previous posts. Either feed the integration a restream of the rtsp stream från camera (via software like go2rtc or frigate) or disable the camera entities created from this integration so you can keep your other entities through it.

rschildmeijer commented 10 months ago

any recommendations (or thoughts) about using this integration together with the (native/mobile) Tapo application? Could potentially cause issues since its not really recommended to digest the rtsp stream from more than one place?

I'd bet on the stuff mentioned in previous posts. Either feed the integration a restream of the rtsp stream från camera (via software like go2rtc or frigate) or disable the camera entities created from this integration so you can keep your other entities through it.

But...afaik its not possible to tell the native Tapo application to use another RTSP stream. So as soon as someone uses the Tapo mobile application that will consume the single stream?

JurajNyiri commented 10 months ago

@rschildmeijer Tapo app does not use RTSP stream.

howi42 commented 10 months ago

But that would mean, the Tapo app should only be used by one person. If this is true, the Tapo camera resp. their software needs some serious work.

To restrict their cameras to a single user makes them quite useless.

On Mon, Nov 13, 2023, 10:58 Juraj Nyíri @.***> wrote:

@rschildmeijer https://github.com/rschildmeijer it is, check integration options.

— Reply to this email directly, view it on GitHub https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues/362#issuecomment-1807826100, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACC3MNDMVKYNGYE6CVPRWB3YEHVKZAVCNFSM6AAAAAA2ALHSFKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBXHAZDMMJQGA . You are receiving this because you were mentioned.Message ID: @.***>

rschildmeijer commented 10 months ago

not necessary true. the mobile application itself gets the stream from the tapo cloud (fanout). mobile client -> tapo cloud -> (rtsp) camera hw

so my questions is basically then if the tapo (cloud) eats and allocates the single rtsp stream? hopefully this is special cased and does not eat the "publicly" available camera stream

rschildmeijer commented 10 months ago

not necessary true. the mobile application itself gets the stream from the tapo cloud (fanout). mobile client -> tapo cloud -> (rtsp) camera hw

so my questions is basically then if the tapo (cloud) eats and allocates the single rtsp stream? hopefully this is special cased and does not eat the "publicly" available camera stream

Update: I just noticed JurajNyiri reply. So should be fine to use Tapo application

Fettkeewl commented 10 months ago

@JurajNyiri I've been doing some daily testing. On my C520WS if I run the rtsp feed to frigate only (no other config in HA, just feed the rtsp link) I have constant uptime. The moment I add the C520WS to Tapo Camera Control there will be communication issues with the camera where the integration and the feed stops working.

Sometimes the camera seems connected as my ping sensor can still ping it from HA, other times the camera blinks orange (as in wifi connection issues) but in both cases no communication from tapo integration not feed from rtsp*

The way I added the camera was disable everything except webhooks and also fed a restream URL to the integration which I could confirm was working (restart frigate killed the restream which stopped the feed to Tapo integration camera entity until frigate rebooted)

Currently I have re-added the camera to Tapo Camera Ctrl with debug enabled to see if I can get anything useful from logs. I also need to put an SD-card in the camera to get it's debug log.

My question to you: With everything but webhook enabled (when configuring the camera) and an rtsp resteam feed... What is the integration doing in the background towards the camera except poll the state of settings I guess? I.e... what could it be doing that would cause the camera to malfunction?

JurajNyiri commented 10 months ago

@Fettkeewl see https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues/362#issuecomment-1764959460 .

gregoryjgreen commented 10 months ago

Not sure if relevant, but found this open issue when chasing down a similar problem with my c320ws that I've been testing. It would work fine for "X" amount of time, then HA would just lose connection to it (Unavailable). Error log showing "Max retries exceeded"/"Faiiled to establish a new connection"/etc... Camera was available in the Tapo app, could ping it from my desktop, and stream worked fine in VLC/OBS, just not HA.

Finally dropped to terminal in HA and the server could not ping the camera. ARP entry in desktop, no ARP entry (incomplete) on server. The ARP table on my router did have an entry for it, but curiously no active DHCP lease. So, a few dozen rabbit holes later, turns out this cam (at least HW2-FWv1.0.5) will only make a DCHP request ONCE and then essentially set itself as a Static IP with that address.

The problem with that is the DHCP server still thinks that IP is in the available pool if the tapo doesn't ever do another response/ack. So if another device, especially a particularly chatty IOT one, happens to get the same IP and sends out a bunch of gratuitous traffic, the network switch/HA's ARP table has a conflict and you'll see some weird behavior on whatever other device picked up that same IP as well until it refreshes on the lease timeout (likely getting a different IP) and the issue will 'clear up' on a reboot.

From what I saw in banging my head on this, that Tapo IP persists through (multiple) reboots, and power cycles, suspect a factory reset would do it, but I'm too lazy to climb back up to where it's mounted to try it 'for science'.

Hence, setting a static DHCP reservation before initially configuring the camera with the App, much less HA, is advisable.

In my situation I grabbed libonvif (which is where you can plainly see that 'DHCP Enabled' has been turned off by TP-Link's Firmware). From there just hard set the IP to whatever static you'd like, modify the entity configuration in HA to match the new static IP, and all is gucci...

Well, at least is has been for the past hour or so. If it does crap out again, I'll revise this post and eat the requisite crow.

JurajNyiri commented 10 months ago

Excellent research @gregoryjgreen . That would explain all the issues users encountered in this thread. Instead of setting the IP on camera itself I would recommend setting it on router instead though. Let us know how it goes!

Necunet commented 10 months ago

I have my C320WS and C520WS cameras with static ip and I'm still having problems. I've managed to remove crashes with Home Assistant's ONVIF integration. I've removed the video from the tapo integration. I get the video from the native ONVIF integration

Fettkeewl commented 10 months ago

Excellent research @gregoryjgreen . That would explain all the issues users encountered in this thread. Instead of setting the IP on camera itself I would recommend setting it on router instead though. Let us know how it goes!

how I wish it would have been that simple for me :P I have DHCP range from router between 192.168.1.4-99, rest i use solely as static ips which i assign to devices from router (mainly iot stuff) so my 7 cameras are in the .231-.237 range already :P Still getting theese issues. Will be interesting to see the cameras debug log and match the time frame in the log to when I loose all connection to the camera via my ping sensors

howi42 commented 10 months ago

I see the same. All my Tapos have a, kind of, static address, never changes. Nevertheless, one of my 310 keeps having this problem. And, cabled or not, does not matter. number of entities retrieved, does not matter. I sent the developer a diagnostic log a few days ago, waiting for an answer.

On Thu, Nov 16, 2023, 10:06 Fettkeewl @.***> wrote:

Excellent research @gregoryjgreen https://github.com/gregoryjgreen . That would explain all the issues users encountered in this thread. Instead of setting the IP on camera itself I would recommend setting it on router instead though. Let us know how it goes!

how I wish it would have been that simple for me :P I have DHCP range from router between 192.168.1.4-99, rest i use solely as static ips which i assign to devices from router (mainly iot stuff) so my 7 cameras are in the .231-.237 range already :P Still getting theese issues. Will be interesting to see the cameras debug log and match the time frame in the log to when I loose all connection to the camera via my ping sensors

— Reply to this email directly, view it on GitHub https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues/362#issuecomment-1814044935, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACC3MNG4V6QYYFORBHFIITLYEXJR7AVCNFSM6AAAAAA2ALHSFKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJUGA2DIOJTGU . You are receiving this because you were mentioned.Message ID: @.***>

Fettkeewl commented 10 months ago

I see the same. All my Tapos have a, kind of, static address, never changes. Nevertheless, one of my 310 keeps having this problem. And, cabled or not, does not matter. number of entities retrieved, does not matter. I sent the developer a diagnostic log a few days ago, waiting for an answer. On Thu, Nov 16, 2023, 10:06 Fettkeewl @.> wrote: Excellent research @gregoryjgreen https://github.com/gregoryjgreen . That would explain all the issues users encountered in this thread. Instead of setting the IP on camera itself I would recommend setting it on router instead though. Let us know how it goes! how I wish it would have been that simple for me :P I have DHCP range from router between 192.168.1.4-99, rest i use solely as static ips which i assign to devices from router (mainly iot stuff) so my 7 cameras are in the .231-.237 range already :P Still getting theese issues. Will be interesting to see the cameras debug log and match the time frame in the log to when I loose all connection to the camera via my ping sensors — Reply to this email directly, view it on GitHub <#362 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACC3MNG4V6QYYFORBHFIITLYEXJR7AVCNFSM6AAAAAA2ALHSFKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJUGA2DIOJTGU . You are receiving this because you were mentioned.Message ID: @.>

Did you check that log yourself ? Find anything interesting ?

Fettkeewl commented 10 months ago

This is first record of communication error between a reboot and camera crashing. It's alien in meaning to me but does it tell you anything @JurajNyiri (the isolated row)


2023-11-16 15:11:15.775 DEBUG (MainThread) [custom_components.tapo_control] TapoBabyCryDetectionSelect updateTapo 3
2023-11-16 15:11:15.775 DEBUG (MainThread) [custom_components.tapo_control] TapoBabyCryDetectionSelect updateTapo 4
2023-11-16 15:11:15.775 DEBUG (MainThread) [custom_components.tapo_control] TapoBabyCryDetectionSelect updateTapo 6
2023-11-16 15:11:15.775 DEBUG (MainThread) [custom_components.tapo_control] Updating TapoBabyCryDetectionSelect to: off
2023-11-16 15:11:15.775 DEBUG (MainThread) [custom_components.tapo_control] Updating entity...
2023-11-16 15:11:15.775 DEBUG (MainThread) [custom_components.tapo_control] <entity select.c200_01_move_to_preset=unavailable>
2023-11-16 15:11:15.775 DEBUG (MainThread) [custom_components.tapo_control] Updating entity...
2023-11-16 15:11:15.775 DEBUG (MainThread) [custom_components.tapo_control] <entity select.c200_01_patrol_mode=unavailable>
2023-11-16 15:11:15.775 DEBUG (MainThread) [custom_components.tapo_control] Initiating media cleanup for entity 30fbb3df51bbb067ec10aaa4b2bcf037...
2023-11-16 15:11:15.775 DEBUG (MainThread) [custom_components.tapo_control] Removing cache files from old HA instances for entity 30fbb3df51bbb067ec10aaa4b2bcf037...
2023-11-16 15:11:15.776 DEBUG (MainThread) [custom_components.tapo_control] Deleting hot storage files older than 3600 seconds for entity 30fbb3df51bbb067ec10aaa4b2bcf037...
2023-11-16 15:11:15.776 DEBUG (MainThread) [custom_components.tapo_control] Finished fetching Tapo resource status data in 1.335 seconds (success: True)

2023-11-16 15:11:25.645 ERROR (MainThread) [custom_components.tapo_control] HTTPSConnectionPool(host='192.168.1.237', port=443): Max retries exceeded with url: /stok=2l(UPB0(F52LB(X205BTm(j20UcTh(sX/ds (Caused by SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1006)')))

2023-11-16 15:11:25.645 DEBUG (MainThread) [custom_components.tapo_control] Updating entities...
2023-11-16 15:11:25.645 DEBUG (MainThread) [custom_components.tapo_control] Updating entity...
2023-11-16 15:11:25.645 DEBUG (MainThread) [custom_components.tapo_control] <entity camera.c520ws_01_hd_stream=idle>
2023-11-16 15:11:25.645 DEBUG (MainThread) [custom_components.tapo_control] Updating entity...
2023-11-16 15:11:25.645 DEBUG (MainThread) [custom_components.tapo_control] <entity switch.c520ws_01_privacy=unavailable>
2023-11-16 15:11:25.645 DEBUG (MainThread) [custom_components.tapo_control] Updating TapoPrivacySwitch to: unavailable
2023-11-16 15:11:25.645 DEBUG (MainThread) [custom_components.tapo_control] Updating entity...
2023-11-16 15:11:25.645 DEBUG (MainThread) [custom_components.tapo_control] <entity switch.c520ws_01_lens_distortion_correction=unavailable>
2023-11-16 15:11:25.645 DEBUG (MainThread) [custom_components.tapo_control] Updating entity...
2023-11-16 15:11:25.645 DEBUG (MainThread) [custom_components.tapo_control] <entity switch.c520ws_01_indicator_led=unavailable>
JurajNyiri commented 10 months ago

@Fettkeewl That means that the SSL connection to the camera was not successful - camera did not properly respond to the request.

JurajNyiri commented 10 months ago

Also make sure to upgrade to the latest integration version, that should give you details about exactly what communication is happening in the Debug logs starting with [pytapo].

jonathanrobichaud4 commented 9 months ago

I just wanted to let everyone know but I have disabled the camera streams in the integration and all seems well right now! I'm using the Webrtc integration instead. Also I had a C225 that one day seemingly bricked itself so maybe the firmware needs work. I was sent a replacement though. I also am not even sure if I had the integration enabled then! I also have a c100 which I have had no issues with at all so I'm pretty sure the issue is firmware (EDIT: The C225 still crashes so I am 90% sure at this point this is probably a tplink firmware issue)

howi42 commented 9 months ago

My confusion gets worse; today I had for the first time one of the cameras available in Tapocontrol, but not on the Tapo app.

On Fri, Nov 17, 2023, 02:59 Jonathan Robichaud @.***> wrote:

I just wanted to let everyone know but I have disabled the camera streams in the integration and all seems well right now! I'm using the Webrtc integration instead. Also I had a C225 that one day seemingly bricked itself so maybe the firmware needs work. I was sent a replacement though. I also am not even sure if I had the integration enabled then! I also have a c110 which I have had no issues with at all so I'm pretty sure the issue is firmware

— Reply to this email directly, view it on GitHub https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues/362#issuecomment-1815627426, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACC3MNGCHM77YUBBU4LIEJ3YE3AJJAVCNFSM6AAAAAA2ALHSFKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJVGYZDONBSGY . You are receiving this because you were mentioned.Message ID: @.***>

wiktorsikora commented 9 months ago

I think i'm dealing with similar problem. I have C225 camera with firmware 1.0.24 Build 230731 Rel.42636n. Camera goes offline every night between 3:00 - 4:00 AM local time (at least that's wthat the sensor readings suggest). When it happens it is unreachable in HA and in Tapo app. I think this is not a network error because the camera doesn't turn off the IR LED in the morning. This may suggest total firmware crash.

Information about my setup:

I just noticed i have auto updates enabled in Tapo app. Updates are scheduled to 3:00 - 5:00 AM so it overlaps with the time when the camera goes offline. I will turn off updates and see if that helps.

roblatour commented 9 months ago

my C320ws has stopped working in Home Assistant. Not sure when this first happened, but within the last few days I would say.

RbasicG commented 9 months ago

Anyone here tried the new 1.1.16 firmware?

roblatour commented 9 months ago

The fix for me was to go into Home Assistant - HACS - Updates and update the version of the TAPO interface there

peely commented 9 months ago

I got my cameras this weekend, set them up and let them apply their automatic updates, and one went offline on the first night. Luckily, I stumbled across this issue while browsing the repo.

I've read the whole thread thing, and I've now disabled the offending camera in the Devices view. Will see if the issue persists.

My cameras are: Friendly Name Model Hardware Revision Firmware Version
Front C510W - 1.0.9
Garage Inner TC70 v3 1.3.9
Garden C320WS v2 1.0.10 Build 231102 Rel. 66223n
Driveway C320WS v2 1.0.10 Build 231102 Rel. 66223n

While "Garden" and "Driveway" appear to be identical (They are even wired into the same router, and run off the same ring main circuit), only "Garden" is showing issues. I set them up the same, both in the Tapo app and on the integration with HA.

I look at all the camera in the Tapo app (Still getting used to them), and only the Garden one went offline overnight last night, and in the middle of the day today.

I'll see if that stops the issues. But how are you people monitoring your cameras? I have a ping check setup once a minute, and that continued to return when the Tapo and HA apps lost connection. I only noticed because I kept looking a the app to check. The camera was being responsive, until suddenly it was taking a long time to load any of the settings, and then it stopped all together. After an amount of time, it came back.

EDIT: Well, last night as I was casually looking at the Tapo app, the second C320WS ("Driveway") went offline. Again my Ping monitor did not show any downtime.

wiktorsikora commented 9 months ago

It looks like a firmware update solved the problem in my case. I have version 1.0.27 Build 231107 Rel.69776n and the camera has been online for a week.

rschildmeijer commented 9 months ago

for transparency: I have two c320ws. One with fw 1.1.6 (55705n) and one with 1.0.10 (Rel. 66223n). Both have been stable (wifi connectivity) for weeks after I unistalled the tapo controller/camera integration. (cant say if recent tapo controller/camera versions would have behaved differently)

jonathanrobichaud4 commented 8 months ago

Yeah, same thing for my C225. It has been running stably since the last firmware update. (1.0.27 Build 231107 Rel.69776n) So, I’d say this is a device issue and not an integration issue!

Avlonitis commented 8 months ago

In the last days I have already disabled all entities except the camera hd stream. The C220 is still going offline serveral times a day.

I'm hoping for a new firmware to fix that.

@mafr95 Is C220 stable now?

JurajNyiri commented 7 months ago

I just bought C520WS and installed it today, lets see what happens.

Firmware: 1.2.6 Build 231130 Rel.72992n

JurajNyiri commented 6 months ago

It's been rock stable. Closing due to inactivity and reports that the issue is now fixed in firmware.

julienvedebe commented 5 months ago

Hello sorry to disrupt the happy ending, but recently I bought C200 one and I have exactly the same issue discussed in this thread. My firmware is the latest 1.3.11 (from December) and caméra fails 3-4 times a day with same behavior each time :

So after reading many comments on this thread I tried to disable as much entities as I can but it finally change nothing it keeps failing. My integration is up date, did I miss something?

Thanks for help

JurajNyiri commented 5 months ago

If the camera goes offline it need to be fixed on camera itself or your network environment. Disabling entities does nothing as previously described there is only one data fetch for everything.

julienvedebe commented 5 months ago

Ok understood, my camera have the latest firmware so I believe it should be ok so last option is to look after my network. All my automation entities are linked using an apple airport thing will check config.

Thanks for your help

howi42 commented 5 months ago

How is it possible, that my Tapo 320ws is visible in HA, but not in the Tapo app ?