#Risco
1 messages ยท Page 1 of 1 (latest)
Does it use an injected clientsession?
And sidenote, I think this question would've been a better fit in integration owners or developers, as this isn't directly focused to the core team
You're right, sorry
and yes, we're passing the session to the library:
https://github.com/home-assistant/core/blob/f2c20fedebbe34e415e9c0887bd6fdbf4c1131a5/homeassistant/components/risco/__init__.py#L135
I'll try that
It's failing with async_create_clientsession as well
How did you test new session?
Custom component, using the new session
I also reached out to Risco with these findings, but not sure I'll get a response
Is not using a HA session an acceptable solution?
I guess that would work, It's interesting why it doesn't take a newly created one
Is there a way to mimic an HA session outside of HA for testing purposes? What's "different" about the session? User agent?
SERVER_SOFTWARE = (
f"{APPLICATION_NAME}/{__version__} "
f"aiohttp/{aiohttp.__version__} Python/{sys.version_info[0]}.{sys.version_info[1]}"
)
this is the user agent
that one is indeed different
I believe there are some more things, you can check the aiohttp_client class for that
It's the user agent indeed. If it contains "HomeAssistant" the API is returning 403. Trying to fix this with Risco. What can we do if they can't help?
Find Jens ๐
I guess change user agent, but like, if they are specifically blocking us, then it will become a cat and mouse game
Yeah, he's on the correspondence ๐
@severe silo if you can change the user agent in the library, we can ship that today
as in override the agent in the existing session?
Ok, can I do this with the shared session or do I also need to switch to async_create_clientsession?
you can just pass it as a header to your request in the library
the the shared session is fine
but you have to be quick probably
for 2026.4.2
Proposed change
Bump the library to version 0.6.8, which sets a custom user agent to workaround Risco blocking the HA user agent.
I do not have a cloud subscription, but was able to test that I&am...
Did I make it in time?
Seems like it. Just done with dinner so didn't check
We were blocked because of rate limit ๐คฆโโ๏ธ . I guess I'll add a limit to the polling frequency
You got that from Jens?
From his contact
I guess we passed some threshold
they have one per user agent?
I don't have all the details yet (we're scheduling a call), but I guess their WAF picked it up. The main user agent would be their app, so HA probably does stand out
I don't think they get a lot of web traffic
Good call with Risco. They'll make sure we don't get blocked again, but asked that we set a polling minimum (seems that a lot of users are setting a 1 second polling frequency). They'll also suggest a push-based mechanism going forward.
push based is always nice
you can implement a debouncer in the coordinator
tado and iometer have that for example
Like when I have meetings with companies I am also like, yes, thank you for having us use your API, and if there are people that do not make use of it correctly, then feel free to take action
We explicitly ask for a scan interval (this was before the recommended mechanism), so I was thinking of just adding a minimum in the options flow (and migrate existing config entries), until we set up the push based option
yeah, but that would mean two actionable breaking changes vs 1
so:
- break change - we no longer have scan interval, please configure it yourself
- scratch that, no more scanning at all
vs.
- The new minimum is 5 seconds. You don't need to do anything, just know that if you had it under 5s, your automations are not going to trigger as quickly
- No more scanning, you don't need to do anything
And I can actually just add the minimum in the coordinator, and keep the options flow as is