Grohe Sense (Ondus)

Alarms (or, “notifications”) are now implemented. Polling for them every minute. Very untested.

Note that if you’ve used the Ondus rather than the newer Sense app, you’ll likely have a very long list of notifications in the sensor when you start, seems like the Ondus app (at least for me) was not very consistent in marking notifications as read.

(Working on water on/off. As a heads-up, that change will likely require an update to the configuration file (as the integration will then implement both sensors and a switch))

1 Like

Had a bit more time, so there’s now also support for turning the water on/off. Added a new switch (so, careful if you have anything using group.all_switches) called valve for each Grohe Sense Guard detected. Note that you need to update your config file (moving the config being under sensor platform, to being standalone).

Again, very untested. I’ve clicked around a few times myself and it seems to work, but the only way I have to test this is “in production” affecting the water supply of my own house, so, as you may imagine, I haven’t really gone wild with experimentation here.

Thanks a lot for the update! However I have not made working. I’ve uploaded the new files, removed the grohe_sense from the sensor config, and put it in configuration.yaml:

grohe_sense:
  refresh_token: "MY_REFRESH_TOKEN"

But I get:
Invalid config for [grohe_sense]: [refresh_token] is an invalid option for [grohe_sense]. Check: grohe_sense->refresh_token. (See ?, line ?). Please check the docs at https://home-assistant.io/integrations/grohe_sense/

Any pointers?

I’m at 0.101.1, btw.

I get the same error.

I really appreciate the effort, to make this component :+1::slightly_smiling_face:

When omitting refresh_token, it complains that mandatory option refresh_token is missing :slight_smile:

I’ve been trying to reproduce the error, without any success so far. If I read the home assistant source code correctly, the error message you’re getting indicates that it thinks refresh_token is a superfluous option.

Can you describe a bit more how you run home assistant (docker, hass, python venv, …)? I’ve tried slightly older versions + the latest on both docker and as venv without being able to reproduce.

One thing that is weird about the error message you show is the path from “Check”, it says Check: grohe_sense->refresh_token. When I add a superfluous value (foo) to my config, I get the same error, but with a Check: of grohe_sense->grohe_sense->foo (note that grohe_sense appears twice). Is that the same for you?

One slightly desperate thing to test: I spotted a leftover import of PLATFORM_SCHEMA in __init__.py. I don’t see how that would cause what you’ve observed, but you could try removing it.

When i do:

grohe_sense:
  foo: test

I get:
Invalid config for [grohe_sense]: [foo] is an invalid option for [grohe_sense]. Check: grohe_sense->grohe_sense->foo. (See /config/configuration.yaml, line 62). Please check the docs at https://home-assistant.io/integrations/grohe_sense/

I.e. the same as you. I run hass.io on an RPi 3b.

Is it this line I should comment out:

from homeassistant.components.sensor import PLATFORM_SCHEMA

Thanks for looking into this! I really want this component!

Both this:

grohe_sense:
  foo: test
  refresh_token: "blahblah"

And this:

grohe_sense:
  refresh_token: "blahblah"
  foo: test

Gives:
Invalid config for [grohe_sense]: [foo] is an invalid option for [grohe_sense]. Check: grohe_sense->grohe_sense->foo. (See /config/configuration.yaml, line 60). Please check the docs at https://home-assistant.io/integrations/grohe_sense/

I tried commenting out the line with PLATFORM_SCHEMA without any change.

Thanks for testing things! So weird with a bug that appears on hass.io but not with the home assistant docker image, I would have assumed those would be very close to each other in behaviour.

I still don’t have a theory for what can cause this. One thing to try would be if you would be able to test with a minimal config (e.g., just using a completely default config and only adding grohe_sense to it, just to exclude any other weird interactions).

Another (easier) thing to test would be to change the definition of CONFIG_SCHEMA in __init__.py to allow for extraneous values also in the inner schema. With luck, this may at least yield a new error message that can perhaps shed some light at what’s going on. The change would be to something like this (the important part is the added extra=vol.ALLOW_EXTRA).

CONFIG_SCHEMA = vol.Schema(
    {
        DOMAIN: vol.Schema(
            {
                vol.Required(CONF_REFRESH_TOKEN): cv.string,
            },
            extra=vol.ALLOW_EXTRA,
        ),
    },
    extra=vol.ALLOW_EXTRA,
)

Unfortunately my system is “live”, controlling a lot of things, so I am reluctant to remove a lot of config. I did however try the:

CONFIG_SCHEMA = vol.Schema(
    {
        DOMAIN: vol.Schema(
          {
            vol.Required(CONF_REFRESH_TOKEN): cv.string,
          },
          extra=vol.ALLOW_EXTRA,
        ),
    },
    extra=vol.ALLOW_EXTRA,
)

