-
-
Notifications
You must be signed in to change notification settings - Fork 650
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
Camera traffic, when app in background. #979
Comments
You need to check that "automatically close connections" in your HA user profile is enabled. The frontend actually handles this part as we are just a webview so they look to see if you have gone idle. You should also check that you are not going to the home screen when you have the more info panel open, another offender in this case is if you use the live view card on lovelace which plays video on the homescreen directly. |
|
This started for me too after (one of the) latest update(s). Just spend 2,5 GB in 10 minutes. Never experienced this before. |
@nick2525 and @barrymossel can you please include your yaml camera config and frontend config so we can attempt to recreate. I have tried with my personal setup and I am unable to get the app to stream in the background. |
camera:
camera 3:
camera 4:
camera 5:
camera 6:
|
|
The ones that were commented out are my old camera's which didn't have this problem. When I "updated" those the traffic started getting out of hand. Did some more investigation: I use MotionEye as when I load the rtsp feeds directly into HA I get a lag ranging from 4 to 60 sec. When I load the rtsp feed into MotionEye and let that process and stream it, there is virtually no lag (max 1 sec). But apparently the feeds use way too much bandwidth. When I load the stream url into a browser it uses lot's of data as well. So that's one of the issues for me. But now I turned the quality of the feeds to 25% and it still uses 100's of MB's per couple of minutes. Way more than the original feed passing through the Ewelink app (camera's are Sonoffs). And btw, if I force the app to close it doesn't stream and use data. If I just go back to Android home screen it does use bandwidth. |
Lovelace:
|
I got the same issue (#1017) HA config:
Lovelace:
|
My wife has Xiaomi mi 9T, the bug is also reproduced. |
I just got burned by this, wasted almost 1GB of my data plan. Using the Zoneminder integration, and Picture Glance Cards.
|
Was it fixed in 0.117.0b1? Because the bug is still being reproduced( |
@nick2525 can you verify the frontend version you are on please? |
Frontend version: 20201021.1 - latest |
@nick2525 thanks, and you waited 5 minutes for the connection to close right? |
BTW it looks like the linked issue was actually not the fix for this. That was the reasoning for the bug closing and being re-opened. |
Some cameras disconnected after 5 minutes, but live view is not restored on those cameras. But if I pres on camera, stream works. But live view is not restored on app onResume() |
live view being restored is unrelated to this issue....this issue is purely about making sure the data flow stops when the app is in the background after 5 minutes. |
what are the results if you disable all your picture entity cards? does it 0 out then after 5 minutes? |
It almost no traffic when I disabled camera view live, and 0.00kb after 7 minutes with disabled camera view live |
This might (probably?) be fixed in 2021.9 |
Great! Any pointer to the fix commit? |
Im not sure yet if this is indeed fixed in 2021.9, Im only upgrading now, but I need an emergency workaround in case this isnt fixed or happens again in the future; today I blew through my monthly datacap and incurred a 50 euro data charge in an hour, and I hadnt even turned on my phone's screen. I need something to restrict companion's data usage. I disabled "background data" but that doesnt seem to help. I can presumably totally block it with an android firewall, but then I might as well just uninstall it. Im trying to make a node red flow that monitors the app_rx_gb sensor and correlates it with being on mobile data, but somewhat ironically, that sensor doesnt seem to update in the background, unless something else changes (like my location or alarm clock?) And even if it did, Im not sure what I can do to stop the data, other then send myself a notification. Which Ill probably read too late. |
All known workarounds are mentioned in this issue |
Well... couple things.... Im in the same boat. So i removed the camera page from home assistant. I use blue iris to check them instead. But here are a couple things that were helping me before i removed them. it fixed the problem for me, but others in my home could not follow these 2 simple rules..... so i eventually removed the page for those users.. #1 never close HA app by pressing the HOME button on your phone. The home button does not close ANY app. just pushes it to the background. in Android there are 2 ways to close apps. 1. press BACK BACK BACK BACK BACK ect.... until you see the home screen. or 2. press RECENT APPS button and swipe the app away. (depending on your phone you might have a recent apps button, or you have to long press/ double press home/back to display recent apps menu) #2 Another work-around i was having success with for a while, in HA put all cameras on a single page. when checking the cameras go to that page, then when done, change to a different page before closing app. **see above about closing apps. i really dont understand why fixing this is so hard.... |
This doesnt help. I force closed HA and it would still gobble up bandwidth "in the background". Im no developer, but I dont understand the problem either. The companion app should be 2 parts; one for the front end (basically a browser), one for the sensors/communication. Only the latter should be allowed to run in the background. I wouldnt even mind if companion only did the latter; provide sensor data, something for instructions (and via MQTT please!), while we use a browser for the dashboard. A browser we can actually close :). Regarding Blue Iris, I did the same, relying mostly on BI web interface, and now I managed to actually integrate individual BI UI3 web streams and its web GUI in to HA. I wrote a little piece on it here: This also completely solves this particular issue, as blue iris will stop streaming when the camera frame has no focus, and/or after a configurable time. Completely independently of HA. This isnt a good or universal solution (especially for those not using BI), but its a great workaround for me, or anyone in the same boat; and even if this bug finally gets fixed, it will be some time before I trust HA cameras with my bandwidth. 50 euro is bad enough, but if this had happened while I was traveling abroad, it could have been a very expensive lesson. |
Using iframes for camera streams to work around this bug has at least problem I wasnt aware off; it stops android from entering sleep mode, which is particularly annoying on wall mounted tablets. I worked around that, and that solution may also work -or at least help- for this bug, if you use regular picture entity cards for camera's: whenever I want the tablet to sleep, I redirect companion to a dedicated view that has no iframes (or camera's). I dont know for sure if this will stop regular camera entities from streaming in the background, but it may help and it certainly stops UI3 streams which only stream when they are in the foreground. This behavior has an unexpected benefit for wallpanels too; instead of having to keep sending notifications (which require the cloud!) just to keep my tablets awake while im in the room or the lights are on, the iframe does that for me now. So I can pretty much turn the screen on or off with one command. Full node red flow here: |
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. |
now the camera stream picture dies if HA is open for a very long time. For example, I have a tablet hanging on the wall. I would like the stream to automatically restart |
Does that happen in chrome for android? I think there was some frontend websocket issues in HA core 2021.12 that were fixed in the latest point release. |
this is still an issue. App on Android even in background pulling video stream all the time |
yeah this did not happen to me in chrome. |
I’m also having the issue anytime a camera entity is on the dashboard, it will eventually crash the app. The more camera entities, the fast it manifests. |
That is actually not the same issue as this one, as far as I know the app is not crashing here because there is background data occurring and if the app crashes after a short while I dont think anyone will see GB of data like above. Once an app crashes it is no longer connected to webview. If you are seeing crashes please open a new issue and fill out the template provided with the crash log. In your case check to see if there is a Recent Crash tab when you pull hte app logs for the template. If it is there that is the log we will need. |
Same issue happening to HA app running on my NSPanel Pro and absolutely trashing its RAM. |
Home Assistant Android version:
2.4.1-full
Android version:
10
Phone model:
Xiaomi mi 9
Home Assistant version:
0.115.3
Last working Home Assistant release (if known):
no
Description of problem:
When app in background, video streams from cameras does not stop stream. Almost all apps stops video stream at onPause() Android lifecycle, but HA does not. Now the problem is even more serious, because from the activities of the sensors, the system almost never kills the application. I have a lot of cameras and I wasted 70 gigabytes in a month because of this bug. Plus the battery runs out quickly.
Traceback (if applicable):
Screenshot of problem:
Additional information:
Solution: You should stop stream, when device goes onStop(), maybe communicate with HA server, and show video placeholder.
The text was updated successfully, but these errors were encountered: