Home Assistant Unofficial Reference 2024.12.1
const.py
Go to the documentation of this file.
1 """Constants for the iBeacon Tracker integration."""
2 
3 from datetime import timedelta
4 
6  FALLBACK_MAXIMUM_STALE_ADVERTISEMENT_SECONDS,
7 )
8 from homeassistant.const import Platform
9 
10 DOMAIN = "ibeacon"
11 
12 PLATFORMS = [Platform.DEVICE_TRACKER, Platform.SENSOR]
13 
14 SIGNAL_IBEACON_DEVICE_NEW = "ibeacon_tracker_new_device"
15 SIGNAL_IBEACON_DEVICE_UNAVAILABLE = "ibeacon_tracker_unavailable_device"
16 SIGNAL_IBEACON_DEVICE_SEEN = "ibeacon_seen_device"
17 
18 ATTR_UUID = "uuid"
19 ATTR_MAJOR = "major"
20 ATTR_MINOR = "minor"
21 ATTR_SOURCE = "source"
22 
23 UNAVAILABLE_TIMEOUT = 180 # Number of seconds we wait for a beacon to be seen before marking it unavailable
24 
25 # How often to update RSSI if it has changed
26 # and look for unavailable groups that use a random MAC address
27 UPDATE_INTERVAL = timedelta(seconds=60)
28 
29 # If a device broadcasts this many unique ids from the same address
30 # we will add it to the ignore list since its garbage data.
31 MAX_IDS = 10
32 
33 # If a device broadcasts this many major minors for the same uuid
34 # we will add it to the ignore list since its garbage data.
35 MAX_IDS_PER_UUID = 50
36 
37 # Number of times a beacon must be seen before it is added to the system
38 # This is to prevent devices that are just passing by from being added
39 # to the system.
40 MIN_SEEN_TRANSIENT_NEW = (
41  round(
42  FALLBACK_MAXIMUM_STALE_ADVERTISEMENT_SECONDS / UPDATE_INTERVAL.total_seconds()
43  )
44  + 1
45 )
46 
47 CONF_IGNORE_ADDRESSES = "ignore_addresses"
48 CONF_IGNORE_UUIDS = "ignore_uuids"
49 CONF_ALLOW_NAMELESS_UUIDS = "allow_nameless_uuids"