Skip to content
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

Python exampels #72

Closed
hanspnyholm opened this issue Mar 23, 2017 · 11 comments
Closed

Python exampels #72

hanspnyholm opened this issue Mar 23, 2017 · 11 comments

Comments

@hanspnyholm
Copy link

A example how to get doorlock (more than one doorlock) status out from module.
You hade that on the old version.

@persandstrom
Copy link
Owner

Do you mean something like:

import verisure
s = verisure.Session(username, password)
s.login()
s.get_overview()['doorLockStatusList']

Maybe there is a "smarter" way to get it similar to the get_door_window function, I will investigate that

@hanspnyholm
Copy link
Author

And how often can you request the status from the API whitout verisure get mad and block me.

@persandstrom
Copy link
Owner

persandstrom commented Mar 23, 2017 via email

@tomhur
Copy link

tomhur commented Mar 23, 2017

I have gotten this e-mail from verisure:

We have discovered that someone with your user credentials generates a high
amount of data traffic.
We really appreciate that you enjoy our system, and that you integrated it
with yours, but the current setup do not support the feature to
retrieve/send information from "My Pages", and to build your own
applications.
On 2016-07-19 there were 1 440 requests per 24 hours. Our acceptance level
for calls towards “My Pages” is 1 call per 30 minutes. At this level we
will not limit the access, for now. Please adjust your application
accordingly. We reserve the right to "throttle"/lock out users that
generates to much load that interfere with our systems.

@hanspnyholm
Copy link
Author

Wonder if the limit is the same now then we use the app api instead of my page api

@hanspnyholm
Copy link
Author

Do you mean something like:

import verisure
s = verisure.Session(username, password)
s.login()
s.get_overview()['doorLockStatusList']
Maybe there is a "smarter" way to get it similar to the get_door_window function, I will investigate that

A example to sort this data out should be great :)
Ex:
Dorr xxx: locked
Dorr yyy: unlocked

@persandstrom
Copy link
Owner

The data is in JSON format, I don't have a lock myself so I can't give you an answer.
Maybe this stack overflow post can give you some hints.

@hanspnyholm
Copy link
Author

hanspnyholm commented Apr 18, 2017

Got this working now.
You can maybe paste this as a exempel for doorlock status.
And remove this "issue".

import verisure
s = verisure.Session(username, password)
s.login()
print s.get_overview()['doorLockStatusList'][0]['currentLockState']

@Olen
Copy link

Olen commented Oct 27, 2018

They have some kind of rate limiting now.
I am trying to fetch the event log once a minute, and I get this quite frequently:

verisure.session.ResponseError: Invalid response, status code: 429 - Data: {"errorGroup":"TOO_MANY_REQUESTS","errorCode":"AUT_00021","errorMessage":"Request limit has been reached"}

@xibriz
Copy link

xibriz commented Oct 29, 2018

Does this mean that the app also stops working or is it a session limit so it would help to logout/login?

@Olen
Copy link

Olen commented Oct 29, 2018

I have not investigated thoroughly, but I believe it is the opposite.
I run the poller as a cron job, and what I have seen is that if I run it every minute, I will get this error quite often. If i run it every other minute, I hardly ever get the error (but I do get it occasionally).

So I basically do a reconnect every time, but I guess the app just keeps the connection open and runs the requests through the same connection many times.
Two minute polling is currently "good enough", although a nice webRTC-api would be really great...

I have thought of a few things that could be done to mitigate the issue - but I have not tested any of them to see if they actually work.

  • Connect with different usernames. It is easy enough to add a couple of more users, and do some kind of round-robin polling, logging in with different username/password each time.
  • Connect from different IP-addresses. This can be done using either a proxy, VPN-connection or if you have multiple addresses on your polling server.
  • Run the app that is connecting to Verisure as a deamon, and let other "front ends" pull data from that daemon. That will keep just one connection open over a long time - probably emulating how the mobile app is built.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants