-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[boschshc] Support for Door/Window Contact II Plus #18201
base: main
Are you sure you want to change the base?
Conversation
* add new channel definition for alarm channel in thing-types.xml * add alarm channel to Smoke Detector and Smoke Detector II * add update instruction sets in binding.xml * re-generate i18n properties file * add constant for new channel * implement alarm service * register service package in tests * extend abstract smoke detector handler * add unit tests * add documentation Signed-off-by: David Pace <[email protected]>
* add thing type definition and channel type definitions * re-generate i18n properties * add constants for thing type and channel types * implement new vibration sensor service * add handler for Door/Window Contact II Plus * register handler in factory * add unit tests * add documentation * use opportunity to add documentation for developers regarding typical steps to support new things/channels Signed-off-by: David Pace <[email protected]>
f30a5fa
to
79ddadd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I have added a few very minor comments, otherwise LGTM.
1. Define new thing types and channel types in `src/main/resources/OH-INF/thing/thing-types.xml` | ||
2. Define constants for the new thing/channel types in `BoschSHCBindingConstants` | ||
3. Create new packages for services that are not implemented yet and create a service class | ||
4. Create new DTO packages for new services and implement data transfer model classes / enums according to the JSON structure of the service requests | ||
5. Create a new handler or extend existing handlers to update channel states according to what was received, and/or to send new states to the Bosch Smart Home Controller in case of writable channels | ||
6. Register new handlers in `BoschSHCHandlerFactory`, if applicable | ||
7. Implement unit tests for new handlers / services / model classes | ||
8. If `thing-types.xml` was modified, re-generate the i18n properties file by running Maven with the goal `i18n:generate-default-translations` | ||
9. If channels were added to existing devices/things, add a migration instruction set to `src/main/resources/update/binding.xml` | ||
10. Add documentation for new things/channels to `README.md` | ||
11. Apply automatic code formatting by running a Maven build with goal `spotless:apply` | ||
12. Build the binding by running a Maven build with goals `clean install` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: If you number like this, auto-numbering will be used. This makes is safer to add something later in case manual renumbering is forgotten:
1. Define new thing types and channel types in `src/main/resources/OH-INF/thing/thing-types.xml` | |
2. Define constants for the new thing/channel types in `BoschSHCBindingConstants` | |
3. Create new packages for services that are not implemented yet and create a service class | |
4. Create new DTO packages for new services and implement data transfer model classes / enums according to the JSON structure of the service requests | |
5. Create a new handler or extend existing handlers to update channel states according to what was received, and/or to send new states to the Bosch Smart Home Controller in case of writable channels | |
6. Register new handlers in `BoschSHCHandlerFactory`, if applicable | |
7. Implement unit tests for new handlers / services / model classes | |
8. If `thing-types.xml` was modified, re-generate the i18n properties file by running Maven with the goal `i18n:generate-default-translations` | |
9. If channels were added to existing devices/things, add a migration instruction set to `src/main/resources/update/binding.xml` | |
10. Add documentation for new things/channels to `README.md` | |
11. Apply automatic code formatting by running a Maven build with goal `spotless:apply` | |
12. Build the binding by running a Maven build with goals `clean install` | |
1. Define new thing types and channel types in `src/main/resources/OH-INF/thing/thing-types.xml` | |
1. Define constants for the new thing/channel types in `BoschSHCBindingConstants` | |
1. Create new packages for services that are not implemented yet and create a service class | |
1. Create new DTO packages for new services and implement data transfer model classes / enums according to the JSON structure of the service requests | |
1. Create a new handler or extend existing handlers to update channel states according to what was received, and/or to send new states to the Bosch Smart Home Controller in case of writable channels | |
1. Register new handlers in `BoschSHCHandlerFactory`, if applicable | |
1. Implement unit tests for new handlers / services / model classes | |
1. If `thing-types.xml` was modified, re-generate the i18n properties file by running Maven with the goal `i18n:generate-default-translations` | |
1. If channels were added to existing devices/things, add a migration instruction set to `src/main/resources/update/binding.xml` | |
1. Add documentation for new things/channels to `README.md` | |
1. Apply automatic code formatting by running a Maven build with goal `spotless:apply` | |
1. Build the binding by running a Maven build with goals `clean install` |
@@ -37,6 +37,7 @@ | |||
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.THING_TYPE_WATER_DETECTOR; | |||
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.THING_TYPE_WINDOW_CONTACT; | |||
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.THING_TYPE_WINDOW_CONTACT_2; | |||
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.THING_TYPE_WINDOW_CONTACT_2_PLUS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing this long list of imports, you could consider wildcard import here, which is allowed for static imports:
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.THING_TYPE_WINDOW_CONTACT_2_PLUS; | |
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.*; |
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.CHANNEL_VIBRATION_SENSOR_ENABLED; | ||
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.CHANNEL_VIBRATION_SENSOR_SENSITIVITY; | ||
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.CHANNEL_VIBRATION_SENSOR_STATE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.CHANNEL_VIBRATION_SENSOR_ENABLED; | |
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.CHANNEL_VIBRATION_SENSOR_SENSITIVITY; | |
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.CHANNEL_VIBRATION_SENSOR_STATE; | |
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.*; |
closes #18162