8000 Home Assistant is blocked by the Rituals Perfume Genie API · Issue #47321 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Home Assistant is blocked by the Rituals Perfume Genie API #47321

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

Closed
milanmeu opened this issue Mar 3, 2021 · 13 comments
Closed

Home Assistant is blocked by the Rituals Perfume Genie API #47321

milanmeu opened this issue Mar 3, 2021 · 13 comments

Comments

@milanmeu
Copy link
Contributor
milanmeu commented Mar 3, 2021

The problem

Home Assistant is blocked by the Rituals Perfume Genie API.

I am in contact with sense company (the company that develops this rituals device). They are very helpful and answer quickly even after office hours. Home Assistant is blocked by the API because we are making too many requests. They are working on a solution so they can throttle your requests instead of blocking all Home Assistant users if you exceed a limit.

Integration causing the issue

rituals_perfume_genie

Link to integration documentation on our website

https://www.home-assistant.io/integrations/rituals_perfume_genie/

@probot-home-assistant
Copy link

@balloob
Copy link
Member
balloob commented Mar 4, 2021

Would a good first step be for us to drop our scan interval to 5 minutes?

@balloob
Copy link
Member
balloob commented Mar 4, 2021

And is it possible to get the states of all hubs in 1 request?

@milanmeu
Copy link
Contributor Author
milanmeu commented Mar 4, 2021

Would a good first step be for us to drop our scan-interval to 5 minutes?

The scan-interval should not be the problem. The app makes a request every 5 seconds, we do it every 30 seconds. According to Sense company, some users spam requests.
The config flow shows cannot connect and if the integration has already been configured platform not ready will be raised. Because of this, no one has an active integration trying to get updates. So dropping the update interval will not change the number of requests we are making now.

And is it possible to get the states of all hubs in 1 request?

No.
We can get information from all hubs in one request, but the power status is missing from such an overview. So we have to request each hub separately.

According to Sense company, there will be a limit of 30 requests per minute. Increasing the interval to every 20 seconds allows us to read 10 devices. Users usually do not have that many devices, so the remaining requests can be used by another application. I don't know if the requests from the app count towards this limit. I will ask.

@kingnlfung
Copy link

Just about to try this integration and found that it wasn't working.

I shall closely follow this thread.

@milanmeu
Copy link
Contributor Author
milanmeu commented Mar 5, 2021

I just received an email from Sense company that the home assistant has been unblocked. I have briefly tested the integration and it seems to work again.

@InsaneSoftware
Copy link
InsaneSoftware commented Mar 5, 2021

And is it possible to get the states of all hubs in 1 request?

According to Sense company, there will be a limit of 30 requests per minute. Increasing the interval to every 20 seconds allows us to read 10 devices. Users usually do not have that many devices, so the remaining requests can be used by another application. I don't know if the requests from the app count towards this limit. I will ask.

Hello,

Im a Software Engineer of Sense Company (yeas i was the one who blocked you guys in first place) but fear not!

Its working again and the throttling limits have been set.

Its possible to get all hub stats by the "/api/account/hubs/{accounthash}" endpoint (https://i.imgur.com/vUUAV8r.png)

The limit is 30 on each endpoint so basicly you can get the full list 30 times in a minute
You can also get 30 hubs details in a minute.

I recommended you do one request every 5-10 secs just not to overflood the api.

We love the user integrations of the rituals product like this home assistent and will create an open api later this year.

So far nobody should have any issues anymore.

Have fun!

@milanmeu
Copy link
Contributor Author
milanmeu commented Mar 5, 2021

Its possible to get all hub stats by the "/api/account/hubs/{accounthash}" endpoint (https://i.imgur.com/vUUAV8r.png)

We use this endpoint to get all hubhashes. The endpoint returns only the roomnamec attribute. We use the "/api/account/hub/{hubhash}" endpoint to get the roomc, speedc and fanc attributes.

@InsaneSoftware
Copy link
InsaneSoftware commented Mar 5, 2021

Ah i misread "all the stats" i tought the "online stats" its at the moment not possible to get all stats of hubs in one account with one endpoint. This would be a great idea indeed for the open api. Thanks for the feedback

@milanmeu
Copy link
Contributor Author
milanmeu commented Mar 5, 2021

This would be a great idea indeed for the open api.

It would be nice if the open API allows local poll and local push. This would probably require a device update, but it has advantages that are much appreciated by the Home Assistant community.

@hmmbob
Copy link
Contributor
hmmbob commented Apr 3, 2021

Just integrated our brand new Genie in HA - only the switch at this time. Would be really great if HA is able to set the "perfume strength" too, but I don't know if that's supported by the API. Use case would be to have a really light setting in the morning and somewhat stronger after dinner, for instance.

@milanmeu Milan let me know if you need a tester sometimes - happy to help.

@milanmeu
Copy link
Contributor Author
milanmeu commented Apr 3, 2021

Hi @hmmbob

2021.3 only allows viewing the perfume strength in the switch attributes.
I will start working on perfume strength and room size after the sensor PR #48270 has merged.

I don't know if that's supported by the API

HA uses the same API as the Genie app so everything that is possible in the app can also be done in HA.
The python pyrituals package does not support setting a "perfume strength" yet so I have to work on this first.

Perfume strength (speedc in the api) changes the speed of the fan. Do you know what room size does, is it useful to integrate it into home assistant?

I don't have a V2.0 Genie so I hope the sensor will work.

If you have more questions or feedback you can let me know on the forum: https://community.home-assistant.io/t/restful-or-not-rituals-perfume-genie/167112

@milanmeu
Copy link
Contributor Author
milanmeu commented Apr 3, 2021

I am closing this issue. The API has changed to allow only 30 requests per minute so we can't spam, thanks @InsaneSoftware.

HA makes 2 requests per minute per device to get the latest state. Usage of the switch uses 1 additional request. The sensors in PR #48270 won't make additional requests, we use a DataUpdateCoordinator. Config flow requests have their own limit.
Using the official Genie app makes at least 6 requests per minute. You can calculate if you are making too many requests but there shouldn't be a problem unless you want to make your house smell like a Rituals shop 😄.

Further questions or feedback about the integration can be send on the forum: https://community.home-assistant.io/t/restful-or-not-rituals-perfume-genie/167112

@milanmeu milanmeu closed this as completed Apr 3, 2021
@github-actions github-actions bot locked and limited conversation to collaborators May 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants
0