matijse / eufy-ha-mqtt-bridge

Receive Eufy alerts and thumbnails in Home Assistant via MQTT
124 stars 25 forks source link

Feature request: Modi supported #19

Open skank01 opened 3 years ago

skank01 commented 3 years ago

Again no rush, but if we could change the modi "home, away , ..." too within HA... it would rock. No idea if that will be possible

timdonovanuk commented 3 years ago

Also things like "silence chime" etc.

I'm unsure if stuff like this can even be supported though? Not sure how this bridge works, if it simply captures events or can do two way communication.

mikedrawback commented 3 years ago

There are examples in the eufy node client of changing the mode, so it might be possible eventually

eufy node client examples - p2p change mode

r77s commented 3 years ago

Yes. This would be a nice feature, because current the eufy app can't mix geofencing and time based mode. With this feature, this function can be automated in HA.

matijse commented 3 years ago

Yes this one is next on my todo list :) It's a bit more tricky, because it looks like it is only possible to send this command over the local network directly to the Home Base. I don't actually own any Eufy camera's, I was just developing this for friends and up until now used the remote API to test everything...

I noticed that changes in arming mode do come up as push notifications, so I will start by recording the mode. This also helps in creating an integration with Home Assistant, because after sending a command to change the mode, HA can show that it actually worked. I think I might be able to use the Alarm control panel integration (https://www.home-assistant.io/integrations/alarm_control_panel.mqtt/)...

In order to prepare this, can some of you help identify the different push payloads. I think the message format would be based on the Home Base, of which there are at least two versions. To export the payloads of your Home Base:

  1. Open a terminal and navigate to the "data" folder
  2. Run sqlite3 -csv database.sqlite "select * from push_payloads where type = 0" > export.csv
  3. Open the file in an editor and remove personal information. Your HomeBase serial number will start with the model number, so please leave the first 6 characters of the serial number. For example T8010PXXXXXXXXX
  4. Upload it here, together with your HomeBase type (HomeBase 1 or HomeBase 2 or ..?)

Example for Home Base 2:

308CF908|T8010PXXXXXXXXXX||0|{"id":"308CF908","from":"XXXXXXXXXXXXX","to":"XXXXXXXXXXXXXXXXXXX","category":"com.oceanwing.battery.cam","persistentId":"0:1611196396582151%0d2a775cf9fd7ecd","ttl":3600,"sent":"1611196396578","payload":{"content":"Arming change","device_sn":"","event_time":"1611196396101","payload":{"a":9,"s":"T8010PXXXXXXXXXX","t":"1611196396","arming":1,"mode":1,"alarm":0,"alarm_delay":0,"user":2,"user_name":"XXXXXXXXXXXXXXXXXX"},"push_time":"1611196396566","station_sn":"T8010PXXXXXXXXXX","title":"Eufy Security","type":"0","google.c.sender.id":"348804314802"}}

If you also have a Home Base 2, I only need all the data if it is completely different... if the structure is the same, it's enough to just mention that... Hopefully the structure is the same for everybody, which makes it easier to implement

mikedrawback commented 3 years ago

I have the floodlight camera, an indoor camera and the battery doorbell.

The floodlight and indoor camera are currently not supported by the homebase. These cameras do not have a notification when guard mode changes, but maybe there is a way to poll them locally for the current mode. Battery drain wouldn't be an issue since they are both AC powered.

The home base does send notifications about when and how the guard mode was changed; schedule, geofence, app, or keypad

beck22179 commented 3 years ago

@matijse, I have a Home Base 2 and can confirm the payload is the same.

vlumikero commented 3 years ago

I'm using the wired T8200, and it looks like the mode change events aren't logged in the DB. Do I need to do anything to enable that?

matijse commented 3 years ago

I assume you are using the doorbell without a Home Base? I think it needs to be polled for the state changes.

I am working on switching to the new library that should be able to communicate directly with devices, but it is not going very fast, as I don't have a lot of time at the moment...

vlumikero commented 3 years ago

I assume you are using the doorbell without a Home Base? I think it needs to be polled for the state changes.

Yes, that is correct. Well, do tell if there is anything you need support with. I should be able to do testing and limited debugging at least.

r77s commented 2 years ago

Yes this one is next on my todo list :) It's a bit more tricky, because it looks like it is only possible to send this command over the local network directly to the Home Base. I don't actually own any Eufy camera's, I was just developing this for friends and up until now used the remote API to test everything...

I noticed that changes in arming mode do come up as push notifications, so I will start by recording the mode. This also helps in creating an integration with Home Assistant, because after sending a command to change the mode, HA can show that it actually worked. I think I might be able to use the Alarm control panel integration (https://www.home-assistant.io/integrations/alarm_control_panel.mqtt/)...

In order to prepare this, can some of you help identify the different push payloads. I think the message format would be based on the Home Base, of which there are at least two versions. To export the payloads of your Home Base:

  1. Open a terminal and navigate to the "data" folder
  2. Run sqlite3 -csv database.sqlite "select * from push_payloads where type = 0" > export.csv
  3. Open the file in an editor and remove personal information. Your HomeBase serial number will start with the model number, so please leave the first 6 characters of the serial number. For example T8010PXXXXXXXXX
  4. Upload it here, together with your HomeBase type (HomeBase 1 or HomeBase 2 or ..?)

Example for Home Base 2:

308CF908|T8010PXXXXXXXXXX||0|{"id":"308CF908","from":"XXXXXXXXXXXXX","to":"XXXXXXXXXXXXXXXXXXX","category":"com.oceanwing.battery.cam","persistentId":"0:1611196396582151%0d2a775cf9fd7ecd","ttl":3600,"sent":"1611196396578","payload":{"content":"Arming change","device_sn":"","event_time":"1611196396101","payload":{"a":9,"s":"T8010PXXXXXXXXXX","t":"1611196396","arming":1,"mode":1,"alarm":0,"alarm_delay":0,"user":2,"user_name":"XXXXXXXXXXXXXXXXXX"},"push_time":"1611196396566","station_sn":"T8010PXXXXXXXXXX","title":"Eufy Security","type":"0","google.c.sender.id":"348804314802"}}

If you also have a Home Base 2, I only need all the data if it is completely different... if the structure is the same, it's enough to just mention that... Hopefully the structure is the same for everybody, which makes it easier to implement

@matijse: Do you still need the data? Sorry for my late responce. I own a eufycam 2c (with homebase2) and can create the data if need. For me personal I have one use case:

r77s commented 2 years ago

@matijse : Do you know this project?

https://github.com/fuatakgun/eufy_security

I didn't test it yet, but when I read the docs, the mode change with geo is possible.

matijse commented 2 years ago

@r77s Yes, I've used it for some time now and it works well... I can recommend that integration.

Since it already has more features, I decided to no longer actively develop this... Will update the readme to reflect this...