fuzzymistborn / python-eufy-security Goto Github PK
View Code? Open in Web Editor NEWPython library for Eufy Security cameras
License: MIT License
Python library for Eufy Security cameras
License: MIT License
Should it be considered possible to commit param changes via your framework? I am able to pull params for my camera with:
camera = list(api.cameras.values())[0]
print(camera.params)
Which lists parameters, such as 1716: 0, this being the LED. However, when I execute the following def I threw together:
async def async_turn_on_led(self) -> str:
"""Start the camera LED"""
await self._api.request(
"post",
"app/upload_devs_params",
json={
"device_sn": self.serial,
"station_sn": self.station_serial,
"params": [{"param_type": "1716", "param_value": "1"}]
},
)
await self.async_update()
camera.async_turn_on_led
I still get a status of 1716: 0 for the LED when pulling the params with the above.
Otherwise, if I reuse your async_start_detection function with the values changed for the LED, I have the same issue.
async def async_turn_on_led(self):
await self.async_set_params({1716: 1})
camera.async_turn_on_led
It does not appear to change the state when I pull the camera params again. Is this expected behavior, not being able to change the state via app/upload_devs_params?
Describe the bug
device_type enumeration appears to be stale, Eufy has released a number of new devices and types since this module was last updated.
I found this, oddly, because the example code iterates through devices as if they all are cameras, thinking the driver was 'smart' and the type code was being invoked 'under the hood' for something magic in the class that indicated to the API this was specific for cameras (apparently eufy calls pretty much anything a 'camera', lol!). Looking deeper, there's no magic, so the example crashes if there is a device returned in the list (such as a sensor) and it tries to retrieve an image URL for such an object. Then I went, 'hey, what version got installed by pip?' and it was even older than this repo.
So... I guess the readme needs a short update to suggest install from git, along with updated enumerations, and there's that note about 'deprecated is_camera' property that is used in the example anyways
We should set up continuous integration through Travis CI so that as the library grows, we can ensure that it builds correctly, continues to pass the test suite, etc.
@FuzzyMistborn I can do the work inside the repo, but I will need you to set up the integration with Travis CI. I've done this before, so let me know if you need help.
HA downgraded it in home-assistant/core#28143 so there are version conflicts now if the package is installed from the source.
I am interested in downloading all the saved videos from the doorbell. Looking at the library, it seems that it only starts a stream.
HI !
Many thanks for this component.
I have install the custom componet , configure the configuration.yaml username and password (second account)
But i receive an error, can’t configure…
(MainThread) [homeassistant.setup] Setup failed for eufy_security: No setup function defined.
We've got the basics regarding camera stream/images. Most important to me is the ability to control certain aspects of the cameras, like the schedule (ie disable motion sensor), and maybe even turn the chime on/off.
I've tried doing a MITM to try to uncover more but can't get it to work. Other ideas welcome.
I have limited resources right now.
It would be awesome if someone integrates that package though: https://github.com/nonsleepr/python-eufy-security-mqtt
Is your feature request related to a problem? Please describe.
EUFY encrypts the SD card, but don't allow exporting all the videos, and the user need to download from app one by one. Which is basically impossible, since there are too many videos.
This is annoying to the point that, if I could, I would just disable the encryption. But EUFY don't allow that for whatever reason.
Describe the solution you'd like
An Python API to list / download videos from a indoor cam 2k.
I am happy to contribute to the repo if there are some pointers for how to add the functionality. Thank you!
Describe the solution you'd like
I have looked through the api code but have not been able to determine if it is possible to change the mode of the base station (away, home, disarmed) using this api?
The bug
I am trying the example code posted on the git, however I get the following error
There was a/an <class 'eufy_security.errors.RequestError'> error: There was an unknown error while requesting passport/login: 403, message='Forbidden', url=URL('https://mysecurity.eufylife.com/api/v1/passport/login')
I also tried creating a new account with no 2FA and sharing devices with the account as an admin.
Is it possible that eufy tightened their API access?
I just received the indoor cam 2K pan&tilt. It will be nice to have it supported with this library. I have some basic coding knowledge and I can help with the debug. So far I noticed that there are a lot of new params and some of them are updated, i.e. motion detection switch is changed to 6040 and sound detection switch is 6043. I cannot figure out how to control the pan&tilt function.
I'm getting the following as of a couple of days. The error occurs immediately at startup. Any ideas?
[16:15:25] INFO: starting original stuff...
> [email protected] start /app
> NODE_ENV=production node --unhandled-rejections=strict index.js
info: Migrating the database... {"timestamp":"2021-03-17T15:15:30.376Z"}
(node:356) UnhandledPromiseRejectionWarning: Error: Request failed: https://mysecurity.eufylife.com/api/v1/passport/login -> 100028 - Failed to request.
at /app/node_modules/eufy-node-client/build/http/http.utils.js:24:15
at Generator.next (<anonymous>)
at fulfilled (/app/node_modules/eufy-node-client/build/http/http.utils.js:5:58)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:356) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `NODE_ENV=production node --unhandled-rejections=strict index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-03-17T15_15_31_476Z-debug.log
Hi,
I need simple example script to turn on and off the night vision of my Eufy indoor cam.
The example script works well but I don't know how I can add the code to turn on and off night vision.
Please give me some example.
Thanks!
Is your feature request related to a problem? Please describe.
Is it possible that the security motion and entry sensors be integrated within this python eufy security library please?
See nonsleepr/ha-eufy-security#2 for details.
Here's the list of possible domains from the Android app:
security-app.eufylife.com (default/US)
security-app-eu.eufylife.com (EU)
security-app-pr.eufylife.com (PR)
security-app-ci.eufylife.com (is that continuous integration?)
security-app-qa.eufylife.com (quality assurance?)
security-app-sqa.eufylife.com (short quality assurance)
Fetch cameras from get_devs_list
, try to access cover image for a camera, an exception is raised if that device isn't a camera because it won't have cover_path
in the device's json response object. The solution is to detect the device type and initialize the corresponding object for a given device:
BATTERY_DOORBELL = 7,
CAMERA = 1,
CAMERA2 = 9,
CAMERA2C = 8,
CAMERA_E = 4,
DOORBELL = 5,
FLOODLIGHT = 3,
INDOOR_CAMERA = 30,
INDOOR_PT_CAMERA = 31,
KEYPAD = 11,
LOCK_ADVANCED = 51,
LOCK_BASIC = 50,
LOCK_SIMPLE = 52,
MOTION_SENSOR = 10,
SENSOR = 2,
STATION = 0
Source: https://github.com/bropat/ioBroker.eufy-security/blob/master/src/lib/eufy-security/http/types.ts
For example, the door sensor with device_type = 2
would have state
property instead of last_camera_image_url
. To get the open/closed state of a door sensor:
param = next(filter(lambda p: p['param_type'] == 1550, device['params']), None)
status = 'open' if param['param_value'] == '1' else 'closed'
print(f'Door sensor is {state}.')
Source: https://github.com/alanhamlett/eufy-garage-door-watcher/blob/main/watch_garage_door.py#L40
Just an open question, i see there are some other forks but I was wondering if the core project is still being maintained
Describe the bug
If a user has 2FA enabled on their Eufy account, the login process fails due to not finishing the authentication flow
To Reproduce
Steps to reproduce the behavior:
"msg": "need validate code",
Expected behavior
I expect the login process to detect the need for a validation code and to execute the additional steps needed (detailed below)
Additional context
By inspecting the traffic sent by my browser, I was able to work out that the flow can be completed as follows in Postman:
{
"email": "[email protected]",
"password": "Some-g00d-password"
}
"msg": "need validate code"
and "data": { "auth_token": "12baeasd..." }
like so:
{
"code": 26052,
"msg": "need validate code",
"data": {
"user_id": "abc12343w534535rer",
"email": "[email protected]",
"nick_name": "user",
"auth_token": "12baeasdfasdfawerawefasdfasdfasdf",
"...": "..."
}
}
X-Auth-Token: <the auth token value from the response above>
with the body
{
"message_type":2
}
X-Auth-Token: <the auth token value from the response above>
with the body
{
"email": "[email protected]",
"password": "Some-g00d-password",
"verify_code": "< code from my email >"
}
"msg": "ok"
I am not sure how to work this flow into this repo's code but doing so would make it work with 2FA enabled accounts.
I read that the api changed? Does this pyhton script still work?
Thanks!
Hello,
Not an issue, but a question:
Are those API calls official or where they sniffed ?
In other words, could we expect this beautiful job to brake whan Anker/Eufy decides so ?
Thank you.
Aymeric
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
program connects successfully and lists device details
Additional context
In reality I get an error.
python3 blah.py Traceback (most recent call last): File "/Users/jrlambs/projects/python/eufy/blah.py", line 30, in <module> asyncio.get_event_loop().run_until_complete(main()) File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/Users/jrlambs/projects/python/eufy/blah.py", line 12, in main api = await async_lo websession) File "/Users/jrlambs/Library/Python/3.9/lib/python/site-packages/eufy_security/api.py", line 130, in async_login await api.async_update_device_info() File "/Users/jrlambs/Library/Python/3.9/lib/python/site-packages/eufy_security/api.py", line 57, in async_update_device_info devices_resp = await self.request("post", "app/get_devs_list") File "/Users/jrlambs/Library/Python/3.9/lib/python/site-packages/eufy_security/api.py", line 114, in request raise RequestError( eufy_security.errors.RequestError: There was an unknown error while requesting app/get_devs_list: 403, message='Forbidden', url='https://security-app.eufylife.com/v1/app/get_devs_list
Just in case people miss it in the Readme, going to sticky this to the top.
You can open issues, but do not expect them to get answered/fixed.
I plan to archive this repo in a couple of months.
Is your feature request related to a problem? Please describe.
I've managed to connect to my camera by following the examples/test_api.py
code but this does not show how we can get motion detection alerts.
Describe the solution you'd like
Is it possible to provide an example on how we can extend the above code to detect motion alert from the eufy security camera
Thanks!
Describe the bug
Incorrect encoding description for /passport/login for enc
parameter.
It is written that Password encoding: * 2 - base64
When enc: 2
password is encoded with AES encryption and then encoded with base64.
Fix
AES parameters:
AES/CBC/PKCS7Padding
IV key: 000000009yXOowyd
Secret key: 000000009yXOowyd
The result of AES is encoded into base 64.
You can use https://www.devglan.com/online-tools/aes-encryption-decryption to check.
We're in a good spot to release 0.0.1 to PyPI. Waiting on @FuzzyMistborn to ensure he has an account (so that he can be added as a maintainer).
This line is an offender (it assumes data
is always present but it's not.
Related to nonsleepr/ha-eufy-security#2.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.