-
Notifications
You must be signed in to change notification settings - Fork 47
Implement P2P protocol for device control #44
base: dev
Are you sure you want to change the base?
Conversation
eufy_security/types.py
Outdated
| ] | ||
|
|
||
| def is_station(self): | ||
| return self in [DeviceType.STATION, DeviceType.FLOODLIGHT] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return self in [DeviceType.STATION, DeviceType.FLOODLIGHT] | |
| return self in [DeviceType.STATION, DeviceType.FLOODLIGHT, DeviceType.DOORBELL] |
|
Looks promising. Wasn't able to connect to the my doorbell with that yet though. Will dig deeper. |
| @@ -0,0 +1,69 @@ | |||
| import asyncio | |||
|
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to import logging here and add something like:
_LOGGER: logging.Logger = logging.getLogger(__name__)
|
I think I figured out why it's not working with the doorbell: When you do discovery, STUN servers actually send your (client's) host/port to the doorbell. Since you open a new connection (with a new port) to connect to every new host, the doorbell gets the port different from the one you're using to connect to it. You should open only one connection and use it to communicate with everything. |
|
Ah, that does makes sense, but it seems like @joepadmiraal's attempt wasn't even getting that far -- it didn't seem like there was even a valid response from the discovery servers. |
|
Could be |
|
I'm replying here instead of in the issue to concentrate our findings. And sometimes I get this output. In this case it will hang (waited for 2 minutes) instead of stop the program. |
|
Sweet! So I think you're getting around the NAT issues that @nonsleepr might be hitting since you’re accessing your device over LAN, but it's at least looking more promising. It seems like it was able to communicate with the doorbell and is stuck because it didn't receive a packet that I expected it should based on my own testing. Can you try the latest commit and share another tcpdump if it still hangs? |
|
Seems better now: Do you still want the a new tcpdump? |
|
Nope, from the output it looks like it ran successfully. It should have momentarily turned on the on screen watermark (the Eufy logo in the top left) of the live video feed for a couple seconds and then turned it off. Can you confirm that actually happens? Also, to clarify, do you have a wired or wireless doorbell? |
|
The watermark is successfully added and removed in the video. |
I'm trying to connect over internet and not getting the response from the doorbell (I explained the reason above). (my own implementation using single connection works, BTW, I'll see if I can release that). |
|
@keshavdv and @nonsleepr u guys gave up on this ? Or can I still check out this branch and give it a shot ? |
Describe what the PR does:
This is an initial attempt at implementing the peer to peer protocol in Python that is heavily based on https://github.com/fbertone/lib32100 combined with Eufy-specific elements. I only have a single "standalone" device (floodlight) so I can't test certain features that I know won't work just yet. Apart from that, it does seem to at least work (see added example for usage) but I imagine there needs to be a discussion on the best API to expose from within this library to make it more friendly for other applications so there still aren't any unit tests.
Does this fix a specific issue?
Nope, new feature.
Checklist:
README.mdwith any new documentation.AUTHORS.md.