Skip to content
This repository has been archived by the owner on Oct 30, 2019. It is now read-only.

Add install script for the Bluetooth monitor script #195

Merged
merged 5 commits into from
Oct 23, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ below for usage and instructions.
- [HUE](/docs/hue.md)
- [LibCEC](/docs/libcec.md)
- [MariaDB](/docs/mariadb.md)
- [Monitor](/docs/monitor.md)
- [Mosquitto](/docs/mosquitto.md)
- [PostgreSQL](/docs/postgresql.md)
- [MS SQL](/docs/mssql.md)
Expand Down
41 changes: 41 additions & 0 deletions docs/monitor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Monitor

This script installs the Monitor script by [andrewjfreyer][andrewjfreyer].
TL;DR: Bluetooth-based passive presence detection of beacons, cell phones, and any other bluetooth device. The system is useful for mqtt-based home automation.
This script requires that the Mosquitto suite is already installed.
After mqtt setting will need to be set configured and some customisation is required. Instructions can be found [here](https://github.com/andrewjfreyer/monitor#getting-started)

## Installation

```bash
sudo hassbian-config install monitor
```

## Upgrade

No script available, maybe you could write one?
If so, add an PR here when you are done:
[homeassistant/hassbian-scripts][repo]

## Additional info

Description | Command/value
:--- | :---
Running as: | root
Configuration file: | /opt/monitor/address_blacklist
Configuration file: | /opt/monitor/known_beacon_addresses
Configuration file: | /opt/monitor/known_static_addresses
Configuration file: | /opt/monitor/mqtt_preferences
Start service: | `sudo systemctl start monitor.service`
Stop service: | `sudo systemctl stop monitor.service`
Restart service: | `sudo systemctl restart monitor.service`
Service status: | `sudo systemctl status monitor.service`

***

This install script was originally contributed by [@Landrash][landrash]

<!--- Links --->
[andrewjfreyer]: https://github.com/andrewjfreyer
[landrash]: https://github.com/landrash
[repo]: https://github.com/home-assistant/hassbian-scripts/pulls
61 changes: 61 additions & 0 deletions package/opt/hassbian/suites/monitor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash
function monitor-show-short-info {
echo "Setup for Monitor. Bluetooth-based passive presence detection."
}

function monitor-show-long-info {
echo "This script installs Monitor a script for Bluetooth-based passive presence detection."
echo "The Mosquitto suite will also be installed since it's a dependency for Monitor."
echo "This script also installs a service that can be enabled to run Monitor."
}

function monitor-show-copyright-info {
echo "Original concept by Landrash <https://github.com/landrash>."
}

function monitor-install-package {
echo -n "Installing Mosquitto package: "

echo "Checking the installation..."
validation=$(pgrep -f mosquitto)
if [ ! -z "${validation}" ]; then
echo "Existing Mosquitto install detected. Skipping install of Mosquitto."
else
echo "Installing Mosquitto"
sudo hassbian-config install mosquitto
Landrash marked this conversation as resolved.
Show resolved Hide resolved
fi

echo "Creating Monitor folder..."
mkdir /opt/monitor || exit
cd /opt || exit

echo "Cloning Monitor git repository"
git clone git://github.com/andrewjfreyer/monitor

echo "Running interactive setup"
cd /opt/monitor || exit
sudo bash /opt/monitor/monitor.sh
Landrash marked this conversation as resolved.
Show resolved Hide resolved

echo "Checking the installation..."
if [ ! -f /opt/monitor/monitor.sh ]; then
validation=""
else
validation="ok"
fi

if [ ! -z "${validation}" ]; then
echo
echo -e "\\e[32mInstallation done..\\e[0m"
echo -e "Update of mqtt_preferences is required found at /opt/monitor/mqtt_prefences"
echo -e "Some further configuration is required and details can be found here https://github.com/andrewjfreyer/monitor#getting-started "
echo
else
echo
echo -e "\\e[31mInstallation failed..."
echo
return 1
fi
return 0
}

[[ "$_" == "$0" ]] && echo "hassbian-config helper script; do not run directly, use hassbian-config instead"