-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for ShellyBLU Wall Switch4 and RC Button4 devices #564
Conversation
- 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`.
Hi @larswnd - Thanks for this.
Would you mind adding some unit tests for the EU switch as well, from the decoder logic you created, similar to the US one. This ensures regression testing during future Decoder additions.
In your model conditions you use the full name, including part of your specific device's MAC address, for comparison. This means the decoder will only work with this single "SBBT-US76d2" device with MAC address 38:39:8F:71:76:D2 . You should change this to just the static leading characters, identical to all "SBBT-US…", like you did for the "SBBT-004CEU", although I would imagine that this might also need to be changed to "SBBT-EU", if the name broadcast is similar along the lines of the SBBT-004CUS broadcasting "SBBT-US…". I will have the time to take a more detailed look on the weekend, to see why there are still some build failures. |
- 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.
…improve readability and maintainability.
…improve readability and maintainability.
…improve readability and maintainability.
…improve readability and maintainability.
I added some Unit Tests for the EU model. Good point with the mac in the name. I was blind... felt wrong. I saw some |
Hi @larswnd I had the time to look at this more closely today. The unencrypted decoders do look fine to me from here, not having any Shelly devices myself, and with the added test cases and assuming that you have also tested and verified this with your actual SBBT-004CUS they look ready to go. While I do understand your reluctance to install and use any proprietary app, the encrypted decoders look wrong to me. You state
This is correct for the actual button press encoding, but the SBBT-002C only has one single button, while the ShellyBLU Wall Switch4 (SBBT-004CEU) and RC Button4 (SBBT-004CUS) have four buttons. Because of this I would expect the encrypted data for these to be at least 6 octets longer than for the SBBT-002C, to be able to contain the ids and states for the additional three buttons. Similar to the unencrypted data length difference of these devices. • You could remove the encrypted decoders and remove the option from the docs, and we'd have to wait until someone else might supply some encrypted sample data. What do you say? 😉 ADDENDUM: As the decoders are basically identical for the US and EU version of these 4 buttons switches I would also suggest to combine them into on single decoder, by This would save a lot of space by not using duplicate decoders, with a universal model_id in the published MQTT messages not really being an issue for owners of either US or EU models. With the decoders running on ESP32 space is always a concern, and the space saved will be better used for addition totally different decoders in the future. You might want to have a look at the IBS_THBP01B_json.h decoder, which decoders 4+ different Inkbird devices, all with their own docs, but using just the single decoder. |
…tation - 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.
I think we have to skip encryption for now, just guessing the encryption feels not right. I tried the app, but I do not own anything from Shelly that can act as Gateway... I combined them into one.
|
I tested my Shelly Switch4 with the new decoder. It works great! The Switch behaves a bit different than the SBBT-002C. The Single Button one does not send the 0xFE Event (Button hold), although it is mentioned in the docs. The Switch4 does so. But that has nothing to do with the decoder. |
Thanks for the changes @larswnd Please see my above review with remaining small amendments, then this should be all ready to merge. |
Hello @DigiH |
Hi @larswnd Can you see my review comments within the code above? You might need to be logged in with a browser. It's only the correct unified decoder file name in the docs link, and putting the 'unencrypted only' info into the |
If you can't see the review comments, do you want me to make the small documentation changes so this can be merged? |
I am sorry, I was travelling. |
devices.h
anddecoder.h
to include new device models and their encrypted versions.test_ble.cpp
.Description:
I own an SBBT-004CUS (The EU one seems identical in the [documentation] (https://shelly-api-docs.shelly.cloud/docs-ble/Devices/wall_us)
Some things to consider:
I hope you can help me finishing this pull request.
Checklist: