-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for ShellyBLU Wall Switch4 and RC Button4 devices (#564)
* Add support for ShellyBLU Wall Switch4 and RC Button4 devices - Added documentation for ShellyBLU Wall Switch4 (SBBT-004CEU) and RC Button4 (SBBT-004CUS). - Included JSON definitions and properties for SBBT-004CEU and SBBT-004CUS devices. - Updated `devices.h` and `decoder.h` to include new device models and their encrypted versions. - Added test cases for ShellyBLU RC Button4 in `test_ble.cpp`. * Fix unit tests for SBBT_002C functionality in test_ble.cpp * Fix unit tests in test_ble.cpp * Fix unit tests in test_ble.cpp * Fix unit tests for SBBT_002C functionality in test_ble.cpp * Fix unit tests for SBBT_002C functionality in test_ble.cpp * Update device JSON configurations and properties - Modify `SBBT_004CEU_json.h` to update the model name from "SBBT-004CEU" to "SBBT-EU". - Modify `SBBT_004CUS_json.h` to update the model name from "SBBT-US76d2" to "SBBT-US". - Modify `SBBT_004CEU_ENCR_json.h` to update the model name from "SBBT-004CEU" to "SBBT-EU". - Modify `SBBT_004CUS_ENCR_json.h` to update the model name from "SBBT-US76d2" to "SBBT-US". - Ensure consistency in JSON property definitions across all device headers. * Add unit tests for BLE functionality in test_ble.cpp * Fix copy paste error in test_ble.cpp * Refactor JSON definitions for SBBT-004CEU and SBBT-004CUS devices to improve readability and maintainability. * Refactor JSON definitions for SBBT-004CEU and SBBT-004CUS devices to improve readability and maintainability. * Refactor JSON definitions for SBBT-004CEU and SBBT-004CUS devices to improve readability and maintainability. * Refactor JSON definitions for SBBT-004CEU and SBBT-004CUS devices to improve readability and maintainability. * Add support for ShellyBLU Switch4 (SBBT-004CEU/US) and update documentation - Added new device definition for ShellyBLU Switch4 (SBBT-004CEU/US) in `src/devices/SBBT_004CEU_US_json.h`. - Updated `docs/devices/SBBT-004CEU.md` and `docs/devices/SBBT-004CUS.md` to indicate support for unencrypted devices only. - Removed obsolete device definitions: `SBBT_004CEU_ENCR_json.h`, `SBBT_004CUS_ENCR_json.h`, `SBBT_004CEU_json.h`, and `SBBT_004CUS_json.h`. - Updated `src/devices.h` and `src/decoder.h` to reflect the new device support and clean up unused includes. * add json string to device * fix tests * fix tests * fix tests * fix tests * fix tests --------- Co-authored-by: Lars <[email protected]>
- Loading branch information
Showing
6 changed files
with
305 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# ShellyBLU Wall Switcht4 | ||
|
||
|Model Id|[SBBT-004CEU](https://github.com/theengs/decoder/blob/development/src/devices/SBBT_004CEU_json.h)| | ||
|-|-| | ||
|Brand|Shelly| | ||
|Model|ShellyBLU Wall Switch4| | ||
|Short Description|Button| | ||
|Communication|BLE broadcast| | ||
|Frequency|2.4Ghz| | ||
|Power Source|CR2032| | ||
|Exchanged Data|button press type of each button, battery, packet ID| | ||
|Encrypted|Yes/No - Optional| | ||
|
||
Currently only unencrypted devices are supported. | ||
|
||
The button press type for each button is encoded as: | ||
|
||
* 0 - None (other Button was pressed or sent every 8 seconds if beacon mode is enabled) | ||
* 1 - Single short click | ||
* 2 - Double click | ||
* 3 - Triple click | ||
* 9 - Long press | ||
* 11 - Button hold |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# ShellyBLU RC Button4 | ||
|
||
|Model Id|[SBBT-004CUS](https://github.com/theengs/decoder/blob/development/src/devices/SBBT_004CUS_json.h)| | ||
|-|-| | ||
|Brand|Shelly| | ||
|Model|ShellyBLU RC Button4| | ||
|Short Description|Button| | ||
|Communication|BLE broadcast| | ||
|Frequency|2.4Ghz| | ||
|Power Source|CR2032| | ||
|Exchanged Data|button press type of each button, battery, packet ID| | ||
|Encrypted|Yes/No - Optional| | ||
|
||
Currently only unencrypted devices are supported. | ||
|
||
The button press type for each button is encoded as: | ||
|
||
* 0 - None (other Button was pressed or sent every 8 seconds if beacon mode is enabled) | ||
* 1 - Single short click | ||
* 2 - Double click | ||
* 3 - Triple click | ||
* 9 - Long press | ||
* 11 - Button hold |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
const char* _SBBT_004CEU_US_json = "{\"brand\":\"Shelly\",\"model\":\"ShellyBLU Switch4\",\"model_id\":\"SBBT-004CEU/US\",\"tag\":\"1106\",\"condition\":[\"servicedata\",\"=\",26,\"index\",0,\"40\",\"|\",\"servicedata\",\"=\",26,\"index\",0,\"44\",\"&\",\"uuid\",\"index\",0,\"fcd2\",\"&\",\"name\",\"index\",0,\"SBBT-\"],\"properties\":{\"packet\":{\"condition\":[\"servicedata\",2,\"00\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",4,2,false,false]},\"batt\":{\"condition\":[\"servicedata\",6,\"01\"],\"decoder\":[\"value_from_hex_data\",\"servicedata\",8,2,false,false]},\"button1\":{\"condition\":[\"servicedata\",10,\"3a\"],\"decoder\":[\"string_from_hex_data\",\"servicedata\",12,2],\"lookup\":[\"00\",0,\"01\",1,\"02\",2,\"03\",3,\"04\",9,\"fe\",11]},\"button2\":{\"condition\":[\"servicedata\",14,\"3a\"],\"decoder\":[\"string_from_hex_data\",\"servicedata\",16,2],\"lookup\":[\"00\",0,\"01\",1,\"02\",2,\"03\",3,\"04\",9,\"fe\",11]},\"button3\":{\"condition\":[\"servicedata\",18,\"3a\"],\"decoder\":[\"string_from_hex_data\",\"servicedata\",20,2],\"lookup\":[\"00\",0,\"01\",1,\"02\",2,\"03\",3,\"04\",9,\"fe\",11]},\"button4\":{\"condition\":[\"servicedata\",22,\"3a\"],\"decoder\":[\"string_from_hex_data\",\"servicedata\",24,2],\"lookup\":[\"00\",0,\"01\",1,\"02\",2,\"03\",3,\"04\",9,\"fe\",11]},\"mac\":{\"condition\":[\"manufacturerdata\",\"=\",30],\"decoder\":[\"revmac_from_hex_data\",\"manufacturerdata\",18]}}}"; | ||
/*R""""( | ||
{ | ||
"brand":"Shelly", | ||
"model":"ShellyBLU Switch4", | ||
"model_id":"SBBT-004CEU/US", | ||
"tag":"1106", | ||
"condition":["servicedata", "=", 26, "index", 0, "40", "|", "servicedata", "=", 26, "index", 0, "44", "&", "uuid", "index", 0, "fcd2", "&", "name", "index", 0, "SBBT-"], | ||
"properties":{ | ||
"packet":{ | ||
"condition":["servicedata", 2, "00"], | ||
"decoder":["value_from_hex_data", "servicedata", 4, 2, false, false] | ||
}, | ||
"batt":{ | ||
"condition":["servicedata", 6, "01"], | ||
"decoder":["value_from_hex_data", "servicedata", 8, 2, false, false] | ||
}, | ||
"button1":{ | ||
"condition":["servicedata", 10, "3a"], | ||
"decoder":["string_from_hex_data", "servicedata", 12, 2], | ||
"lookup":["00", 0, | ||
"01", 1, | ||
"02", 2, | ||
"03", 3, | ||
"04", 9, | ||
"fe", 11] | ||
}, | ||
"button2":{ | ||
"condition":["servicedata", 14, "3a"], | ||
"decoder":["string_from_hex_data", "servicedata", 16, 2], | ||
"lookup":["00", 0, | ||
"01", 1, | ||
"02", 2, | ||
"03", 3, | ||
"04", 9, | ||
"fe", 11] | ||
}, | ||
"button3":{ | ||
"condition":["servicedata", 18, "3a"], | ||
"decoder":["string_from_hex_data", "servicedata", 20, 2], | ||
"lookup":["00", 0, | ||
"01", 1, | ||
"02", 2, | ||
"03", 3, | ||
"04", 9, | ||
"fe", 11] | ||
}, | ||
"button4":{ | ||
"condition":["servicedata", 22, "3a"], | ||
"decoder":["string_from_hex_data", "servicedata", 24, 2], | ||
"lookup":["00", 0, | ||
"01", 1, | ||
"02", 2, | ||
"03", 3, | ||
"04", 9, | ||
"fe", 11] | ||
}, | ||
"mac":{ | ||
"condition":["manufacturerdata", "=", 30], | ||
"decoder":["revmac_from_hex_data", "manufacturerdata", 18] | ||
} | ||
} | ||
})"""";*/ | ||
|
||
const char* _SBBT_004CEU_US_json_props = "{\"properties\":{\"packet\":{\"unit\":\"int\",\"name\":\"packet id\"},\"batt\":{\"unit\":\"%\",\"name\":\"battery\"},\"button1\":{\"unit\":\"int\",\"name\":\"button1 press type\"},\"button2\":{\"unit\":\"int\",\"name\":\"button2 press type\"},\"button3\":{\"unit\":\"int\",\"name\":\"button3 press type\"},\"button4\":{\"unit\":\"int\",\"name\":\"button4 press type\"},\"mac\":{\"unit\":\"string\",\"name\":\"MAC address\"}}}"; | ||
/*R""""( | ||
{ | ||
"properties":{ | ||
"packet":{ | ||
"unit":"int", | ||
"name":"packet id" | ||
}, | ||
"batt":{ | ||
"unit":"%", | ||
"name":"battery" | ||
}, | ||
"button1":{ | ||
"unit":"int", | ||
"name":"button1 press type" | ||
}, | ||
"button2":{ | ||
"unit":"int", | ||
"name":"button2 press type" | ||
}, | ||
"button3":{ | ||
"unit":"int", | ||
"name":"button3 press type" | ||
}, | ||
"button4":{ | ||
"unit":"int", | ||
"name":"button4 press type" | ||
}, | ||
"mac":{ | ||
"unit":"string", | ||
"name":"MAC address" | ||
} | ||
} | ||
})"""";*/ |
Oops, something went wrong.