Skip to main content

huunifie

A Hue bridge and Unifi controller client. Enables/disables specified Hue schedules in the presence/absence of specified wifi devices on the Unifi controller.

Installation

huunifie can be installed with the following command:

python3 -m pip install huunifie

Compatibility information

This code was only tested with python 3.5 and above under GNU/Linux with a Unify controller 5.9.29 and a hue bridge API version 1.28.0.

Usage

you@computer:~$ python3 -m huunifie --help
usage: huunifie.py [-h] [-uh UNIFI_HOST] [-up UNIFI_PORT] [-uu UNIFI_USERNAME]
                   [-uw UNIFI_PASSWORD] [-hh HUE_HOST] [-hp HUE_PORT]
                   [-hk HUE_KEY] [-wc WIFI_CLIENTS [WIFI_CLIENTS ...]]
                   [-sn SCHEDULES_NAMES [SCHEDULES_NAMES ...]] [-i INTERVAL]
                   [-c CONFIG_FILE] [-s] [-v] [-d] [-l LOG_FILE]
                   [-sh SYSLOG_HOST] [-sp SYSLOG_PORT]

A Hue bridge and Unifi controller client. Enables/disables specified Hue
schedules in the presence/absence of specified wifi devices on the Unifi
controller.

optional arguments:
  -h, --help            show this help message and exit
  -uh UNIFI_HOST, --unifi_host UNIFI_HOST
                        Unifi controller hostname (default: None)
  -up UNIFI_PORT, --unifi_port UNIFI_PORT
                        Unifi controller port (default: None)
  -uu UNIFI_USERNAME, --unifi_username UNIFI_USERNAME
                        Unifi controller username (default: None)
  -uw UNIFI_PASSWORD, --unifi_password UNIFI_PASSWORD
                        Unifi controller password (default: None)
  -hh HUE_HOST, --hue_host HUE_HOST
                        Hue hub hostname (default: None)
  -hp HUE_PORT, --hue_port HUE_PORT
                        Hue hub port (default: None)
  -hk HUE_KEY, --hue_key HUE_KEY
                        Hue hub API key (default: None)
  --no_pub              Disables zmq publication
  --pub                 Enables zmq publication
  --pub_host PUB_HOST   Host for zmq publication (default: *)
  --pub_port PUB_PORT   Port for zmq publication (default: 12168)
  -wc WIFI_CLIENTS [WIFI_CLIENTS ...], --wifi_clients WIFI_CLIENTS [WIFI_CLIENTS ...]
                        Wifi clients (hostname or mac) to monitor. Clients
                        names are separated by spaces. (default: None)
  -sn SCHEDULES_NAMES [SCHEDULES_NAMES ...], --schedules_names SCHEDULES_NAMES [SCHEDULES_NAMES ...]
                        Schedules to respectively enable/disable based on the
                        wifi clients presence/absence. Schedule names with
                        space(s) to be double-quoted. Schedule names are
                        separated by spaces. (default: None)
  -i INTERVAL, --interval INTERVAL
                        Polling interval (default: None)
  -c CONFIG_FILE, --config_file CONFIG_FILE
                        Path to configuration file. A template can be created
                        by using the -s option below. (default:
                        ~/.config/huunifie.conf)
  -s, --save_config     Safe configuration given on the command line to the
                        configuration file. (default: False)
  -v, --verbose         Prints events information on the console. (default:
                        False)
  -d, --debug           Verbose mode. (default: False)
  -l LOG_FILE, --log_file LOG_FILE
                        Path to log file. (default: None)
  -sh SYSLOG_HOST, --syslog_host SYSLOG_HOST
                        Syslog hostname. If present, the logfile is not
                        written locally (default: None)
  -sp SYSLOG_PORT, --syslog_port SYSLOG_PORT
                        Syslog port. (default: 514)

A Hue bridge and Unifi controller client. Enables/disables specified Hue
schedules in the presence/absence of specified wifi devices on the Unifi
controller.

Configuration

You can create a template configuration file by running huunifie with only the -s flag.

You can also test values on one or more different arguments then, adding -s to update your configuration. Only values specified on the command line will be update in the config file.

Examples:

  • Create a config file:
you@computer:~$ python3 -m huunifie -s -v -c /tmp/test_huunifie.conf
2018-12-10 21:55:38 [WARNING] : Configuration file /tmp/test_huunifie.conf not found.
2018-12-10 21:55:38 [   INFO] : Configuration saved to /tmp/test_huunifie.conf
2018-12-10 21:55:38 [  ERROR] : Unable to connect to the Unifi controller using https://localhost:8443
^C
you@computer:~$  cat /tmp/test_huunifie.conf
[general]
interval = 3
wifi_clients = 01:23:45:67:89:ab,your_device_hostname
schedules_name = A schedule name with spaces,another_without

[unifi]
host = localhost
port = 8443
username = hue
password = hue_password!!

[hue]
host = hue
port = 80
key = Your_40_alphanumeric_hue_api_key_please.
  • Update an existing config file
you@computer:~$ python3 -m huunifie -hh hue -uh unifi -v -s -c /tmp/test_huunifie.conf
2018-12-10 21:59:06 [   INFO] : Configuration loaded from /tmp/test_huunifie.conf
2018-12-10 21:59:06 [   INFO] : Configuration saved to /tmp/test_huunifie.conf
2018-12-10 21:59:06 [  ERROR] : Unable to connect to the Unifi controller using https://unifi:8443
^C
you@computer:~$ cat /tmp/test_huunifie.conf
[general]
interval = 3
wifi_clients = 01:23:45:67:89:ab,your_device_hostname
schedules_name = A schedule name with spaces,another_without

[unifi]
host = unifi
port = 8443
username = hue
password = hue_password!!

[hue]
host = hue
port = 80
key = Your_40_alphanumeric_hue_api_key_please.

Metadata

Release files for huunifie 0.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for huunifie 0.4.3
File Size Uploaded Provenance Actions
huunifie-0.4.3.tar.gz 7.2 kB Without provenance Details for huunifie-0.4.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for huunifie 0.4.3
File Interpreter ABI Platform Actions
huunifie-0.4.3-py3-none-any.whl Python 3 none any Details for huunifie-0.4.3-py3-none-any.whl

Total release size: 15.4 kB

Release files / huunifie-0.4.3.tar.gz

Download URL huunifie-0.4.3.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
34f08c39a1ef3a5a5fcffc20043f562ed3a3fd4eefb053fb838779621483a284
BLAKE2b-256 checksum
How to use checksums
df019ef58a0dc74b9d482da4f5f38c33a8f2aaee3a2a4cff4f438edb39f41b62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.6.9

Release files / huunifie-0.4.3-py3-none-any.whl

Download URL huunifie-0.4.3-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
adf2198df6d8fdd051f3da384e1e2b04a919111134d36730f43489311f2bb1c8
BLAKE2b-256 checksum
How to use checksums
6752d06d5c2461164e363d13e3ca5d4990c45337e345cc7f030ded0e1e667e8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.6.9

Security for huunifie 0.4.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page