openhab-addons/bundles/org.openhab.binding.groheondus
Arne Seime 618b7a4e3a
[groheondus] Fix missing automatic refresh ++ (#11955)
* Fix scheduling of thing and token update, tries to avoid service rate limiting. Added more logging. Added some missing null checks. Ensure recent data is fetched, not data from yesterday

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* Updated to latest versio of API lib

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* Added new channel waterconsumption_since_midnight that sums todays water consumption (same as in the Grohe app)

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* Add more debug logging

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* More null checks, also set channels to Undef if a value is missing

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* Fixed missing embedding of commons-text as it is a dependency of the api lib

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* Refresh token 1 hour before expiry

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* Re-login in case token refresh fails

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* Factor in timezone when calculating consum since midnight

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* Use QuantityType<Volume> for water consumption

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* Minor

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* i18n of dynamic error messages

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* More i18n. Plus retry of failed refresh token - with a delay to possibly avoid rate limiting

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* Adjust refresh token timeout to 5 minutes before expire. Also retry with username/pwd login if token login fails (could be an expired token)

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* Clear old discovery results

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* Fetch data further back to ensure battery device has been online

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* Updated README with old data warning

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* Typo

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* Do not allow polling interval less than 900 as rate limiting most likely will block the calls

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* Fix failed token refresh giving up

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* Removed refresh token login webpage. Another attempt at handling token refresh

Signed-off-by: Arne Seime <arne.seime@gmail.com>

* Fix status detail

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>

* Restore formatting

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>

* Fix newly introduced warnings

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>

* Remove redundant logging

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>

Signed-off-by: Arne Seime <arne.seime@gmail.com>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Co-authored-by: Jacob Laursen <jacob-github@vindvejr.dk>
2022-10-27 09:03:17 +02:00
..
src/main [groheondus] Fix missing automatic refresh ++ (#11955) 2022-10-27 09:03:17 +02:00
NOTICE added migrated 2.x add-ons 2020-09-21 03:37:19 +02:00
pom.xml [groheondus] Fix missing automatic refresh ++ (#11955) 2022-10-27 09:03:17 +02:00
README.md [groheondus] Fix missing automatic refresh ++ (#11955) 2022-10-27 09:03:17 +02:00

GROHE ONDUS Binding

The GROHE ONDUS Binding provides access to data collected by a GROHE ONDUS appliance, such as an GROHE Sense Guard. The binding uses the REST API interface (the same as used by the Android App) to retrieve the collected data.

Supported Things

This binding should support all appliances from GROHE, however, only the GROHE Sense and Sense Guard is tested with it.

Thing type Name
account GROHE ONDUS Account
senseguard GROHE SENSE Guard device
sense GROHE SENSE device

Discovery

The binding requires you to create at least one Account thing as a bridge manually. The discovery process will look through all locations and rooms of your configured GROHE account and adds each found appliance as a new thing automatically to the inbox.

Binding Configuration

This binding does not require any configuration outside of things.

Thing Configuration

There is only one thing and one bridge that needs to be configured together to get this binding to work, see the full example section for a self-explaining example.

Account Bridge

The groheondus:account bridge is used to configure the API interface for a specific account, which is used to access the collected and saved data of your GROHE account. Use the same credentials as in the mobile app.

Appliance

The groheondus:sense and groheondus:senseguard things are used to retrieve information of a specific appliance from GROHE. This appliance needs to be connected with your GROHE ONDUS account as configured in the corresponding Account Bridge. The appliance needs to be configured with the unique appliance ID (with the applianceId configuration) as well as the roomId and the locationId. Once the account bridge is configured, the appliances in your account will be discovered as Appliance things. pollingInterval has a minimum value of 900 seconds to avoid service rate limiting.

Configuration Default value Description
applianceId '' Unique ID of the appliance in the GROHE ONDUS account
roomId '' ID of the room the appliance is in
locationId '' ID of the location (building) the appliance is in
pollingInterval Retrieved from API, Interval in seconds to get new data from the API
usually 900 The sense thing uses 900 by default.

Channels

senseguard
Channel Type Description
name String The name of the appliance
pressure Number:Pressure The pressure of your water supply
temperature_guard Number:Temperature The ambient temperature of the appliance
valve_open Switch Valve switch
waterconsumption Number:Volume The amount of water used in a specific timeframe
waterconsumption_since_midnight Number:Volume The amount of water used since midnight
sense
Channel Type Description
name String The name of the appliance
humidity Number:Dimensionless The humidity measured by the appliance
temperature Number:Temperature The ambient temperature of the appliance
battery Number The battery level of the appliance

Note: Be aware that the Sense reports data once a day (at most), and that the value posted in the channel - however the latest - may be up to 48 hours old.

Full Example

Things file:

Bridge groheondus:account:account1 [ username="user@example.com", password="YourStrongPasswordHere!" ] {
    groheondus:senseguard:550e8400-e29b-11d4-a716-446655440000 [ applianceId="550e8400-e29b-11d4-a716-446655440000", roomId=456, locationId=123 ] {
        Channels:
            Type number : waterconsumption [
               timeframe=3
            ]
    }
    groheondus:sense:550e8400-e29b-11d4-a716-446655440000 [ applianceId="444e8400-e29b-11d4-a716-446655440000", roomId=456, locationId=123 ]
}

Items file:

String Name_Sense_Guard "Appliance Name" {channel="groheondus:senseguard:groheondus:appliance:550e8400-e29b-11d4-a716-446655440000:name"}
Number:Pressure Pressure_Sense_Guard "Pressure [%.1f %unit%]" {channel="groheondus:senseguard:groheondus:appliance:550e8400-e29b-11d4-a716-446655440000:pressure"}
Number:Temperature Temperature_Sense_Guard "Temperature [%.1f %unit%]" {channel="groheondus:senseguard:groheondus:appliance:550e8400-e29b-11d4-a716-446655440000:temperature_guard"}
Number:Volume Water_Usage_Since_Midnight_Sense_Guard "Water usage since midnight [%.1f %unit%]" {channel="groheondus:senseguard:groheondus:appliance:550e8400-e29b-11d4-a716-446655440000:waterconsumption_since_midnight"}

String Name_Sense "Temperature [%.1f %unit%]" {channel="groheondus:sense:groheondus:appliance:444e8400-e29b-11d4-a716-446655440000:name"}
Number:Temperature Temperature_Sense "Temperature [%.1f %unit%]" {channel="groheondus:sense:groheondus:appliance:444e8400-e29b-11d4-a716-446655440000:temperature"}
Number Humidity_Sense "Humidity [%.1f %unit%]" {channel="groheondus:sense:groheondus:appliance:444e8400-e29b-11d4-a716-446655440000:humidity"}