this post was submitted on 18 Jul 2024
22 points (100.0% liked)

homeassistant

12008 readers
30 users here now

Home Assistant is open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server. Available for free at home-assistant.io

founded 1 year ago
MODERATORS
 

I'd like to use my smartphone WiFi SSID to determine if I'm home or not. When I'm home the alarm (kinda, just notifications from some sensors) needs to be shut off and a light needs to be turned on. Since the sensors update can be forced at maximum 1 minute (but I'd prefer to leave it at 15 minutes to preserve battery) and since 1 minute is too much, is there a way to send an intent to HA companion app to send a sensors update? I would use Tasker to send the intent.

all 12 comments
sorted by: hot top controversial new old
[โ€“] [email protected] 4 points 3 months ago (1 children)

Go to your phone WiFi settings and turn off the random Mac address security feature on your wifi, then set up your router in HA as an integration. This will make device trackers for each mac address on your lan.

Then you can set that device tracker in your person.entity to track yourself.

That way, when you get home and on your WiFi, your router will mark you home

[โ€“] [email protected] 1 points 3 months ago (1 children)

I didn't know that existed integrations for routers. I'm installing the one for OPNsense and I'll try this method. by the way, I've just noticed that the wifi SSID to which I'm connected changes instantly in HA, I've no idea why! ๐Ÿ˜…

[โ€“] [email protected] 3 points 3 months ago* (last edited 3 months ago) (1 children)

In the companion app, where you choose the update interval, there's a banner of text that explains it.
Some sensors update instantly (such as connected WiFi SSID), others update on an interval (such a battery level or pressure sensor).
The maximum update interval applies to non-instantaneous sensors.

Sensors will update either instantly or on a defined interval. If the sensor supports instant updates then it will always receive instant updates. View the sensor details to learn which sensors update instantly.
If the sensor does not support instant updates then it will update based on one of the below selected options
You must restart the application when you make any changes to this setting

When you select which sensors to enable you can see whether it's an instantly updating one or one on a timer

[โ€“] [email protected] 2 points 3 months ago (1 children)

I missed that piece of information, thanks a lot!

[โ€“] [email protected] 3 points 3 months ago

The router polling integration is probably a bit superfluous for devices that have the companion app installed.
Although, it's still helpful for other devices like guests' phones, or non android/ios devices.

Not sure how helpfully to your use case these will be, but a few ideas...

It's been a while since I tinkered, but I think you can also assign multiple devices to a person and track the person's presence instead of a specific device.
You can also create a group of persons, which is handy for some use cases.

As an example, I have a group.us which contains person.me and person.mypartner. The group's status is home if either of us are home and only changes to away if neither of us are home.

Similarly, I have a group.guests which contains guests who sometimes spend the night.
If any guests are home, my goodnight automation ignores the bathroom and the guest bedroom lights.

group.guests:

entity_id:
  - input_text.manual_guest_tracker
  - person.guest
  - person.fren
  - person.otherfren
  - person.olefren
  - person.stepbro
  - person.nephew
  - person.cousin
  - person.niece
order: 3
icon: mdi:bag-carry-on
friendly_name: Guests

I have an input boolean that changes input_text.manual_guest_tracker to home/not_home if we wanna enable "guests mode" without having to track a device.

Single person with multiple trackers:
person.fren:

editable: true
id: fren
device_trackers:
  - device_tracker.applewafren
  - device_tracker.iphonefren
friendly_name: Fren

[โ€“] [email protected] 3 points 3 months ago* (last edited 3 months ago) (1 children)

Just to add - if your phone drops off the wifi (mine does and I'm still trying to find out why... maybe due to power saving), then maybe, you could also look at bluetooth tracking (ie something like ESPresence) for HA to know you're still at home.

(Bluetooth can also be setup in the Companion App)

[โ€“] [email protected] 1 points 3 months ago

Nice idea, thanks!

[โ€“] [email protected] 2 points 3 months ago (1 children)

You can also use the GPS tracking in the companion app. If you're on android (I've had issues on IOS) and have your home zone set up rightz it's pretty damn solid.

I use it and have my outside lights integrated, and they're always on when I get home at night

[โ€“] [email protected] 1 points 3 months ago (1 children)
[โ€“] [email protected] 1 points 3 months ago

On iOS you may need to allow HA to constantly track your location. Iโ€™ve done a decent amount of testing with zones and it seems to work well. I used some temp Node Red logic to send a push notification as I entered/left zones and it was pretty accurate.