-
Notifications
You must be signed in to change notification settings - Fork 1
Message Specifications
Robert Christensen edited this page Mar 6, 2014
·
3 revisions
- Get the list of buildings, rooms, devices, drivers
- New controller detected
- Controller went away
- Controller error
- Device state changed
- Device error
- Get the state of some device variable
- Set the state of some device variable
- Get configuration
- Set configuration
- Restart daemon
Messages in general should be JSON documents that look something like this:
{
"id": "DD2297B4-6982-4804-976A-AEA868564DF3",
"type": "state_get",
"room": "D62F993B-E036-417C-948B-FEA389480984",
"device": "D62F993B-E036-417C-948B-FEA389481512",
"var": "power"
}
The id
and type
fields should appear in every message. id
is
simply a GUID that uniquely identifies a request/reply. If the
client sends a request to the server using a particular id, the server
will reply with a message using the same id. type
identifies the
kind of message this is. The allowed types are listed below.
When a browser connects the server responds with an initialization message, which looks like this:
{
"id": "DD2297B4-6982-4804-976A-AEA868564DF3",
"type": "connection",
"buildings" : [
{
"id": "8404FF80-5C7B-4BFE-BE3C-6DDF6B02C6E9",
"name": "Allbritton"
}
],
"rooms": [
{
"id": "bb8271cd726b8dfc27d10f91d41f32b1",
"belongs_to": "cc7e9b6fe3e2757deba97d8d83157515",
"class": "Room",
"attributes": {
"projector": "projector",
"volume": "extron",
"switcher": "extron",
"ir_emitter": "dvdplayer",
"computer": "pc",
"name": "004",
"mac": "00:01:2e:bc:1a:94",
"ports": [
"/dev/ttyUSB0",
"/dev/ttyUSB1"
]
}
}
],
"devices": [
{
"id": "7F9E3A55-3219-4D76-AF7C-E5632C09D7A4",
"class": "Computer",
"name": "pc",
"belongs_to": "bb8271cd726b8dfc27d10f91d41f32b1",
"controller": null,
"device": true,
"attributes": {
"state_vars": {
"reachable": {
"type": "boolean",
"editable": false,
"display_order": 1,
"state": true
}
}
},
"config": {
"ip_address": "ozymandias.class",
"mac_address": "00:19:B9:2D:93:B6"
},
"commands": {
"start": {
"action": "#<Proc:0x00000003206928@/var/roomtrol-daemon/lib/roomtrol/devices/Computer.rb:41>"
}
}
}
],
"drivers": [
{
"id": "3f68460e2bddd547d10e1f1f9e7aab9f",
"name": "ExtronVideoSwitcher",
"depends_on": "VideoSwitcher",
"description": "Controls Extron video switchers that support SIS",
"author": "Micah Wylde",
"email": "[email protected]",
"driver": true,
"config": {
"port": {
"type": "port"
},
"baud": {
"value": 9600
},
"data_bits": {
"value": 8
},
"stop_bits": {
"value": 1
},
"parity": {
"value": 0
},
"message_end": {
"value": "\r\n"
}
}
}
]
}