bropat / ioBroker.eusec

This ioBroker adapter allows to control Eufy security devices by connecting to the Eufy cloud servers.
MIT License
134 stars 17 forks source link

Feature request: Support devices without station #5

Closed elo79 closed 3 years ago

elo79 commented 3 years ago

Hi, thanks for your great work. I´m really looking forward for this adapter. I own the wired doorbell: https://www.eufylife.com/products/variant/video-doorbell-2k-wired/T82001J1 and the indoor dome camera: https://www.eufylife.com/products/variant/indoor-cam-2k-pan-and-tilt/T8410121 I don´t have a homebase as theese devices don´t need one, which was the main reason I bought them.

Both devices show up with their attributes. However there´s no option to change the guard mode or any other functionality.

Is this becuase of the missing homebase?

If you need any logs I´m happy to support you.

Best, Bjoern

bropat commented 3 years ago

Hi elo79,

the change of guard mode is only supported with a homebase at the moment. Currently i'm working on the push notification integration needed by 2FA and for event notification (movement detection etc.). Once this is complete, I can continue with other integrations. :)

bropat commented 3 years ago

@elo79 Can you send me some debug logs to understand what the difference is between with station and without?

Thanks!

elo79 commented 3 years ago

Sure, I sent you the logs via E-Mail.

bropat commented 3 years ago

Hi,

could you test the new released version (0.0.3) and tell me if there are any improvements?

Thanks!

bropat commented 3 years ago

@elo79 Can you test the last version (0.0.8) and tell me if there are any improvements?

Thanks!

bropat commented 3 years ago

@elo79 i would now implement support for devices without a station. But I need your help with that. Please let me know if you would be available. :)

FuzzyMistborn commented 3 years ago

I'm testing this myself and I can't update the guard mode or have the mode status updated when I change it in the app. Running the latest version (FYI I am a ioBroker newb, just trying this out)

bropat commented 3 years ago

@FuzzyMistborn From what I have seen so far, when changing the Guard mode without a station, this is done via the HTTP interface and not the P2P interface. I am trying to understand how to best understand when to use which interface. Changing the guard mode via the HTTP interface is relatively clear to me how it is done. Updating the status of guard mode without a station is done by querying the HTTP interface every x minutes (default setting: 10 min.) or, if you have enabled push notification in the app, via it.

If you want to help me, please enable the debug mode of the adapter and test changing the guard mode. After that please send me the logs (attention: the logs contain sensitive data).

Any help is welcome :)

FuzzyMistborn commented 3 years ago

Gotcha, I upped the polling to 5 minutes and it picked up the change from the app. I'll get you a log later for changing from ioBroker.

bropat commented 3 years ago

@FuzzyMistborn In the meantime I had an idea how to implement the change of guard mode in a transparent way also for devices without station (in fact they are a station themselves). I think to release in the next days a new version with this support.

FuzzyMistborn commented 3 years ago

Ok logs sent via email.

TechBrain64 commented 3 years ago

@bropat, If you're needing some else to test code for T8200 doorbell, let me know. I've recently installed it and looking to integrate into HA.

bropat commented 3 years ago

@TechBrain64 Since I don't have a doorbell, I need someone to do some testing, but also someone to invite me to their eufy security account as a "test person" for a few hours so I can track the original app's communication. Without this, it will take much longer to implement a good integration. Let me know if you would be willing to do this :)

TechBrain64 commented 3 years ago

@bropat

As stated I'm willing to help out, but being very security conscious as I am my help will have to come from your first option. Now I should clarify my config, due to the fact Eufy doesn't proxy the mobile app connection back to the doorbell, but rather expects users to allow any ip/port range into their network; I currently cannot use the app outside my network. I don't use their cloud storage (all managed/viewed locally only).

bropat commented 3 years ago

@TechBrain64 I understand, you're welcome. Please test the new version 0.0.9 in debug mode and then send me the logs after you have tested as much as possible on the doorbell (Attention: the logs contain sensitive data).

FuzzyMistborn commented 3 years ago

0.0.9 seems to be working to change guard mode from inside iobroker.

TechBrain64 commented 3 years ago

How do I go about installing your code?

FuzzyMistborn commented 3 years ago

I'm not seeing motion events get detected though. Not sure if that's a separate issue.

@TechBrain64 install iobroker via docker. I installed this repo via the command line by using docker exec -it but i'm sure there are other ways (not very knowledgeable with all things iobroker).

TechBrain64 commented 3 years ago

Thanks @FuzzyMistborn, I did see in the HA post someone mentioned docker. I've installed Ubuntu VM with docker and Portainer; which is up and running. But now I'm trying to figure out how to get ioBroker.eufy-security deployed. I'm trying to find the right path/entry point to pull in the container.

FuzzyMistborn commented 3 years ago

You can't deploy this repo independently. You need to run the iobroker docker container itself. Here is my docker-compose section for iobroker:

  iobroker:
    image: buanet/iobroker:latest
    container_name: iobroker
    ports:
      - "8081:8081" #Main
      - "8082:8082" # Web Interface
      - "8087:8087" # Rest API
    volumes:
      - /home/fuzzy/docker/iobroker:/opt/iobroker
    environment:
      - LANGUAGE="en_US:en"
    restart: always
