Skip to content
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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

david-pace
Copy link
Member

@david-pace david-pace commented Jan 29, 2025

  • add thing type definition and channel type definitions
  • 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

closes #18162

* 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]>
@david-pace david-pace added the enhancement An enhancement or new feature for an existing add-on label Jan 29, 2025
* 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]>
@david-pace david-pace force-pushed the 18162-window-contact-2-plus branch from f30a5fa to 79ddadd Compare January 30, 2025 19:54
@david-pace david-pace added the awaiting other PR Depends on another PR label Jan 30, 2025
Copy link
Contributor

@jlaur jlaur left a 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.

Comment on lines +5 to +16
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`
Copy link
Contributor

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:

Suggested change
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;
Copy link
Contributor

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:

Suggested change
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.THING_TYPE_WINDOW_CONTACT_2_PLUS;
import static org.openhab.binding.boschshc.internal.devices.BoschSHCBindingConstants.*;

Comment on lines +15 to +17
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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.*;

@david-pace david-pace added additional testing preferred The change works for the pull request author. A test from someone else is preferred though. work in progress A PR that is not yet ready to be merged labels Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
additional testing preferred The change works for the pull request author. A test from someone else is preferred though. awaiting other PR Depends on another PR enhancement An enhancement or new feature for an existing add-on work in progress A PR that is not yet ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[boschshc] Support for device Door/Window Contact II Plus
2 participants