[boschshc] Support obtaining battery states (#13461) (#13631)

This change adds support for obtaining the battery state for the
following devices:

* Motion Detector
* Thermostat
* Twinguard
* Wall Thermostat
* Window/Door Contact

The following changes were made:

* Add system.battery-level and system.low-battery channels to Motion
Detector, Thermostat, Twinguard, Wall Thermostat and Window/Door Contact
* Add constant for battery-level and low-battery channels in
BoschSHCBindingConstants
* Implement abstract handler and service for battery-powered devices
* Let appropriate devices inherit the abstract implementation
* Add missing super calls in initializeServices() methods
* Rename existing getServiceURL() to getServiceStateURL() in HTTP client
* Add methods to retrieve service states without the suffix "/state" in
the URL
* Rename DeviceStatusUpdate to DeviceServiceData
* Let DeviceServiceData extend BoschSHCServiceState
* Extend DeviceServiceData DTO with model for faults
* Enhance bridge handler: handle updates without state sub-objects,
extract methods to enhance readability
* Add unit tests for all affected devices
* Minor code enhancements
* Update documentation

Signed-off-by: David Pace <dev@davidpace.de>
This commit is contained in:
David Pace
2022-11-11 08:23:48 +01:00
committed by GitHub
parent 49fe49c1a9
commit 49fa349590
30 changed files with 968 additions and 126 deletions

View File

@@ -49,7 +49,7 @@ A compact smart plug with energy monitoring capabilities.
| power-consumption | Number:Power | &#9744; | Current power consumption (W) of the device. |
| energy-consumption | Number:Energy | &#9744; | Cumulated energy consumption (Wh) of the device. |
### Twinguard smoke detector
### Twinguard Smoke Detector
The Twinguard smoke detector warns you in case of fire and constantly monitors the air.
@@ -65,6 +65,8 @@ The Twinguard smoke detector warns you in case of fire and constantly monitors t
| purity-rating | String | &#9744; | Rating of current measured purity. |
| air-description | String | &#9744; | Overall description of the air quality. |
| combined-rating | String | &#9744; | Combined rating of the air quality. |
| battery-level | Number | &#9744; | Current battery level percentage as integer number. Bosch-specific battery levels are mapped to numbers as follows: `OK`: 100, `LOW_BATTERY`: 10, `CRITICAL_LOW`: 1, `CRITICALLY_LOW_BATTERY`: 1, `NOT_AVAILABLE`: `UNDEF`. |
| low-battery | Switch | &#9744; | Indicates whether the battery is low (`ON`) or OK (`OFF`). |
### Door/Window Contact
@@ -75,6 +77,8 @@ Detects open windows and doors.
| Channel Type ID | Item Type | Writable | Description |
| --------------- | --------- | :------: | ---------------------------- |
| contact | Contact | &#9744; | Contact state of the device. |
| battery-level | Number | &#9744; | Current battery level percentage as integer number. Bosch-specific battery levels are mapped to numbers as follows: `OK`: 100, `LOW_BATTERY`: 10, `CRITICAL_LOW`: 1, `CRITICALLY_LOW_BATTERY`: 1, `NOT_AVAILABLE`: `UNDEF`. |
| low-battery | Switch | &#9744; | Indicates whether the battery is low (`ON`) or OK (`OFF`). |
### Motion Detector
@@ -85,6 +89,8 @@ Detects every movement through an intelligent combination of passive infra-red t
| Channel Type ID | Item Type | Writable | Description |
| --------------- | --------- | :------: | ------------------------------ |
| latest-motion | DateTime | &#9744; | The date of the latest motion. |
| battery-level | Number | &#9744; | Current battery level percentage as integer number. Bosch-specific battery levels are mapped to numbers as follows: `OK`: 100, `LOW_BATTERY`: 10, `CRITICAL_LOW`: 1, `CRITICALLY_LOW_BATTERY`: 1, `NOT_AVAILABLE`: `UNDEF`. |
| low-battery | Switch | &#9744; | Indicates whether the battery is low (`ON`) or OK (`OFF`). |
### Shutter Control
@@ -107,6 +113,8 @@ Radiator thermostat
| temperature | Number:Temperature | &#9744; | Current measured temperature. |
| valve-tappet-position | Number:Dimensionless | &#9744; | Current open ratio of valve tappet (0 to 100). |
| child-lock | Switch | &#9745; | Indicates if child lock is active. |
| battery-level | Number | &#9744; | Current battery level percentage as integer number. Bosch-specific battery levels are mapped to numbers as follows: `OK`: 100, `LOW_BATTERY`: 10, `CRITICAL_LOW`: 1, `CRITICALLY_LOW_BATTERY`: 1, `NOT_AVAILABLE`: `UNDEF`. |
| low-battery | Switch | &#9744; | Indicates whether the battery is low (`ON`) or OK (`OFF`). |
### Climate Control
@@ -129,6 +137,8 @@ Display of the current room temperature as well as the relative humidity in the
| --------------- | -------------------- | :------: | ------------------------------------- |
| temperature | Number:Temperature | &#9744; | Current measured temperature. |
| humidity | Number:Dimensionless | &#9744; | Current measured humidity (0 to 100). |
| battery-level | Number | &#9744; | Current battery level percentage as integer number. Bosch-specific battery levels are mapped to numbers as follows: `OK`: 100, `LOW_BATTERY`: 10, `CRITICAL_LOW`: 1, `CRITICALLY_LOW_BATTERY`: 1, `NOT_AVAILABLE`: `UNDEF`. |
| low-battery | Switch | &#9744; | Indicates whether the battery is low (`ON`) or OK (`OFF`). |
### Security Camera 360