TechBrain64 commented 3 years ago

@FuzzyMistborn, why is your composer pulling the container from "buanet/iobroker:latest" instead of @bropat?

FuzzyMistborn commented 3 years ago

Because this isn't a docker container. It's an adapter/integration that runs via ioBroker. So first you need to install ioBroker, and the docker image to do that is buanet/iobroker:latest

TechBrain64 commented 3 years ago

Alright, I have it running and can access with web interface. What now?

FuzzyMistborn commented 3 years ago

See the HASS Community forum page, I wrote up a blog post explaining what to do.

bropat commented 3 years ago

I'm not seeing motion events get detected though. Not sure if that's a separate issue.

@FuzzyMistborn Currently the motion events are only received via the push notification, if you have disabled this in the Eufy app, then the adapter will not receive anything.

I know that the Doorbell also has an MQTT interface, but it's not implemented at the moment (not easy to do without a device or access via an account). If I remember correctly I read somewhere that there is no more notification through this interface.... Can you confirm that for me?

By the way nice post on your blog ;)

FuzzyMistborn commented 3 years ago

Currently the motion events are only received via the push notification, if you have disabled this in the Eufy app, then the adapter will not receive anything.

I have them enabled, except when I disable in certain situations. But I wasn't seeing updates in ioBroker. And I tried pushing them to MQTT to see if I could find them there and no luck.

I know that the Doorbell also has an MQTT interface, but it's not implemented at the moment (not easy to do without a device or access via an account). If I remember correctly I read somewhere that there is no more notification through this interface.... Can you confirm that for me?

I believe there also is an MQTT interface for the doorbell but it's beyond my skill to understand. The last I saw discussing an MQTT connection was here: https://github.com/FuzzyMistborn/python-eufy-security/issues/43

By the way nice post on your blog ;)

Thanks, there were a lot of people asking for how to do so I figured I'd write something up to guide people. Thanks for the great adapter!

bropat commented 3 years ago

@FuzzyMistborn Try to enable debug mode on the ioBroker adapter and see if you see anything like this in the logs:

2020-12-29 15:50:12.944 - debug: eufy-security.0 (18566) PushClient.handleParsedMessage(): DataMessageStanza: message: {"tag":8,"object":{"id":"B051F7BD","from":"348804314802","to":"<REDACTED>","category":"com.oceanwing.battery.cam","appData":[{"key":"content","value":"Arming change"},{"key":"device_sn","value":""},{"key":"event_time","value":"1609253399766"},{"key":"payload","value":"<REDACTED>"},{"key":"push_time","value":"1609253400320"},{"key":"station_sn","value":"T8010P23XXXXXXXX"},{"key":"title","value":"Eufy Security"},{"key":"type","value":"0"},{"key":"google.c.sender.id","value":"348804314802"}],"persistentId":"0:1609253400331173%0d2a775cf9fd7ecd","ttl":3600,"sent":"1609253400328"}}

2020-12-29 15:50:12.947 - debug: eufy-security.0 (18566) handlePushNotifications(): push_msg: {"id":"B051F7BD","from":"348804314802","to":"<REDACTED>","category":"com.oceanwing.battery.cam","persistentId":"0:1609253400331173%0d2a775cf9fd7ecd","ttl":3600,"sent":"1609253400328","payload":{"content":"Arming change","device_sn":"","event_time":"1609253399766","payload":{"a":9,"s":"T8010P23XXXXXXXX","t":"1609253399","arming":1,"mode":1,"alarm":0,"alarm_delay":0,"user":2,"user_name":"<REDACTED>"},"push_time":"1609253400320","station_sn":"T8010P23XXXXXXXX","title":"Eufy Security","type":"0","google.c.sender.id":"348804314802"}}

You need to search for log messages with the handlePushNotifications() or PushClient.handleParsedMessage() "tag".

I read the MQTT discussion linked above and take away the following:

MQTT only works with wired doorbell (T8200).

https://github.com/nonsleepr/python-eufy-security-mqtt

TechBrain64 commented 3 years ago

@FuzzyMistborn,

I have the eufy.security adapter configured, but getting syntax errors for your blog examples; in particular the one for guard mode. I am however able to get the last picture event image, but it doesn't change.

What is the correct syntax and file these belong in?

Also, I wonder if these environment settings of the iobroker container may have some impact. I'm in the US and CST timezone.

LANG | de_DE.UTF-8 LC_ALL | de_DE.UTF-8 TZ | Europe/Berlin

FuzzyMistborn commented 3 years ago

Can you head over to the HASS forum to continue this? I'd rather not be filling up an issue thread with support on an unrelated issue.

TechBrain64 commented 3 years ago

@bropat ,

Thought I'd share some observations I've found about the Eufy App/Camera workflow.

bropat commented 3 years ago

@TechBrain64 Thanks for the logs. This allowed me to fix some bugs, including fixing support for the doorbell push notifications. :)

