AutoHome is a collection of smart devices and projects that integrate and work with one-another. (In the end, that is ;p)
ServerDevice:
- State
Config-Layout /server/config.json { name: "ThuisWolk"
enabledServices: [
...serviceIds
]
interface: {
signInWithFloriswebKey,
allowedUserIds: []
}
}
Service-Layout /server/services/ServiceId
- /config.json
- /interface /interface.jsx -> exports {panel, page}
- /server /service.js -> export default: Service
Service.config.json
{
name: ""
isDeviceService: (bool) -> false, - Whether or not the services represents an external entity (for example, true: a lamp, false: )
hasUI: (bool) -> false - enables the /interface directory
wants: [...serviceIds] -> []
requires: [...serviceIds] -> []
trackDownTime: (bool) -> false
subscriptions: [...serviceIds]
/* --- Custom Properties --- */
/* --- Homebridge Config --- for integration with the HomeBridgeService*/
HBConfig: {
}
}
Client-protocol
Connecting and Authentication
-
Client starts connection to websocketserver.
-
OnConnect: Client sends auth message: {id: deviceId/serviceId, key} Special case, interfaceClient: {id: 'InterfaceClient', key: FloriswebAuthToken}
-
Server Responses InterfaceClient: {"type": "auth", "status": true} {"type": "auth", "status": false, "error": "Invalid Key"}
{error: "Parameters missing"} {error: "Invalid request"}
Message types
Push { type: (string) data: (any) serviceId }
Request Request: { requestId type: (string) data: (any) serviceId, } Response: { isResponse: true, requestId - request.requestId response: (any) - response }
Messages Default Format: { type: (string) data: (any) serviceId }
Request, extends Format: { ... requestId: (string) - internal usage }
SetStateByKey: [device -> server]
- Sets a particular key's value on the servers object.
- Request: { type: 'setStateByKey', stateKey: (string) data: (any) }
GetStateByKey: [server -> any]
- Returns a particular key's value on the servers object.
- Request: { type: 'getStateByKey', stateKey: (string) }
GetState: [server -> any]
- Returns the current state on the servers object.
- Request: { type: 'getState', }
- Return: StateUpdate
CurState: [server -> any]
- Request: { type: 'curState', data: state (any) }
servic.page.render() -> returns div.panelBox
Config.json
users: [ { id permissions: { [service]: 0: - 1: can view 2: can interact 3: can modify } } isOwner: true } ]
User Manager