Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
psmsmets committed Nov 11, 2021
1 parent d23aa4f commit 14e6a5e
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 25 deletions.
57 changes: 43 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,57 @@ If you don't know your home id the field can be left blank. The script will get
Usage: thermmode-unifi.sh <config_file>
Options:
-C, --config Print a demo <config_file> with all variables
-C, --config Print a demo configuration file with all variables
-h, --help Print help
-v, --verbose Make the operation more talkative
-V, --version Show version number and quit
```

Define all of the following variables either in a configuration file or as environment variables
Complete all of the following variables either in a configuration file or as environment variables
```
# UniFi controller configuration
UNIFI_ADDRESS = https://url_or_ip_of_your_controller
### thermmode-unifi configuration file.
# The commented out lines are the configuration field and the default value used.
###
### UniFi controller configuration
###
# UniFi controller address
UNIFI_ADDRESS = "https://url_or_ip_of_your_controller"
# UniFi sitename.
# UNIFI_SITENAME = "default"
# UniFi controller username and password (preferably a local account with read-only rights)
UNIFI_USERNAME = ...
UNIFI_PASSWORD = ...
UNIFI_SITENAME = default # default value and optional
UNIFI_CLIENTS = aa:aa:aa:aa:aa:aa bb:bb:bb:bb:bb:bb cc:cc:cc:cc:cc:cc # List mac addresses (space separated)
UNIFI_CLIENT_OFFLINE_SECONDS = 900 # default value and optional
# Netatmo connect configuration
NETATMO_CLIENT_ID =
NETATMO_CLIENT_SECRET =
NETATMO_USERNAME =
NETATMO_PASSWORD =
NETATMO_HOME_ID =
# List of client mac addresses (space separated)
UNIFI_CLIENTS = aa:aa:aa:aa:aa:aa bb:bb:bb:bb:bb:bb cc:cc:cc:cc:cc:cc
# Clients last seen threshold to set thermmode=away
# UNIFI_CLIENTS_OFFLINE_SECONDS = 900
###
### Netatmo connect configuration
###
# A personal netatmo connect app registered to your username is required.
# Create your app at https://dev.netatmo.com/apps.
# The app is needed for authentication to obtain an Oauth2 Bearer token from
# your username and password.
# Netatmo connect app technical parameters: client id and secret.
NETATMO_CLIENT_ID = ...
NETATMO_CLIENT_SECRET = ...
# Netatmo username and password
NETATMO_USERNAME = ...
NETATMO_PASSWORD = ...
# Netamo home id (optional, defaults to the first of your homes)
# NETATMO_HOME_ID = ...
```

Missing variables from the configuration file are assumed to be set in your shell (locally or as enviroment variables).
Expand Down
51 changes: 40 additions & 11 deletions thermmode-unifi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function usage {
"Usage: $SCRIPT <config_file>"
""
"Options:"
" -C, --config Print a demo <config_file> with all variables"
" -C, --config Print a demo configuration file with all variables"
" -h, --help Print help"
" -v, --verbose Make the operation more talkative"
" -V, --version Show version number and quit"
Expand Down Expand Up @@ -86,20 +86,49 @@ function config
# Message to display for version.
#
local txt=(
"# UniFi controller configuration"
"UNIFI_ADDRESS = https://url_or_ip_of_your_controller"
"### thermmode-unifi configuration file."
""
"# The commented out lines are the configuration field and the default value used."
""
"###"
"### UniFi controller configuration"
"###"
""
"# UniFi controller address"
"UNIFI_ADDRESS = https://url_or_ip_of_your_controller"
""
"# UniFi sitename."
"# UNIFI_SITENAME = default"
""
"# UniFi controller username and password (preferably a local account with read-only rights)"
"UNIFI_USERNAME = ..."
"UNIFI_PASSWORD = ..."
"UNIFI_SITENAME = default # default value and optional"
"UNIFI_CLIENTS = aa:aa:aa:aa:aa:aa bb:bb:bb:bb:bb:bb cc:cc:cc:cc:cc:cc # List mac addresses (space separated)"
"UNIFI_CLIENT_OFFLINE_SECONDS = 900 # default value and optional"
""
"# Netatmo connect configuration"
"NETATMO_CLIENT_ID = ..."
"# List of client mac addresses (space separated)"
"UNIFI_CLIENTS = aa:aa:aa:aa:aa:aa bb:bb:bb:bb:bb:bb cc:cc:cc:cc:cc:cc"
""
"# Clients last seen threshold to set thermmode=away"
"# UNIFI_CLIENTS_OFFLINE_SECONDS = 900"
""
"###"
"### Netatmo connect configuration"
"###"
""
"# A personal netatmo connect app registered to your username is required."
"# Create your app at https://dev.netatmo.com/apps."
"# The app is needed for authentication to obtain an Oauth2 Bearer token from"
"# your username and password."
""
"# Netatmo connect app technical parameters: client id and secret."
"NETATMO_CLIENT_ID = ..."
"NETATMO_CLIENT_SECRET = ..."
"NETATMO_USERNAME = ..."
"NETATMO_PASSWORD = ..."
"NETATMO_HOME_ID = # optional"
""
"# Netatmo username and password"
"NETATMO_USERNAME = ..."
"NETATMO_PASSWORD = ..."
""
"# Netamo home id (optional, defaults to the first of your homes)"
"# NETATMO_HOME_ID = ..."
)

printf "%s\n" "${txt[@]}"
Expand Down

0 comments on commit 14e6a5e

Please sign in to comment.