@FuzzyMistborn Could you please install the adapter version from develop branch and check if the doorbell push notifications work now? To install the adapter version from the develop branch follow this guide.

FuzzyMistborn commented 3 years ago

Nope still no luck on the doorbell press.

Also not sure if you saw this: https://github.com/matijse/eufy-ha-mqtt-bridge . Might be useful?

bropat commented 3 years ago

@FuzzyMistborn eufy-ha-mqtt-bridge it's based on eufy-node-client, where I'm collaborating ;). At the moment my work is more advanced than eufy-node-client, because I don't have the time to continue both.

Can you send me the logs to identify the issue?

bropat commented 3 years ago

@FuzzyMistborn I think i found the issue. Try the last develop version :)

FuzzyMistborn commented 3 years ago

Bingo. Haven't had a chance to test motion but doorbell press worked.

bropat commented 3 years ago

@FuzzyMistborn

I have revised push notification to properly support wired and battery doorbell notifications. Further it's saves the picture locally with state last_captured_pic_url / last_captured_pic_html. Can you verify if there are no regressions? :)` When you have time could you check out the other events as well?

Thanks!

FuzzyMistborn commented 3 years ago

Doorbell ring still works. Didn't get a "motion_detected" event, but "person detected" went to "true" (and is now stuck at true). No image located in "last_captured"

bropat commented 3 years ago

@FuzzyMistborn

Doorbell ring still works.

That's good :)

Didn't get a "motion_detected" event, but "person detected" went to "true" (and is now stuck at true).

motion_detected is only triggered if no person_detected is triggered. Same as in the Eufy app (taken from the source code of the app). It shouldn't stuck, but reset itself after x seconds (configurable parameter in the adapter => Time in seconds before event reset; Default: 15 seconds).

No image located in "last_captured"

It depends on whether Eufy sends pic_url with a value in the push notification or not. ;) In this case, probably not. But I can understand it through the debug logs if you send them to me.

Solilord commented 3 years ago

Hey. Luckily i read through the open issues. Ive also got an 2K Pan-Tilt and installed your adapter.

The camera is recognized and all states work EXCEPT livestream and event pics. Unfortunately the impotant ones :D

If i can also help you with that just let me know :)

FuzzyMistborn commented 3 years ago

motion_detected is only triggered if no person_detected is triggered. Same as in the Eufy app (taken from the source code of the app). It shouldn't stuck, but reset itself after x seconds (configurable parameter in the adapter => Time in seconds before event reset; Default: 15 seconds).

Well that makes sense, except that my "person detected" has been "true" for 3 days :laughing:

PrayerfulDrop commented 3 years ago

Any update when the pan/tilt camera's guard/current mode code will be merged? I am currently on 0.1.3.

bropat commented 3 years ago

@FuzzyMistborn

except that my "person detected" has been "true" for 3 days 😆

That's strange... Is it possible that you restarted the adapter after receiving the event? I ask because the event is reset after X seconds (adjustable in the settings; default: 15 seconds) and if within this time interval the adapter is restarted, then I can imagine this misbehavior.

bropat commented 3 years ago

@PrayerfulDrop

I don't have a pan/tilt camera, so I can't integrate it without help. If you want to help, please enable the debug mode of the adapter and send me the logs after you tried to change the guard mode. Or maybe the Guard mode is not shown to you at all because this camera is not detected as a station? Unfortunately, I can only understand this on the basis of the debug logs...

Let me know.

FuzzyMistborn commented 3 years ago

That's strange... Is it possible that you restarted the adapter after receiving the event? I ask because the event is reset after X seconds (adjustable in the settings; default: 15 seconds) and if within this time interval the adapter is restarted, then I can imagine this misbehavior.

Possibly. How would I fix if I did? I've tried restarting ioBroker without luck.

Also @PrayerfulDrop changing guard mode with my pan/tilt just fine.

PrayerfulDrop commented 3 years ago

That's strange... Is it possible that you restarted the adapter after receiving the event? I ask because the event is reset after X seconds (adjustable in the settings; default: 15 seconds) and if within this time interval the adapter is restarted, then I can imagine this misbehavior.

Possibly. How would I fix if I did? I've tried restarting ioBroker without luck.

Also @PrayerfulDrop changing guard mode with my pan/tilt just fine.

How are you enabling this? What version of the adapter? I try to change it and it isn’t recognized.

FuzzyMistborn commented 3 years ago

How are you enabling this? What version of the adapter? I try to change it and it isn’t recognized.

Latest version of the adapter. And nothing special, it should just work. If it doesn't there's a bug and you need to provide some logs to figure out what's going on.

bropat commented 3 years ago

@FuzzyMistborn

Possibly. How would I fix if I did? I've tried restarting ioBroker without luck.

A corrected version (0.1.4) has now been released. :)

FuzzyMistborn commented 3 years ago

Well we're not showing "true" anymore so progress! Will report back once I get some motion events.

DieguitoCigala commented 3 years ago

If you want I can share my logs with you. I have a 2K Pan-Tilt camera.

bropat commented 3 years ago

Hi @DieguitoCigala,

gladly, once I get around to integrating the 2K pan-tilt camera, I'll get back to you on that :).