When a controller get connected to server, it may send its type and uuid.
# Controller
{ "type": "controller", "uuid": "jac2345" }
Then it sends a status message, that will be re-sended on every change.
It consists of a list of gadgets, with its parameters and states. Its sent after handshake and on any change.
# Controller
[
{
"sensor": "true",
"relay": "true",
"mode": "serial",
"theme": "heater"
},
{
"sensor": "false",
"relay": "true",
"mode": "paralel",
"theme": "light"
}
]
Check controller’s configuration section to better understanding these parameters.
Clients may send only its type. It receives back status from all controllers at once.
# Client
{ "type": "client" }
Server may answer with status from all controllers.
Clients receives a status report after handshake and after each change on any device. It maps lists of gadgets andressed by its respective controller uuid.
# Server
{
"j324u": [
{
"sensor": "true",
"relay": "true",
"mode": "serial",
"theme": "heater"
},
{
"sensor": "false",
"relay": "true",
"mode": "paralel",
"theme": "light"
}
],
"r123a": [
// All its gadgets
],
...
}
When a gadget button is pressed, client sends a signal to lock or unlock that gadget’s Write Pin. Some commands may need an argument. They may be included as following:
{
"uuid": "mycontroller",
"command": "tap",
"gadget": "1"
}
Server may send only command and args to the right controller:
{
"command": "tap",
"gadget": "1"
}
| Command | Description | | :——–: | :———- | | reboot | Reboot Device | | reload | Restart Shuei Daemon | | upgrade | Upgrade Daemon Version | | setstate | Set GPIO pin with “1” or “0” | | tap | Invert relay state |