-
Notifications
You must be signed in to change notification settings - Fork 28
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
Refresh token expires often #23
Comments
Hi. Have no idea how often, but it's so often that it's annoying. I've stopped using this integration until proper OAuth is implemented. I've also noticed the same thing with Grohes own Android App. Have to sign in again after some weeks. So could be the problems are coming from their own services. // Joachim |
I spent a little time trying to understand how Grohe's OAuth is working using postman but can't really get it to work. Even when I copied the urls chrome is using with the same payloads I get errors that I'm using an outdated browser. Anyone has any idea how to make OAuth working? |
Hi! I have the same issues, like every two weeks i need to generate a new token. And more or less the same issue with the Apple app, often need to delete/reinstall the app to get it working again. It is such a pity, the combination with Grohe Sense and my home alarm is essentially why I started the whole HA "trip". I will have to find some other hardware that can accomplish a similar functionality. Regards, |
I've had to modify mine. I have installed an Wemos ESP relay board inside the Grohe Sense Guard. It was an easy hack. Now I have at least a reliable way of shutting the water off. |
Do you run the Wemos ESP relay board in parallell with the Grohe Sense Guard functionality? I.e. can the Grohe Sense Guard automatically shut off the water in case of an unexpected high flow, etc? And of course, do you have any photos of the hack? Would love to have some pointers. |
Yes, the Grohe functionality is unaffected (when it actually works...) |
Wow!!! Thanks erikkt! Then that is exactly what I will do! In my opinion the "local Grohe functionality" appears working well. I've got kids that once in a while forgets to completely turn off the tap, and the the Grohe Sense Guard always turns off the water. At least in my experience. I think is is just the cloud connection that really sucks. Again, thanks for this! |
I threw together some code to retrieve the token. Hopefully this could help integrating authentication in the HA integration! """ """
import html
import json
import re
import sys
from urllib.parse import urlparse
import requests
BASE_URL = 'https://idp2-apigw.cloud.grohe.com/v3/iot/'
LOGIN_URL = f"{BASE_URL}oidc/login"
def main():
args = [arg for arg in sys.argv[1:]]
if len(args) < 2:
raise ValueError("Need exactly 2 arguments: username, password")
login(args[0], args[1])
def login(username, password):
oauth_session = requests.Session()
redirect = oauth_session.get(LOGIN_URL, allow_redirects=False)
redirect.raise_for_status()
login_url = redirect.headers['Location']
login_form = oauth_session.get(login_url)
login_form.raise_for_status()
regex = r'action="([^ >"]*)"'
matches = re.findall(regex, login_form.content.decode('utf-8'), re.MULTILINE)
login_url = html.unescape(matches[0])
response = oauth_session.post(
login_url,
allow_redirects=False,
data={
"username": username,
"password": password,
})
response.raise_for_status()
token_url = urlparse(response.next.url)._replace(scheme="https").geturl()
token_result = oauth_session.get(token_url)
token_result.raise_for_status()
token = token_result.json()
print("== Successfully retrieved access token ==")
print(json.dumps(token, indent=4))
if __name__ == '__main__':
main() |
Thanks BR and good job |
Another question, do you know why data from HA differs taht data APP shows? Thanks |
Yes, and then you can run it in cli, like; |
Thanks to difficult to me, I don´t have pythonknowledge and show me a error Last login: Mon Jul 18 15:38:54 on ttys000 |
|
Thanks, Today is the third time I have to generate a new token. It seems I will till another integration will be ready. Impossible to manage it in this way. Thanks a lot for your time |
That doesn't sound right - are you sure you're using the refresh token? |
Yes, and it’s working for some time but after 2 hours HA show me an error in the token Any suggestions? |
Hi again @bendikrb After renewal token every two days, I need you help to implement this feature and get token in the easier way. How can I setup the command line sensor?. It means that this sensor will provide me the updated token ? Please, support me in this way if you have time. thanks |
I'm struggling with having to restart HA due to complaints about the refresh token. It does not seem to matter whether I get a new refresh token or not, but I'd also like to get help with automating this somehow. |
Hi @erikkt! Yesterday I had a chance to open up the Grohe Sense Guard and to short circuit the negative from power to the negative on the solenoid (just manually to test it out). It worked great. However, since you have to keep short circuiting the negative from power to the negative on the solenoid it appears to no longer be possible to use the button on the front of the Grohe Sense Guard or to use the app. Am I correct? Is this the way you have approached it? Looking forward to hearing back from you! Kindest regards, Magnus |
@seranoo |
I can highly recommend the proposal by @erikkt until (somwhere in the future...) when Grohe sorts out their app/token. That is, add a separate piece of hardware to provide negative power to the solenoid when you want to turn off the water. There is plenty of space inside of Grohe Sense, so anything will do really. Just push the two buttons on the sides and open the lid. erikkt used a wemos mini with relay card, and a small 12v->5v converter. I instead used a Shelly 1 running on 12V. Either solution is super easy and now is actually possible to be sure that the water is turned off when you want it to. No more having to rely on if the token for the day is working. |
After having giving the proposal by @erikkt some consideration I decided to hack the Grohe sense guard as suggested. To avoid the frustration of not being able to turn the water back on in case Home Assistant crashes I decided to add a momentary button and some configuration settings to ensure that power cycling the Grohe sense guard turns the water back on again. I've attached my yaml file for those of you that find that helpful. Warmly, Per |
Tried the python script, but get the following: Traceback (most recent call last): |
It just expired again, less than 48 hours after I created it last time.
…On Wed, 13 Apr 2022, 12:32 Joachim Wickman, ***@***.***> wrote:
Hi. Have no idea how often, but it's so often that it's annoying. I've
stopped using this integration until proper OAuth is implemented.
I've also noticed the same thing with Grohes own Android App. Have to sign
in again after some weeks. So could be the problems are coming from their
own services.
// Joachim
—
Reply to this email directly, view it on GitHub
<#23 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKPWGUMN62BOBVL4OG5O5TVE2PB5ANCNFSM5TELYF7Q>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
It looks like new refresh token is created everytime you access Grohe endpoint via mobile app. |
I implemented automatic token refresh on the sensor code: https://github.com/jahiekk/homeassistant-grohe_sense |
Hi Jahiekk,
Interesting! Thanks for sharing! I have been running on this branch for
about a year and it works pretty good. Have you implemented any other
changes aside from this branch?
#31
Den fre 30 aug. 2024 kl 06:45 skrev jahiekk ***@***.***>:
… I implemented automatic token refresh on the sensor code:
https://github.com/jahiekk/homeassistant-grohe_sense
—
Reply to this email directly, view it on GitHub
<#23 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKPWGR3XQ2MAJ5SCJEMH4LZT72GVAVCNFSM6AAAAABNLW2PBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRQGAZTEMRYGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Hi!
I really like this integration but I wanted to ask. I don't know if it is just me but how often do you guys need to create a new token? Mine usually only last for maybe two weeks then I need to get a new one.
Regards
Peter
The text was updated successfully, but these errors were encountered: