Please ⭐ this repo if you find it useful
Passive Bluetooth presence detection of beacons, cell phones, and other Bluetooth devices.
This add-on actually is a usage convenient shell for launching the Andrew J Freyer's monitor script on the same machine where the Home Assistant itself works. This script useful for MQTT-based home automation, especially when the script runs on multiple devices, distributed throughout a property.
You can combine add-on and common versions of this presence monitor script in any combinations.
Go to "ADD-ON STORE" on Hass.io screen and add the https://github.com/Limych/hassio-addons to "Add new repository by URL".
After that Limych's add-ons should show under the title: Limych's Hass.io Add-ons
The installation of this add-on is pretty straightforward and not different in comparison to installing any other Hass.io add-on.
- Search for the "Bluetooth Presence Monitor" add-on in the group "Limych's Hass.io Add-ons" in the Hass.io add-on store and install it.
- Configure the add-on. Especially MQTT username and password options.
- Start the "Bluetooth Presence Monitor" add-on.
- Check the logs of the "Bluetooth Presence Monitor" add-on to see if everything went well.
* * *
I put a lot of work into making this repo and component available and updated to inspire and help others! I will be glad to receive thanks from you — it will give me new strength and add enthusiasm:
or support via Bitcoin or Etherium:
16yfCfz9dZ8y8yuSwBFVfiAa3CNYdMh7Ts
Note: Remember to restart the add-on when the configuration is changed.
Bluetooth Presence Monitor Hass.io add-on configuration:
{
"log_level": "info",
"mqtt": {
"broker": "127.0.0.1",
"port": 1883,
"username": "user",
"password": "secret_password",
"topic_root": "/presence",
"publisher": "",
"certfile": "",
"version": ""
},
"known": {
"beacons": [
"00:00:00:00:00:00 nickname",
"00:00:00:00:00:01 other_nickname"
],
"static": [
"00:00:00:00:00:02",
"00:00:00:00:00:03 alias"
]
},
"blacklist": [
"00:00:00:00:00:04"
],
"extra_arguments": "-a -x -b -tdr"
}
Note: This is just an example, don't copy and paste it! Create your own!
The log_level
option controls the level of log output by the addon and can be changed to be more or less verbose, which might be useful when you are dealing with an unknown issue. Possible values are:
trace
: Show every detail, like all called internal functions.debug
: Shows detailed debug information.info
: Normal (usually) interesting events.warning
: Exceptional occurrences that are not errors.error
: Runtime errors that do not require immediate action.fatal
: Something went terribly wrong. Add-on becomes unusable.
Please note that each level automatically includes log messages from a more severe level, e.g., debug
also shows info
messages. By default, the log_level
is set to info
, which is the recommended setting unless you are troubleshooting.
The following options are only for the option group: mqtt
. They determine the settings for connecting to the MQTT-server.
This option allows you to change hostname or IP-address of MQTT-server to which add-on connect.
Default value: "127.0.0.1" (same device)
Note: If you use official Hass.io "Mosquitto broker" add-on or Community Hass.io "MQTT Server & Web client" add-on you don't need to change it.
This option allows you to change port of MQTT-server to which add-on connect.
Default value: 1883
Note: If you use official Hass.io "Mosquitto broker" add-on or Community Hass.io "MQTT Server & Web client" add-on with default ports settings you don't need to change it.
This option allows you to set the username which add-on use to connect to MQTT-server.
Default value: "" (empty)
This option allows you to set the password which add-on use to connect to MQTT-server.
Default value: "" (empty)
This option allows you to change the root of MQTT topics branch the Bluetooth Presence Monitor will publish data to.
Default value: "presence"
Note: If you have already configured presence monitors installed without this addon perhaps you need to change topic_root
to "monitor".
This option allows you to change publisher identity of this Bluetooth Presence Monitor. Only this value allows you to distinguish one monitor instance from another one.
Default value: "" (empty)
Note: If this field is empty (default value), the system will automatically substitute the hostname of the host device. This is usually "hassio".
Default value: "" (empty)
Default value: "" (empty)
* * *
I put a lot of work into making this repo and component available and updated to inspire and help others! I will be glad to receive thanks from you — it will give me new strength and add enthusiasm:
or support via Bitcoin or Etherium:
16yfCfz9dZ8y8yuSwBFVfiAa3CNYdMh7Ts
The following options are only for the option group: known
. They determine the unique ID's (MAC-addresses) of devices which you want to monitor.
MAC-address format: "XX:XX:XX:XX:XX:XX" Where each X is a hexadecimal digit (0-9A-F)
This option allow you to set list of MAC-addresses of iBeacons and similar devices which use a little different protocol. Each device must be described in a separate list item.
Items format: "{MAC-address} {nickname of device}"
Note: Nicknames are required.
This option allow you to set list of MAC-addresses of common devices. Each device must be described in a separate list item.
Items format: "{MAC-address} {alias of device}"
Note: Aliases are optional. If no alias is specified, the Presence Monitor will name the device by its MAC-address.
This option allow you to set list of MAC-addresses of devices you don't want to monitor. Each device must be described in a separate list item.
Items format: "{MAC-address}"
Extra options to pass to presence monitor script. There are list of useful arguments for current version of script:
-R redact private information from logs
-S silent operation (no logging)
-c addr create connection to bluetooth device
-C clean retained messages from MQTT broker
-E report scan status messages:
[topic path]/scan/[arrive|depart]/[start|end]
-s report all mqtt messages to a single topic with
$mqtt_topicpath/$mqtt_publisher_identity (defined in MQTT preferences file)
-f format MQTT topics with only letters and numbers
-a report all known device scan results, not just changes
-x retain mqtt status messages
-b report bluetooth beacons (e.g., generic beacons, ibeacons, and so on)
-t[adr] scan for known devices only on mqtt trigger messages:
a $mqtt_topicpath/scan/ARRIVE (defined in MQTT preferences file)
d $mqtt_topicpath/scan/DEPART (defined in MQTT preferences file)
r send ARRIVE or DEPART messages to trigger other devices to scan
Note: The -b
option is adding automatically then you have one or more IDs in known.beacons
section.
This repository keeps a change log using GitHub's releases functionality. The format of the log is based on Keep a Changelog.
Releases are based on Semantic Versioning, and use the format
of MAJOR.MINOR.PATCH
. In a nutshell, the version will be incremented
based on the following:
MAJOR
: Incompatible or major changes.MINOR
: Backwards-compatible new features and enhancements.PATCH
: Backwards-compatible bugfixes and package updates.
This is an active open-source project. We are always open to people who want to use the code or contribute to it.
We have set up a separate document containing our contribution guidelines.
Thank you for being involved! 😍
The original setup of this repository is by Andrey "Limych" Khrolenok.
For a full list of all authors and contributors, check the contributor's page.
MIT License
Copyright (c) 2019 Andrey "Limych" Khrolenok
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.