It made no difference to the output unfortunately. I tried both with and without foo: test in the config, and it produces the same errors as before.

Ok, that result has me really confused. As far as I understand, the error you seeing should not be possible to trigger with that CONFIG_SCHEMA. When I make the change to include the other ALLOW_EXTRA, I can add new keys without any errors. It almost feels like some other schema is also being applied, but I don’t understand where it could come from (my accidental import of PLATFORM_SCHEMA would be my primary suspicion, but we’ve already tried removing that).

One thing to try if you feel comfortable enough around docker would be the following from a shell on your machine (assuming you have ssh enabled on your hassio):
docker ps to figure out the name of your home assistant container (I’d guess it’s “home-assistant” or similar)
docker exec -it home-assistant /bin/bash (replace “home-assistant” with the name you found, starts a bash shell in your home assistant container)
python (starts an interactive python shell)
Then paste the following (which reads in your config file and tries schema validation). If we’re lucky, the last line of this long sequence will produce an exception that may tell us what’s going on. If we’re unlucky, then nothing is printed. If so, that would further strengthen my suspicion that some other config validation is applied.

from ruamel.yaml import YAML
yaml = YAML()
config = yaml.load(open('/config/configuration.yaml'))
import homeassistant.helpers.config_validation as cv
import voluptuous as vol
DOMAIN = 'grohe_sense'
CONF_REFRESH_TOKEN = 'refresh_token'
CONFIG_SCHEMA = vol.Schema(
    {
        DOMAIN: vol.Schema({
            vol.Required(CONF_REFRESH_TOKEN): cv.string,
        }),
    },
    extra=vol.ALLOW_EXTRA,
)
_ = CONFIG_SCHEMA(config)

Thanks for supporting this! I did as per your instructions:

Not sure if I should write “run” or something similar, but as it stands, it produces nothing, as you can see.

I’ve now tried to comment out almost everything in configuration.yaml, except grohe_sense, and error is still there :-/

This is really strange. After a lot of restarts and commenting out config, and uncommenting again, everything seems to work. Obviously an error on my side. Really sorry for taking your time, and thank you a lot for your support and your work with this integration!!

Great to hear that it’s working now! I sure wonder what the error was, it’s not really consistent with any user error in the config file (it sure seemed to be applying a schema validation from somewhere wrong). If you happen to figure it out, please report back here, as there was at least one more person with the same issue above.

And no worries, happy to help when I can!

Was finally able to reproduce, and figure out what the error was. As far as I can tell, the error shows up when you press “Check Config” in the Server Control UI, but does not actually impact anything if you just ignore it and start the server. The error is due to the PLATFORM_SCHEMA I had accidentally moved over to __init__.py. I’ve pushed a fixed version to Github. Note that even after copying these files in, Check Config will show an error until you’ve restarted Home Assistant with the fixed code (modifying python files while Home Assistant is running will not change the code that’s running).

I dug a bit through home assistant internals. If I read the code correctly (I’m not yet very familiar with the code base, so I could be off here), it seems like the code that loads components (https://github.com/home-assistant/home-assistant/blob/206547a5d8abbcf7bc0463d312cc9f68cdcfce07/homeassistant/config.py#L690) behaves a bit differently compared to config checking (https://github.com/home-assistant/home-assistant/blob/206547a5d8abbcf7bc0463d312cc9f68cdcfce07/homeassistant/helpers/check_config.py#L52) if both a CONFIG_SCHEMA and a PLATFORM_SCHEMA is present (the latter running both, which caused the error in this case).

Hi all.
I`m having problems getting the refresh token using the guide in the github/openhab and was hoping someone could help :slight_smile:

  1. I go to the link in the guides: https://idp2-apigw.cloud.grohe.com/v3/iot/oidc/login and get redirected to login.
    2)Log in using my login creds.
    3)Copy the complete link from debugger and replace ondus with https:
    https://idp2-apigw.cloud.grohe.com/v1/sso/auth/realms/idm-apigw/protocol/openid-connect/auth?redirect_uri=HTTPS://idp2-apigw.cloud.grohe.com/v3/iot/oidc/token&scope=openid&response_type=code&client_id=iot&state=bunch_of_numbers:1”
    But this gives me the following JSON return:
    401- “Unauthorized - The token was not validated by the Identity Provider” .

I also tried pasting only the part after ondus:// from the redirect link, replacing ondus with https, but then i don`t even get a json return.

Does this method not work anymore, is it me being unable to follow simple instructions, or is this something that can only be done once? (ref guide: will likely only work once, and will expire, so don’t be too slow)
*I always restart my browser and all browser data is cleared between each attempt.
Probably at attempt 400 by now :expressionless:

Update: tried chrome instead of firefox, and it magically worked.

Brgs Kris

1 Like

I was able to follow that instruction and got it working the other day.