update documentation
This commit is contained in:
parent
bfe2280d16
commit
85094b707e
@ -1,15 +1,131 @@
|
||||
# A gateway for 433 MHz devices
|
||||
It uses [rc_switch](https://github.com/sui77/rc-switch) library for controlling wall sockets.
|
||||
|
||||
It also supports receiving commands from the same protocol.
|
||||
It supports receiving:
|
||||
- serial commands for controlling wall switches - all protocols
|
||||
- RC commands from wall switches remotes - protocols 1 and 2
|
||||
- sensors states over `Protocol 2`
|
||||
|
||||
It acts as a serial gateway and it is connected to a Raspberry Pi running Home assistant.
|
||||
It acts as a serial gateway, communicating in JSON format, and it is connected to a Raspberry Pi running Home Assistant.
|
||||
|
||||
It uses an Arduino Pro Mini 5v 16 Mhz.
|
||||
The original bootloader has been replaced with Optiboot using this tutorial: https://andreasrohner.at/posts/Electronics/How-to-make-the-Watchdog-Timer-work-on-an-Arduino-Pro-Mini-by-replacing-the-bootloader/
|
||||
|
||||
## Read sensors
|
||||
## Receive RC
|
||||
### Sensors
|
||||
Sensors transmit state using `Protocol 2` and the gateway translates them into JSON over serial.
|
||||
##### Protocol structure
|
||||
```
|
||||
1001 0 110000000 0000011101011 11001
|
||||
| | | | |
|
||||
| STATE VALUE VCC ID
|
||||
TYPE
|
||||
```
|
||||
##### Sensors types
|
||||
```C++
|
||||
enum SensorType : unsigned short {
|
||||
GENERIC = 4,
|
||||
HUMIDITY = 5,
|
||||
TEMPERATURE = 6,
|
||||
CONTACT = 7
|
||||
};
|
||||
```
|
||||
##### Sensors IDs
|
||||
```C++
|
||||
enum SensorId : unsigned short {
|
||||
WINDOW1 = 1,
|
||||
WINDOW2 = 2,
|
||||
WATER_SENSOR = 3,
|
||||
TEMP_SENSOR = 4,
|
||||
LIGHT_SENSOR = 5,
|
||||
MOVEMENT_SENSOR = 6,
|
||||
OIL_SENSOR = 7
|
||||
};
|
||||
```
|
||||
#### Stairs temperature
|
||||
##### Value and volatage
|
||||
```json
|
||||
{
|
||||
"sensor": {
|
||||
"id": 4,
|
||||
"diagnostic": {
|
||||
"voltage": 2.239
|
||||
},
|
||||
"temperature": 16.2
|
||||
}
|
||||
}
|
||||
```
|
||||
##### Value only
|
||||
```json
|
||||
{
|
||||
"sensor": {
|
||||
"id": 4,
|
||||
"temperature": 16.2
|
||||
}
|
||||
}
|
||||
```
|
||||
#### Oil sensor
|
||||
##### Value and volatage
|
||||
```json
|
||||
{
|
||||
"sensor": {
|
||||
"id": 7,
|
||||
"diagnostic": {
|
||||
"voltage": 4.282
|
||||
},
|
||||
"value": 13
|
||||
}
|
||||
}
|
||||
```
|
||||
### Switches
|
||||
Gateway receives remote commands over RC Switch and translates them into JSON over serial
|
||||
#### Protocol 1
|
||||
##### on
|
||||
```json
|
||||
{
|
||||
"rcSwitch": {
|
||||
"protocol": 1,
|
||||
"state": true,
|
||||
"group": "1",
|
||||
"channel": 1,
|
||||
"raw_value": 5571921
|
||||
}
|
||||
}
|
||||
```
|
||||
##### off
|
||||
```json
|
||||
{
|
||||
"rcSwitch": {
|
||||
"protocol": 1,
|
||||
"state": false,
|
||||
"group": "1",
|
||||
"channel": 1,
|
||||
"raw_value": 5571921
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Protocol 2
|
||||
```json
|
||||
{
|
||||
"rcSwitch": {
|
||||
"protocol": 2,
|
||||
"value": 2650807673
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Other protocols
|
||||
```json
|
||||
{
|
||||
"rcSwitch": {
|
||||
"protocol": 4,
|
||||
"value": 1234567890
|
||||
}
|
||||
}
|
||||
```
|
||||
### DHT
|
||||
Reads local DHT11 sensor and outputs JSON over serial
|
||||
```
|
||||
{
|
||||
"dht11": {
|
||||
@ -18,40 +134,49 @@ The original bootloader has been replaced with Optiboot using this tutorial: htt
|
||||
}
|
||||
}
|
||||
```
|
||||
### RC Switch
|
||||
#### on
|
||||
```
|
||||
[
|
||||
{
|
||||
"rcSwitch": {
|
||||
"protocol": 1,
|
||||
"group": "00001",
|
||||
"channel": 1,
|
||||
"state": true
|
||||
}
|
||||
---
|
||||
## Receive commands
|
||||
It receives commands over serial, in JSON format, and executes them.
|
||||
#### Protocol 1
|
||||
##### on
|
||||
```json
|
||||
{
|
||||
"rcSwitch": {
|
||||
"protocol": 1,
|
||||
"group": "00001",
|
||||
"channel": 1,
|
||||
"state": true
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
#### off
|
||||
```
|
||||
[
|
||||
{
|
||||
"rcSwitch": {
|
||||
"protocol": 1,
|
||||
"group": "00001",
|
||||
"channel": 1,
|
||||
"state": false
|
||||
}
|
||||
##### off
|
||||
```json
|
||||
{
|
||||
"rcSwitch": {
|
||||
"protocol": 1,
|
||||
"group": "00001",
|
||||
"channel": 1,
|
||||
"state": false
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
```
|
||||
[
|
||||
{
|
||||
"rcSwitch": {
|
||||
"protocol": 2,
|
||||
"value": "10011110000000000001110101111001"
|
||||
}
|
||||
|
||||
#### Protocol 2
|
||||
```json
|
||||
{
|
||||
"rcSwitch": {
|
||||
"protocol": 2,
|
||||
"value": "10010110000000000001110101111001"
|
||||
}
|
||||
]
|
||||
```
|
||||
}
|
||||
```
|
||||
|
||||
#### Other protocols
|
||||
```json
|
||||
{
|
||||
"rcSwitch": {
|
||||
"protocol": 4,
|
||||
"value": "010001101001100101110100"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user