Presence detection with iCloud plus another tracker

Are there some good examples of supplementing iCloud’s rather flaky presence detection with other trackers such as bluetooth or ping?

iCloud regularly reports my iPhone as ‘away’, even though it is present on the network and can be seen with a ping (it has a static IP address). Doing presence detection based on both ping and iCloud at the same time doesn’t seem good for battery life, and will as I understand it simply reflect the most recent value. What I want is for person.michael to be considered ‘home’ if either or both device_tracker.iphone_icloud or device_tracker.iphone_ping report ‘home’; otherwise ‘away’. And to ping only when necessary.

Is there some way to do it like this ?

  • Ping the iPhone every 2 minutes ONLY while device_tracker.iphone_icloud reports a status other than ‘home’
  • If the ping succeeeds, set person.michael to ‘home’

Any suggestions would be most appreciated.