GitXplorerGitXplorer
D

xbar-whos-home-unifi

public
11 stars
0 forks
1 issues

Commits

List of commits on branch main.
Unverified
90bf0f4ad2279ac43b4a70dfba076bc21cb5b099

Fix default image URLs

DDouweM committed 2 years ago
Unverified
bc56d82b0126c6cb92a7e30ae07f155eea885168

Bump version to 1.0.1

DDouweM committed 2 years ago
Unverified
1283300dacc84c5cad5aa6c431231bd3d1abc886

Consider any client with 'phone' in the (host)name a phone

DDouweM committed 2 years ago
Unverified
507cf3eb6c8a1412ea0376f7289614d5c9e2a26d

Temporarily hide Plugin Browser install instructions

DDouweM committed 2 years ago
Unverified
e6586bbfc9f85a80ee2dbc966ad7e7301c539dec

Fix screenshot width

DDouweM committed 2 years ago
Unverified
428173bd1c7821891a7da7ac1b08865ed5f235a8

Remove link to XBar Plugin Browser which doesn't work on GitHub

DDouweM committed 2 years ago

README

The README file for this repository.

XBar + UniFi = Who's Home?

XBar plugin that shows all smartphones on a UniFi network in your macOS menu bar.

Devices are grouped by WiFi access point. AP aliases can be configured to map an AP name or MAC address to a room name, or to merge different APs into one room.

Device aliases can be configured in the UniFi Network UI. Generic prefixes and suffixes are filtered out to derive the owner's name, e.g. Douwe's iPhone becomes Douwe.

Device avatars can be configured using a Gravatar email or image URL.

Optionally, you can get notified when phones connect, roam, or disconnect, either in the menu bar or via macOS notifications.

PS. To see these smartphones in your iOS Home app as well, check out Homebridge + UniFi = Occupancy.

Screenshot

Installation

Install dependencies

  • Python 3: pre-installed on macOS
  • pyunifi: pip3 install pyunifi
  • aiohttp: pip3 install aiohttp

Install whos-home-unifi

Download whos-home-unifi.1m.py and move it into your XBar plugin folder (default: ~/Library/Application Support/xbar/plugins).

Configure

  1. Open XBar Plugin Browser: any xbar menu bar item > "xbar" > "Plugin browser..."
  2. Under "Plugins", select whos-home-unifi.1m.py
  3. Configure in the panel
  4. Click "refresh the plugin"

Manual (if not found in XBar Plugin Browser)

Create whos-home-unifi.1m.py.vars.json in your XBar plugin folder (default: ~/Library/Application Support/xbar/plugins) with the following content:

{
  "VAR_CONTROLLER_HOST": "192.168.1.1",
  "VAR_CONTROLLER_PORT": 443,
  "VAR_CONTROLLER_USERNAME": "<username>",
  "VAR_CONTROLLER_PASSWORD": "<password>",
  "VAR_CONTROLLER_SSL_VERIFY": false,
  "VAR_CONTROLLER_VERSION": "UDMP-unifiOS",

  "VAR_ACCESS_POINT_ALIASES": "Dream Machine=Living;Office nanoHD=Office;Bedroom nanoHD=Bedroom;Roof FlexHD=Rooftop",

  "VAR_AVATARS": "<Name>=<Gravatar email>;<Name>=<image URL>",
  "VAR_CLOUDIMAGE_TOKEN": "",

  "VAR_MENU_BAR_EVENTS": false,
  "VAR_TERMINAL_NOTIFIER_PATH": "",
  "VAR_NOTIFY_CONNECT": true,
  "VAR_NOTIFY_ROAM": false,
  "VAR_NOTIFY_DISCONNECT": true
}

Settings

UniFi Controller

  • VAR_CONTROLLER_HOST: Host of UniFi Controller (default: "192.168.1.1")
  • VAR_CONTROLLER_USERNAME: Username for UniFi Controller (default: "admin")
  • VAR_CONTROLLER_PASSWORD: Password for UniFi Controller (default: "admin")
  • VAR_CONTROLLER_PORT: Port for UniFi Controller (default: 443)
  • VAR_CONTROLLER_VERSION: Version of UniFi Controller (options: UDMP-unifiOS, unifiOS, v5, v4; default: "UDMP-unifiOS")
  • VAR_CONTROLLER_SSL_VERIFY: Verify SSL connection to UniFi Controller (default: false)

Aliases

  • VAR_ACCESS_POINT_ALIASES: Aliases to use for access points: <Name/MAC>=<Alias>, separated by ;, e.g. Dream Machine=Living. (default: "")
  • Device aliases can be configured in the UniFi Network UI, e.g. set device name to Douwe's iPhone to show as Douwe.

Avatars

  • VAR_AVATARS: Set Gravatar emails or image URLs for devices to enable avatars: <Name>=<Email/URL>, separated by ;, e.g. Douwe=hi@douwe.me (default: "")
  • VAR_CLOUDIMAGE_TOKEN: Set Cloudimage.io token to show round avatars instead of square (default: "")

Event notifications

  • VAR_MENU_BAR_EVENTS: Show connect/roam/disconnect events in menu bar (default: false)
  • VAR_TERMINAL_NOTIFIER_PATH: Set path to terminal-notifier to show notifications for connect/roam/disconnect events (default: "")
  • VAR_NOTIFY_CONNECT: Notify when a device connects (default: true)
  • VAR_NOTIFY_ROAM: Notify when a device roams (moves) between access points (default: false)
  • VAR_NOTIFY_DISCONNECT: Notify when a device disconnects (default: true)

Debugging

  • VAR_SHOW_TEST_DEVICES: Show dummy devices for each configured avatar instead of real devices (default: false)