Here is a quote from my original post " Nothing with home assistant is exposed outside of my network and it runs on http not https" My phones have no ability to talk with Home Assistant when I turn wifi off and vice vs.
This is from the OwnTracks website:
Certain vendors have their own restrictions for apps running in the background. On these devices, Owntracks might be killed even though it behaves according to the official Android background execution limits.
A list of vendors known to interfere with background apps and a number of workarounds can be found at Donât kill my app!.
If youâve checked all that, the next step would be to raise an issue on Github:
Again a quote from my original post
This is where is gets weird. If the app is started and running in the foreground, with some sensors, say the âis the phone chargingâ sensor, well it acts as expected, instantly letting you know when I pull the cable or put it back in. This sensor also works with the app in the background
I apologize if I did not make it clear in my original post. With the app running in the background (and no it does not magically kill itself if I leave it alone for hours) Some sensors that say instant updates work like they should, some do not.
Itâs not me and permissions, itâs not me and settingsâŠitâs how the companion app is coded and how it interacts with specific sensors. I put a great deal of time, thought, troubleshooting and details into my topic before posting.
Whats the problem with the menu option itself?
Does this mean HA itself is not accessible outside your network?
Lets stick to android and not iOS. What exactly is not working? Did you get logs to see if there was an error?
for android this is not true. The app only needs to be started once and again if the app crashed. Otherwise the sensor worker will reconnect after user has unlocked the device post boot or even after the app was updated in the play store.
Actually its very important to talk about permissions and battery restrictions because those are the heart of android. Given you are on a custom ROM you probably have even more settings to consider than a stock ROM.
we are still missing logs and detaisl as to what exactly is not working.
I guess you do not understand how intents and work manager on android actually work because what you are describing is expected.
This must be device specific. On a Pixel device it works as described.
Again more device specific issues. Try a stock ROM to rule custom ROM out. It has been seen in the past that custom ROMs do not always respect android documentation.
please pin point exactly where in teh code the coding issue you describe is
Given that you decided to run a custom ROM you should be willing and able to troubleshoot any issue asked of you and you shoud be aware that they are not by any means perfectly bug free.
There you have it, you shoudl not expect ANY sensors to update if the device cannot communicate to your house.
If you checked the companion app logs you will see errors as such too.
To save yourself time did you report an issue within github?
I know it is tedious but can you come up a specific list of the sensors that do not update (this will allow you to ensure the sensors that update and those that do not is consistent). Then you could also enrich that data with information about which integration, what kind of sensor, etc. This way you may be able to glean more granular pattern of symptom/s to get to the root of the problem.
Also does anyone know if there is a way to put very verbose logging on both the phone app and the host server that is specific to communication between the app and the HA âserverâ? It could be that some informaiton is being sent by the server - or not when it should be - or some indirectly tries to touch the internet for some reason -
Pick one specific sensor that consistently has this issue and try to trace all the communication between it and a phone?
It seems like your issue may be one thing in your network hadware/software communication. Maybe also try different network encryption protocols between your router and one of the phones to see if that makes a difference? (E.G., I did have an annoying hard to resolve hardware/networking connectivity issue which might be the same kind of thing with your situation. I had all manner of nightmare connectivity issues with a nest learning thermostat and changed the location of electronic devices near it as well as replacing the thermostat itself it and finally determined that either my router or the nest thermostat did not properly handle one of the more secure networking protocols - once I changed that all of those issues went away - )
How sophisticated is your network? Do you have anything out of the ordinary set up in your router settings like CIDR, Subnetting, IP6, LLDP, SNMP etc. (I am at the edge of my networking knowledge here)?
Do you know anyone that lives nearby that would allow you to temporarily connect to their HA instance with the app on your phone when on their network, just to see if the sensors work properly then on the phone? If it does work that would prove it was not the phone itself (although maybe still an issue with the app) -
Another possibility is to allow one of the sensors access to the internet and then if you see the problem go away with that sensor being displayed on your phone then you have proven there is an issue with the app related to security in that mannerâŠ
the in app log viewer will pull all logs we print.
for the HA core side, you want to enable debug logging for mobile_app
integration
then you will see ALL communication sent from device to server and vice versa
@dshokouhi I think you hit the nail on the head - @HA_too_much_coding have you looked into both below?
You posted quite a long rant - but if this is all you want, why not use a router based device tracker and be done with it? That will be the first to know if a phone connected to wifi, no companion app needed at all. I know the companion app has a huge list of sensors. But I cannot for the life of me figure what their use case is for 95% of them, other than pure data hunger.
we get requests often for sensors that have somewhat static data or just a setting from the app, those exist because we allow them to be controlled remotely and you need to read the state to do it properly. First time Kotlin learners also like to add sensors as a way to dip their feet in the code. Some of them I do agree as they are more for troubleshooting purposes but a good chunk of them have good purpose. Take the App Importance sensor for example, a good way to know if the app is actively open or not.
Or⊠ping the phones from HA.
Ah, coding fun! That I understand To be honest, I enabled all and I have no use for them. I know, Iâm an addict. I was trying to make a point and the only use case mentioned is run an automation when someone comes home.
But to get back to the topic, maybe something is wrong, maybe not. The situation described is not exactly run of the mill.
But I do think relying on an app on the device to check if the device is home or not is conceptually flawed in this situation, because the phones are connected on local wifi only. The minute the phone goes of wifi the companion app has no way to notify to HA , so HA needs to assume the device is gone based on long time no updates or unable to reach the phone from HA. A simple ping sensor does just that - check if it can reach the phone. Also, the sensors on the phone are only trustworthy if the phone is home and connected to wifi, so you cannot rely on them for automations simply because they could be stale anyway.
This is a very complicated issue, with several devices and many sensors. The best way forward might be to pick one issue - one phone, one sensor, one problem - and report that on Github. The âraise an issueâ form is quite good: requires an exact description and gives an opportunity to add logs. Then take it from there.
I leave them all enabled to ensure battery drain isnât horrible
This is only true if your instance is not remotely accessible. If it is then you can count on sensor updates to always come in when the app can phone home. If your instance is not remotely accessible then a lot of the desired functionality will not work as one would expect. In fact a user could be confused because notifications naturally come from Firebase so as long as your server has internet your phone can still receive the notification. A user could perceive that as all of the app should work but that is not the case when you see the logs
The companion app as well as the device_tracker from the router and a ping. The more, the better!
Iâm using a points based approach, that uses the combination of different connections to the same sensor and combines these into one, and for this sensor I give points, depending on reliability and importance. In the end, I have 70 points as threshold. 70 and over Iâm home, 69 or lower Iâm not a home.
Similar setup here (well, concept anyway). I use the Bayesian integration to calculate the probability of me being home, based on about a dozen sensors ranging from trackers on phone and keyring to time of day (4am and Iâm probably in bed). More than 85% and Iâm home.
For your bed, I really, really would recommend to built this great project in your home:
Tom did a great write-up of his bed sensors and how to use them. This really is amazing, as soon as youâre over the fact, that you now entered the Nerd-vana and are measuring your bed times.
yep i have a family phone (current apple device, all permissions enabled, latest companion app version) right now that hasnt updated its location for +4hours and I know its 20Kms from where the house says it is. But the companion app is online⊠old problem⊠regular issueâŠ
I know this has been mentioned before (itâs not the user⊠) but seriously, it MUST be the settings you have in your phone. The app works perfectly for me. My house alarm system disarms as Iâm driving up the street as I expect. Thatâs how accurately itâs location tracking is (this is purely on location, not wifi as it disarms before Iâm in wifi range).
Check all phone settings / permissions for the app.
Start with these steps that have existed for over a year and if the issue still happens keep reading and look at the logs that are mentioned as part of the same troubleshooting step.
Solved my issue with HA iOS companion app not updating sensors.
In my case, I use the battery % to turn off a charger. I have created an automation on the iPhone using the âShortcutsâ app to trigger the HA sensors update when the battery hits 100%. Works like a charm - my HA automation that is triggered by the phone battery level now triggers correctly all the time.
Apparently, some developer added that call to update sensors on the iOS HA app so we can force that on purpose. It overcomes the iOS version updates and all that stuff that can break the automations.
Hope it helps.