Merge branch 're-organize'
This commit is contained in:
commit
9141c0478c
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.fzz filter=lfs diff=lfs merge=lfs -text
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
.pio/
|
||||
.vscode/
|
||||
credentials.h
|
||||
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
||||
[submodule "libraries/RF24"]
|
||||
path = libraries/RF24
|
||||
url = https://git.hodos.ro/3rd_party/RF24.git
|
||||
187
README.md
187
README.md
@ -1,10 +1,183 @@
|
||||
# Gateway & sensors
|
||||
# A gateway for 433 MHz devices
|
||||
It uses [rc_switch](https://github.com/sui77/rc-switch) library for controlling wall sockets.
|
||||
|
||||
## Branches
|
||||
Each sensor has a dedicated branch. E.g.:
|
||||
* temp_sensor
|
||||
* oil_sensor
|
||||
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`
|
||||
|
||||
The gateway uses `master` as the main branch. Other sensors' branches get merged once they are ready for production.
|
||||
It acts as a serial gateway, communicating in JSON format, and it is connected to a Raspberry Pi running Home Assistant.
|
||||
|
||||
## Release flow
|
||||
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/
|
||||
|
||||
## Receive RC
|
||||
### Sensors
|
||||
Sensors transmit state using `Protocol 2` and the gateway translates them into JSON over serial.
|
||||
##### Protocol structure
|
||||
```
|
||||
STATE
|
||||
|
|
||||
1010|1|101010101|1010101010101|10101
|
||||
----|-----------|-------------|-----
|
||||
TYPE| VALUE | VCC | ID
|
||||
```
|
||||
##### 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 voltage
|
||||
```json
|
||||
{
|
||||
"sensor": {
|
||||
"id": 4,
|
||||
"diagnostic": {
|
||||
"voltage": 2.239
|
||||
},
|
||||
"temperature": 16.2
|
||||
}
|
||||
}
|
||||
```
|
||||
##### Value only
|
||||
```json
|
||||
{
|
||||
"sensor": {
|
||||
"id": 4,
|
||||
"temperature": 16.2
|
||||
}
|
||||
}
|
||||
```
|
||||
#### Oil sensor
|
||||
##### Value and voltage
|
||||
```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": {
|
||||
"temperature": 31.9,
|
||||
"humidity": 45
|
||||
}
|
||||
}
|
||||
```
|
||||
---
|
||||
## 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
|
||||
```json
|
||||
{
|
||||
"rcSwitch": {
|
||||
"protocol": 1,
|
||||
"group": "00001",
|
||||
"channel": 1,
|
||||
"state": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Protocol 2
|
||||
```json
|
||||
{
|
||||
"rcSwitch": {
|
||||
"protocol": 2,
|
||||
"value": "10010110000000000001110101111001"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Other protocols
|
||||
```json
|
||||
{
|
||||
"rcSwitch": {
|
||||
"protocol": 4,
|
||||
"value": "010001101001100101110100"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
10
devices/README.md
Normal file
10
devices/README.md
Normal file
@ -0,0 +1,10 @@
|
||||
# Gateway & sensors
|
||||
|
||||
## Branches
|
||||
Each sensor has a dedicated branch. E.g.:
|
||||
* temp_sensor
|
||||
* oil_sensor
|
||||
|
||||
The gateway uses `master` as the main branch. Other sensors' branches get merged once they are ready for production.
|
||||
|
||||
## Release flow
|
||||
BIN
devices/oil_sensor/docs/oil_sensor.fzz
(Stored with Git LFS)
Normal file
BIN
devices/oil_sensor/docs/oil_sensor.fzz
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
devices/oil_sensor/docs/oil_sensor_bb.png
(Stored with Git LFS)
Normal file
BIN
devices/oil_sensor/docs/oil_sensor_bb.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -14,7 +14,7 @@ board = attiny85
|
||||
framework = arduino
|
||||
build_src_filter = +<switch.cpp>
|
||||
lib_extra_dirs =
|
||||
../libraries
|
||||
../../lib
|
||||
upload_protocol = stk500v1
|
||||
upload_flags =
|
||||
-P$UPLOAD_PORT
|
||||
@ -31,4 +31,4 @@ lib_deps =
|
||||
teckel12/NewPing@^1.9.4
|
||||
sui77/rc-switch @ ^2.6.4
|
||||
lib_extra_dirs =
|
||||
../libraries
|
||||
../../lib
|
||||
BIN
devices/temp_sensor/docs/temp_sensor.fzz
(Stored with Git LFS)
Normal file
BIN
devices/temp_sensor/docs/temp_sensor.fzz
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
devices/temp_sensor/docs/temp_sensor_bb.png
(Stored with Git LFS)
Normal file
BIN
devices/temp_sensor/docs/temp_sensor_bb.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -17,7 +17,7 @@ lib_deps =
|
||||
adafruit/DHT sensor library@^1.4.3
|
||||
sui77/rc-switch @ ^2.6.4
|
||||
lib_extra_dirs =
|
||||
../libraries
|
||||
../../lib
|
||||
build_flags = -D DHT_SENSOR=0
|
||||
upload_protocol = stk500v1
|
||||
upload_flags =
|
||||
BIN
devices/window1/wiki/breadboard.png
(Stored with Git LFS)
Normal file
BIN
devices/window1/wiki/breadboard.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
devices/window1/wiki/schema.png
(Stored with Git LFS)
Normal file
BIN
devices/window1/wiki/schema.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
devices/window1/wiki/window1.fzz
(Stored with Git LFS)
Normal file
BIN
devices/window1/wiki/window1.fzz
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
devices/window2/wiki/breadboard.png
(Stored with Git LFS)
Normal file
BIN
devices/window2/wiki/breadboard.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
devices/window2/wiki/schema.png
(Stored with Git LFS)
Normal file
BIN
devices/window2/wiki/schema.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
devices/window2/wiki/window2.fzz
(Stored with Git LFS)
Normal file
BIN
devices/window2/wiki/window2.fzz
(Stored with Git LFS)
Normal file
Binary file not shown.
1
gateway/.gitignore
vendored
1
gateway/.gitignore
vendored
@ -1 +0,0 @@
|
||||
include/credentials.h
|
||||
@ -1,183 +0,0 @@
|
||||
# A gateway for 433 MHz devices
|
||||
It uses [rc_switch](https://github.com/sui77/rc-switch) library for controlling wall sockets.
|
||||
|
||||
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, 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/
|
||||
|
||||
## Receive RC
|
||||
### Sensors
|
||||
Sensors transmit state using `Protocol 2` and the gateway translates them into JSON over serial.
|
||||
##### Protocol structure
|
||||
```
|
||||
STATE
|
||||
|
|
||||
1010|1|101010101|1010101010101|10101
|
||||
----|-----------|-------------|-----
|
||||
TYPE| VALUE | VCC | ID
|
||||
```
|
||||
##### 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 voltage
|
||||
```json
|
||||
{
|
||||
"sensor": {
|
||||
"id": 4,
|
||||
"diagnostic": {
|
||||
"voltage": 2.239
|
||||
},
|
||||
"temperature": 16.2
|
||||
}
|
||||
}
|
||||
```
|
||||
##### Value only
|
||||
```json
|
||||
{
|
||||
"sensor": {
|
||||
"id": 4,
|
||||
"temperature": 16.2
|
||||
}
|
||||
}
|
||||
```
|
||||
#### Oil sensor
|
||||
##### Value and voltage
|
||||
```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": {
|
||||
"temperature": 31.9,
|
||||
"humidity": 45
|
||||
}
|
||||
}
|
||||
```
|
||||
---
|
||||
## 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
|
||||
```json
|
||||
{
|
||||
"rcSwitch": {
|
||||
"protocol": 1,
|
||||
"group": "00001",
|
||||
"channel": 1,
|
||||
"state": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Protocol 2
|
||||
```json
|
||||
{
|
||||
"rcSwitch": {
|
||||
"protocol": 2,
|
||||
"value": "10010110000000000001110101111001"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Other protocols
|
||||
```json
|
||||
{
|
||||
"rcSwitch": {
|
||||
"protocol": 4,
|
||||
"value": "010001101001100101110100"
|
||||
}
|
||||
}
|
||||
```
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user