#Risco

1 messages ยท Page 1 of 1 (latest)

surreal umbra
#

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

severe silo
#

You're right, sorry

surreal umbra
#

It might very well be cookies

#

so instead use async_create_clientsession

severe silo
#

I'll try that

severe silo
#

It's failing with async_create_clientsession as well

surreal umbra
#

How did you test new session?

severe silo
#

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?

surreal umbra
#

I guess that would work, It's interesting why it doesn't take a newly created one

severe silo
#

Is there a way to mimic an HA session outside of HA for testing purposes? What's "different" about the session? User agent?

surreal umbra
#
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

severe silo
#

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?

surreal umbra
#

Find Jens ๐Ÿ˜‚

#

I guess change user agent, but like, if they are specifically blocking us, then it will become a cat and mouse game

severe silo
#

Yeah, he's on the correspondence ๐Ÿ™‚

surreal umbra
#

@severe silo if you can change the user agent in the library, we can ship that today

severe silo
#

as in override the agent in the existing session?

surreal umbra
#

yes

#

to PyRisco or so

severe silo
#

Ok, can I do this with the shared session or do I also need to switch to async_create_clientsession?

surreal umbra
#

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

severe silo
#

Did I make it in time?

surreal umbra
#

Seems like it. Just done with dinner so didn't check

severe silo
#

We were blocked because of rate limit ๐Ÿคฆโ€โ™‚๏ธ . I guess I'll add a limit to the polling frequency

surreal umbra
#

You got that from Jens?

severe silo
#

From his contact

surreal umbra
#

right

#

why that happen now?

severe silo
#

I guess we passed some threshold

surreal umbra
#

but that sounds like they changed it

#

because we didnt

severe silo
#

But we have more people using the integration

#

natrual growth

surreal umbra
#

they have one per user agent?

severe silo
#

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

severe silo
#

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.

surreal umbra
#

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

severe silo
#

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

surreal umbra
#

Oh

#

IMO, ideally we remove that lol

severe silo
#

yeah, but that would mean two actionable breaking changes vs 1

#

so:

  1. break change - we no longer have scan interval, please configure it yourself
  2. scratch that, no more scanning at all

vs.

  1. 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
  2. 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

surreal umbra
#

I think we can do the latter

#

5 seconds is still very quick

#

we can take that to the patch tomorrow