
cbus Documentation, Release 0.1-dev
• saged which is a backend WebSockets server that translates WebSockets messages into messages in cdbusd,
and implements some basic access controls.
• sageclient.js which implements the saged WebSockets protocol in JavaScript.
• sageui.js which implements the UI of sage itself, which is built on jQuery Mobile.
5.3.1 Running
sage requires that you have a running instance of cdbusd first.
Once running, copy the resources in cbus/sage_root into a web-accessible folder on the same computer where
you will run sage.
Note: If you are serving the files from HTTPS, you may also need a way to make sage’s WebSockets service
accessible by HTTPS (wss), due to browser security constraints. sage does not support this yet, so the sage files need
to be all served via HTTP.
Then start up the sage daemon:
$ python -m cbus.daemons.saged -H 192.0.2.1 -W
Where 192.0.2.1 is your server’s LAN IP address. This will run a WebSockets server on port 8080.
Note: Don’t expose sage to the internet. Anyone on the internet will be able to use sage if you do this. Always use a
VPN to access sage remotely.
You then need to create a project file called project.json in your sage_root folder. This file is in JSON format.
As an example:
{
"saged": "ws://192.0.2.1:8080/",
"locations": {
"0": "Living Areas",
"1": "Bedrooms",
"2": "Outside"
},
"widgets": {
"1": {
"name": "Kitchen",
"type": "switch",
"locations": {"0": 1}
},
"2": {
"name": "Patio",
"type": "switch",
"locations": {"0": 100, "2": 1}
}
}
}
The important elements of the configuration are:
• saged: The URI of the WebSockets server. When running saged without the -W option (in standalone mode),
the WebSockets server listens on /saged, not the root path..
22 Chapter 5. daemons
Kommentare zu diesen Handbüchern