[boschindego] Implement OAuth2 authorization (#14745)

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
Jacob Laursen
2023-04-15 09:39:17 +02:00
committed by GitHub
parent 7a26af7164
commit 20f306f485
14 changed files with 816 additions and 674 deletions

View File

@@ -4,17 +4,37 @@ This is the Binding for Bosch Indego Connect lawn mowers.
Thank´s to zazaz-de who found out how the API works.
His [Java Library](https://github.com/zazaz-de/iot-device-bosch-indego-controller) made this Binding possible.
## Discovery
When the bridge is authorized, the binding can automatically discover Indego mowers connected to the SingleKey ID account.
## Thing Configuration
Currently the binding supports _**indego**_ mowers as a thing type with these configuration parameters:
### `account` Bridge Configuration
| Parameter | Description | Default |
|--------------------|-------------------------------------------------------------------|---------|
| username | Username for the Bosch Indego account | |
| password | Password for the Bosch Indego account | |
| refresh | The number of seconds between refreshing device state when idle | 180 |
| stateActiveRefresh | The number of seconds between refreshing device state when active | 30 |
| cuttingTimeRefresh | The number of minutes between refreshing last/next cutting time | 60 |
There are no parameters for the bridge.
However, the bridge is used for managing the [SingleKey ID](https://singlekey-id.com/) digital identity.
#### Authorization
To authorize, please follow these steps:
- In your browser, go to the [Bosch Indego login page](https://prodindego.b2clogin.com/prodindego.onmicrosoft.com/b2c_1a_signup_signin/oauth2/v2.0/authorize?redirect_uri=com.bosch.indegoconnect://login&client_id=65bb8c9d-1070-4fb4-aa95-853618acc876&response_type=code&scope=openid%20offline_access%20https://prodindego.onmicrosoft.com/indego-mobile-api/Indego.Mower.User).
- Select "Bosch ID", enter your e-mail address and password and click "Log-in".
- In your browser, open Developer Tools.
- With developer tools showing on the right, go to [Bosch Indego login page](https://prodindego.b2clogin.com/prodindego.onmicrosoft.com/b2c_1a_signup_signin/oauth2/v2.0/authorize?redirect_uri=com.bosch.indegoconnect://login&client_id=65bb8c9d-1070-4fb4-aa95-853618acc876&response_type=code&scope=openid%20offline_access%20https://prodindego.onmicrosoft.com/indego-mobile-api/Indego.Mower.User) again.
- "Please wait..." should now be displayed.
- Find the `authresp` and copy the code: `com.bosch.indegoconnect://login/?code=<copy this>`
- Use the openHAB console to authorize with this code: `openhab:boschindego authorize <paste code>`
### `indego` Thing Configuration
| Parameter | Description | Default | Required |
|--------------------|-------------------------------------------------------------------|---------|----------|
| serialNumber | The serial number of the connected Indego mower | | yes |
| refresh | The number of seconds between refreshing device state when idle | 180 | no |
| stateActiveRefresh | The number of seconds between refreshing device state when active | 30 | no |
| cuttingTimeRefresh | The number of minutes between refreshing last/next cutting time | 60 | no |
## Channels
@@ -80,26 +100,29 @@ Currently the binding supports _**indego**_ mowers as a thing type with these
### `indego.things` File
```java
boschindego:indego:lawnmower [username="mail@example.com", password="idontneedtocutthelawnagain", refresh=120]
Bridge boschindego:account:singlekey {
Things:
Thing indego lawnmower [serialNumber="1234567890", refresh=120]
}
```
### `indego.items` File
```java
Number Indego_State { channel="boschindego:indego:lawnmower:state" }
Number Indego_ErrorCode { channel="boschindego:indego:lawnmower:errorcode" }
Number Indego_StateCode { channel="boschindego:indego:lawnmower:statecode" }
String Indego_TextualState { channel="boschindego:indego:lawnmower:textualstate" }
Number Indego_Ready { channel="boschindego:indego:lawnmower:ready" }
Dimmer Indego_Mowed { channel="boschindego:indego:lawnmower:mowed" }
DateTime Indego_LastCutting { channel="boschindego:indego:lawnmower:lastCutting" }
DateTime Indego_NextCutting { channel="boschindego:indego:lawnmower:nextCutting" }
Number:ElectricPotential Indego_BatteryVoltage { channel="boschindego:indego:lawnmower:batteryVoltage" }
Number Indego_BatteryLevel { channel="boschindego:indego:lawnmower:batteryLevel" }
Switch Indego_LowBattery { channel="boschindego:indego:lawnmower:lowBattery" }
Number:Temperature Indego_BatteryTemperature { channel="boschindego:indego:lawnmower:batteryTemperature" }
Number:Area Indego_GardenSize { channel="boschindego:indego:lawnmower:gardenSize" }
Image Indego_GardenMap { channel="boschindego:indego:lawnmower:gardenMap" }
Number Indego_State { channel="boschindego:indego:singlekey:lawnmower:state" }
Number Indego_ErrorCode { channel="boschindego:indego:singlekey:lawnmower:errorcode" }
Number Indego_StateCode { channel="boschindego:indego:singlekey:lawnmower:statecode" }
String Indego_TextualState { channel="boschindego:indego:singlekey:lawnmower:textualstate" }
Number Indego_Ready { channel="boschindego:indego:singlekey:lawnmower:ready" }
Dimmer Indego_Mowed { channel="boschindego:indego:singlekey:lawnmower:mowed" }
DateTime Indego_LastCutting { channel="boschindego:indego:singlekey:lawnmower:lastCutting" }
DateTime Indego_NextCutting { channel="boschindego:indego:singlekey:lawnmower:nextCutting" }
Number:ElectricPotential Indego_BatteryVoltage { channel="boschindego:indego:singlekey:lawnmower:batteryVoltage" }
Number Indego_BatteryLevel { channel="boschindego:indego:singlekey:lawnmower:batteryLevel" }
Switch Indego_LowBattery { channel="boschindego:indego:singlekey:lawnmower:lowBattery" }
Number:Temperature Indego_BatteryTemperature { channel="boschindego:indego:singlekey:lawnmower:batteryTemperature" }
Number:Area Indego_GardenSize { channel="boschindego:indego:singlekey:lawnmower:gardenSize" }
Image Indego_GardenMap { channel="boschindego:indego:singlekey:lawnmower:gardenMap" }
```
### `indego.sitemap` File