May be I have a partial solution but I need some help to a complete solution. As I explain, I have battery drain and huge data traffic (that explain the battery drain). I have few dashboards and in the second one I have a page with all my webcams. As I view it, of course, I have a lot of traffic. But closing the app (installed on a samsung a51 - android) or send it to the background won’t stop the traffic. Only moving to another dashboard and closing it seems to work and that’s isn’t a good solution.
First thing I do is to detect the traffic usage so I create a helper (settings-devices-helper). The logical thing to use is an Utility Meter but didn’t work for me even if I set Net consumption. The thing that work is Derivative sensor : name: Phone HA A51 Traffic; input sensor: App Rx Gb (from Mobile App integration); id: sensor.phone_a51_rx_p6_00000_mn_tus; precision 6; time window: 0:00:00; metric: none; time unit: seconds. It works.
Now I have to find a way to stop the streams when I don’t need to view them. So I made an automation and I use Browser Mod.
alias: Phone A51 Protect Data Trafic
description: ""
trigger:
- platform: numeric_state
entity_id:
- sensor.phone_a51_rx_p6_00000_mn_tus
above: 0.001
condition:
- not:
- condition: state
entity_id: binary_sensor.sm_a515f_interactive
state: "on"
action:
- service: browser_mod.navigate
target:
device_id: 7722e5d54be759d6166687aaad5e299c
data:
path: /dashboard-giardino
mode: single
What I want to do in this automation is:
- When the data traffic is high
- And the app is not active (closed/background)
- Resolve the traffic in some manner:
3.1 Move to another page using browser mode (do not resolve: it move to a new page when it come from background)
3.2 Restart service and integration like go2rtc, Android Ip Webcam, Tapo, Imou … (do not resolve: a bad solution with tapo integration stop responding)
3.3 Restart Home Assistant (a bit extreme solution)
3.4 Service media_player.stop (device target. android browser id ) do nothing.
3.5 ???
Any idea for point 3.5 ???