A phone leaves the house for about an hour. In this time about 10 location updates are happening. Afterwards, 8-20MB of data is used. Seems like every location update takes about 1MB. Even stranger, the direction of the data from the home network to the phone is 20x higher than opposite.
No cameras/streams/floorplan enabled in HA.
Does someone have an explanation? What is happening?
I’ve run a test this morning and analyzed the data. What’s happening is that the entire stream of events is being sent towards your phone. I.e. if one of your power plugs is set to update the power readings every second - you receive this message every second on your phone too!
My next test will be to disable background app refresh (this is on an iPhone, and might not be applicable for you at all if you’re on Android). What I presume will happen is that this data won’t be sent automatically to the app. I am suspicious, however, that it will be sent in bulk when the app sends a location update.
The solution I’m considering is disabling location updates from the HASS app, as I already have OwnTracks setup. If you’re using the companion app only for tracking your location, it might be a solution to decrease your internet traffic too.
The app does subscribe to all state changes. How large is your entire list of states? It is doing this to watch zones and scenes for changing to update its internal information. It is possible I could limit this on cell though, but in my experience this tends to be a relatively small amount of objects.
Other than that I don’t really have any idea what else could be contributing to data use. You can export all of the app’s logs and I can take a look (drop them here) or try and see yourself in the logs. They are a bit verbose but generally broad strokes not absurd.
Interesting findings. Here are ~10 smart sockets sending updates every 30 seconds, this means different values for the attributes (not main state) every 30 seconds. Also a lot of Zigbee2MQTT sensors that on any update have a different link quality attribute. I don’t think there are a lot of main state changes.
My data usage is concentrated around the location updates, there does not seem to be a continuous stream. I can also still not understand why the HA → phone data is so high. Even a lot of state changes would not be 0,5MB right?
Location access - enabled, Background app refresh - disabled - roughly the same amount of data (~5MB)
Location access - disabled, Background app refresh - enabled - 0.1MB, according to the iPhone
I presume with location access enabled data is transmitted on every significant location change. The question is why very few bytes of data are going through when there’s no location updates but background app refresh is enabled. My presumption was that Background app refresh would still receive the same amount of data.
I’ll dig into the traffic capture to figure out what else is there. @zacwest would any other port but 8123 be used by the communication between iOS app and hass itself?
In the traffic capture I see the bulk of the traffic at the following timepoints on 23rd of Dec: 09:58:23, 10:00:57, 10:01:30, 10:05:26, 10:15:10, 10:27:25.
I think what might be happening is that at these timepoints I lose cellular connectivity which forces a reconnection.
Also to clarify that I’m not running the latest HASS atm, i.e. it could be a bug fixed in the mobile app companion in newer versions.
Thanks for looking into this! Have happy holidays!
Looks like the app’s WebSocket connection isn’t compressing contents, which can reduce the data load here by like 90%. Looks like I’ll need to fix the library it uses to get it working, but that’s a good potential improvement.
Compression would indeed make the payload much much smaller!
Something else I noticed the other day was that Home Assistant had been on in the background for 9 hours and for only 13 minutes in the foreground. I believe it is crunching something if the app is not swiped away from the running tasks
Actually this is the only day where I noticed this prolonged (indeed doesn’t seem like battery taxing) usage. I do have local push enabled, but I haven’t gotten around to setting up any push notifications whatsoever, just yet. I mentioned it just in case it is related.
Some feedback - I’ve installed the latest beta, and it has decreased usage from 5-7,5 MB to 2 MB. Which, I think is better but still a bit high given the nature of data that is exchanged.