Configuration - smab/playhouse-web GitHub Wiki
Overview
The configuration interface can be reach as a webpage on http://localhost:<config_port>/config
where the default port is 8081
.
There are six source files directly associated with this module, which can be found in the relevant directories:
config.py
: the main module source code, responsible for handling all requests in the configuration interfaceconfig_base.html
base template fileconfig_setup.html
template file for Setupconfig_game.html
template file for Settingsconfig_bridges.html
template file for Bridges
Configuration file
Everything under Setup and Settings can also be changed manually in config.json
.
Attributes
game_name
- name of initial game module to start (default:"default"
)game_path
- list of paths to where games can be found (default:["src/games"]
)lampdest
- address to lamp server (default:"localhost"
)lampport
- port to connect to lamp server (default:4711
)serverport
- port the game server will listen on (default:8080
)configport
- port the config server will listen on (default:8081
)stream_embedcode
- HTML string with stream embed code (default:""
)light_ssl
- set totrue
to connect to the lamp server with HTTPSlight_certfile
- only needed iflight_ssl
istrue
light_pwd
- password used to authorize with the lamp serverconfig_ssl
- whentrue
, run config interface on a HTTPS serverconfig_certfile
- only needed ifconfig_ssl
istrue
config_keyfile
- only needed ifconfig_ssl
istrue
config_pwd
- when set, password needed to access config
Configuration interface
Setup
This page contains settings for connections and external services. Some of settings may require that the server is restarted.
Connections
Status
Show the current connection status to the lamp server.Lamp server
Address to the lamp server and what port to connect to. (default:localhost:4711
)Game server port
This is the port the web server that serves the game interface will listen on. (default:8080
)Config server port
This is the port the web server that serves the configuration interface will listen on. (default:8081
)
Note: Do not use the same port for game and config or the game interface will not be able to start.
Streaming
Embed code
The content in this text area will be inserted in the game interface and is primarily for embedding a live stream player. (default: empty)
Settings
This pages is used to change game and game settings.
Changing game
All games found in the game paths is listed to the left and the current game can be changed directly by clicking on any of the listed games.
Note: Changing game paths has to be done by editing game_paths
in the config file.
Game settings
Game settings are shown on the right and will show the config template specified by config_file
in the the running game module. For more information, see the documentation on game settings for each module.
Bridges
This menu handles all the Hue bridges that are used. It lists all bridges the lightserver knows about, sorted by their MAC-address.
Identifying Selected
By selecting bridges with the checkbox, you can tell the bridge to blink all the lamps associated with this bridge by pressing the "Identify Selected" button.
Valid username
Each Hue bridge needs a username. This acts like a password so unauthorized people cannot send commands to your lamps. Each bridge in the table has a property "valid_username" which tells you if the lightserver knows about a valid username for that bridge. By clicking the property, you can tell the lightserver to generate a new username. A confirmation box will appear and you will have to physically press the link button on the bridge before accepting.
Adding bridges
You can add a new bridge by writing its IP address in the textfield and pressing "Add bridge."
Removing bridges
You can remove bridges by select them with the checkboxes and then pressing "Remove Selected."
Refresh List
A cached copy of the bridges will be saved on the webserver to decrease waiting time. If any changes happens to the bridges it will not be shown however. You can force a request for a new version by pressing the "Refresh List" button.
Search Bridges
If you know there are bridges on the same local network as the lightserver, you can have it search for them. It will do that by a broadcast message and by reading the Philips website. This search may take some time though and after about 20s you must refresh the list by pressing the "Refresh List."
Grid
This page is used to configure the lamp positions in the grid and the dimensions of the grid. The grid overview shows the positions where lamps are placed and the status of those lamps.
Color coding (interface)
white
no lamp placedblue
a lamp is placed here and no errors found (note: the lamp server can't know if a lamp is reachable or not)red
a lamp is placed here but there is no bridge with this lamp id
Color coding (lamps)
white
activated lampblue
placed lampred
removed lamp
Placing lamps
Before placing the lamps, it is recommended to first turn off any running games. It can be done directly from the grid page by clicking on the Turn Off
-button.
When you open the page, a lamp light up and then can you say which lamp was lit. This can be done either by clicking on the overview or manually enter the position and then click on Place Lamp
. Attempting to place a lamp on an occupied position will instead remove the currently placed lamp on that position and queue it for placement.
Changing size
Changing size is done by entering the dimensions as width
xheight
and then click Change Size
.
Note: This will clear the grid and because of that the Change Size
-button will be disabled to prevent loss of unsaved changes. Saving or refreshing will reenable the button.
Actions
Save
Send and use the grid on the lamp server.Refresh
Discard the local grid and request the one currently used on the lamp server.Clear
Clear the grid from placed lamps.Turn Off
Cancel any running game and turn off all lamps.Run Diagnostics
Run diagnosics to test the grid on the lamp server.
Errors
No activated lamp
there is either no more lamps available that isn't already placedInvalid position
the position were in an incorrect format and couldn't be parsed be the serverInvalid size
the size were in an incorrect format and couldn't be parsed be the serverInvalid lamp
the placed lamp is no longer valid and can't be placedSaving failed
given when the lamp server couldn't save the grid