View on GitHub

HomeAutomation

Home server for raspberry pi controlled by Alexa, Google assistant, UWP and Android app.

Home automation with Raspberry Pi

Protocol

Request Types:

  1. connection 01
    • connect 00
  2. rooms 02
    • create 00
    • get all 01
    • get description 02
    • rename room 03
    • delete room 04

Common response codes:

  1. wrong crc FF 01
  2. not connected FF 02
  3. transaction required FF 03
  4. unknown command FF 04
  5. corrupt data FF 05
  6. not supported protocol version FF 06

Commands (no connect required)

request

protocol version (1 byte) request type (4 byte) data length (ushort) data (data length bytes) crc (2 byte)

sample (00 01 00 00 00 00 00 AF FE)

response

protocol version (1 byte) request type (4 byte) data length (ushort) response code (2 byte) data (data length bytes) crc (2 byte)

sample (00 01 00 00 00 06 00 00 00 | AA BB CC DD | AF FE)

Commands (connect required)

request

protocol version (1 byte) request type (4 byte) data length (ushort) connection identifier (4 byte) data (data length bytes - 4 for connection identifier) crc (2 byte)

sample (00 02 01 00 00 04 00 | CC CC CC CC | AF FE)

response

protocol version (1 byte) request type (4 byte) data length (ushort) response code (2 byte) connection identifier (4 byte) data (data length bytes - 4 for connection identifier) crc (2 byte)

sample (00 02 01 00 00 18 00 00 00 | CC CC CC CC | 10 00 AA BB CC DD 11 00 22 33 44 55 66 77 99 88 77 66 | AF FE)

Connection

connect

request

00 01 00 00 00 00 00 AF FE

response (data: connection identifier)

00 01 00 00 00 06 00 00 00 | CC CC CC CC | AF FE

repsonse codes

disconnect

request

00 01 02 00 00 04 00 | CC CC CC CC | AF FE

response

00 01 02 00 00 06 00 00 00 | CC CC CC CC | AF FE

repsonse codes

transaction

begin

request

00 01 01 00 00 04 00 | CC CC CC CC | AF FE

response

00 01 01 00 00 06 00 00 00 | CC CC CC CC | AF FE

repsonse codes

commit

request

00 01 01 01 00 04 00 | CC CC CC CC | AF FE

response

00 01 01 01 00 06 00 00 00 | CC CC CC CC | AF FE

repsonse codes

rollback

request

00 01 01 02 00 04 00 | CC CC CC CC | AF FE

response (data: connection identifier)

00 01 01 02 00 06 00 00 00 | CC CC CC CC | AF FE

repsonse codes

Rooms

create room

request (data: 1 byte client room identification + living room)

00 02 00 00 00 1D 00 | CC CC CC CC | 0A 16 00 6C 00 69 00 76 00 69 00 6E 00 67 00 20 00 72 00 6F 00 6F 00 6D 00 | AF FE

respone (data: 1 byte client room identification + unique room identifier if response code is 00 00)

00 02 00 00 00 0B 00 00 00 | CC CC CC CC | 0A AA BB CC DD | AF FE

repsonse codes

get all rooms

request

00 02 01 00 00 04 00 | CC CC CC CC | AF FE

respone (data: gets 4 unique identifier, for each room one identifier if response code is 00 00)

00 02 01 00 00 18 00 00 00 | CC CC CC CC | 04 00 AA BB CC DD 11 00 22 33 44 55 66 77 99 88 77 66 | AF FE

repsonse codes

get room description

request (data: unique room identifier)

00 02 02 00 00 08 00 | CC CC CC CC | AA BB CC DD | AF FE

respone (data: get room identifier and decription if response code is 00 00)

00 02 02 00 00 22 00 00 00 | CC CC CC CC | AA BB CC DD 16 00 6C 00 69 00 76 00 69 00 6E 00 67 00 20 00 72 00 6F 00 6F 00 6D 00 | AF FE

repsonse codes

rename room

request (data: unique room identifier, living room)

00 02 03 00 00 20 00 | CC CC CC CC | AA BB CC DD 16 00 6C 00 69 00 76 00 69 00 6E 00 67 00 20 00 72 00 6F 00 6F 00 6D 00 | AF FE

respone

00 02 03 00 00 06 00 00 00 | CC CC CC CC | AF FE

repsonse codes

delete room

request (data: unique room identifier)

00 02 04 00 00 08 00 | CC CC CC CC | AA BB CC DD | AF FE

respone (data: unique room identifier)

00 02 04 00 00 0A 00 00 00 | CC CC CC CC | AA BB CC DD | AF FE

repsonse codes