![]() Request the permission to the user when app is running (the plugin can handle this automatically).Declare the permission the app requires in configuration files.In order to use beacons related features, apps are required to ask the location permission. result contains the new monitoring state: // - enter // - exit InBackground : false, // continue the monitoring operation in background or not, see below Permission must be declared in ios/Runner/ist: The latter is required for background monitoring.įor more details about what you can do with each permission, see: There are two available permissions in iOS: when in use and always. When turned off, monitoring will automatically pause when app goes to background and resume when app comes back to foreground. Otherwise it will actively continue in background until the app is terminated by the OS. Once the app has been terminated, the monitoring will continue. If a monitoring event happens, the OS will start the app in background for several seconds (nothing will be visible for the user). The OS is providing you the opportunity to perform some quick operation, like showing a local notification. In order to listen to background monitoring events, you can subscribe to a special stream. This stream is passive: it does not start a monitoring operation. You are still required to start it using Beacons.monitoring(inBackground: true).īecause the OS will run the app in background for several seconds only, before terminating it again, the good place to setup the listener is during app startup.This post is by Home Assistant contributor Greg Dowling. In 2013 Apple introduced iBeacons: a class of Bluetooth low energy (LE) devices that broadcast their identifier to nearby devices, including most smartphones. At first glance it’s hard to imagine why they might be useful. In this two part blog I’ll try and explain why they are useful and how you can use them with Home Assistant. The reason I started using iBeacons was to improve presence detection (and I think that’s the case with most people) so that’s what I’ll discuss in part 1. Using beacons to improve OwnTracks location data In part 2 I’ll talk about using iBeacons to track devices that can’t track themselves. When you use OwnTracks in standard major move mode (which is kind to your phone battery) it sometimes fails to update when you’d like it to. In my case I found that it would often send a location update as I was on my way home, but then not update when I got home. The result would be that Home Assistant would think I was 500M away from home, and take quite a while to notice I was home. It would also mean that the automation that should turn on my lights when I got home didn’t work very well! There were a few times when my phone location updated at 2am and turned the lights on for me. Luckily, OwnTracks supports iBeacons so I could use them to make presence detection more reliable. When OwnTracks sees a beacon it recognizes, it will send an update. ![]() This means that if you put a beacon at your front door - OwnTracks will see it within a few seconds of you arriving home - and send an update saying it has seen this iBeacon. To do this you first need to set up MQTT and OwnTracks in Home Assistant - and make sure that HA can track your phone. Tell Home Assistant where your beacon is located You then have to (A) tell Home Assistant where the beacon is located and (B) tell OwnTracks to recognize the beacon. You tell Home Assistant about fixed locations by creating a Zone with the longitude and latitude of your beacon. You should also give the zone a name which you will also use when you set up OwnTracks. Zone : - name : ' Drive' latitude : XXX longitude : YYY radius : 100 An an example this zone specifies the location of my drive way. The radius isn’t used by the beacon code, but it is used by the GPS location sensing code. Give the beacon a name e.g., -drive ’(start the name with a - see below for the reason).Touch the + symbol at the top right of the screen.Touch the Regions menu at the bottom of the screen.Once you’ve created the zone - you need to restart HA.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |