fuatakgun / eufy_security

Home Assistant integration to manage Eufy Security devices as cameras, home base stations, doorbells, motion and contact sensors.
926 stars 77 forks source link

Log user who unlocked/locked door #962

Closed InstigatorX closed 9 months ago

InstigatorX commented 1 year ago

Is your feature request related to a problem? Please describe. No

Describe the solution you'd like Log to reflect which user unlocked or locked a door. The app has this level of granularity. Hoping you can leverage here.

InstigatorX commented 1 year ago

I can see from debug logs on in the HA eufy-security-ws add-on, the nickName of user who unlocked door is logged. See below...

2023-10-24 22:12:48.576 DEBUG [MqttClient.] Received a smart lock message over MQTT { message: { eventType: 259, userId: 'xxx', data: { timestamp: '1698185568547', uuid: 'xxx', data: { stationSn: 'T8520Q25231xxxxx', deviceSn: 'T8520Q25231xxxxx', eventType: 259, eventTime: '1698185567670', shortUserId: '0001', nickName: 'Izzy', userId: 'xxx', deviceName: 'Back Door' } } } }

fuatakgun commented 1 year ago

Please get debug logs from home assistant and share with me so i can see if this is exposed through addon or not.

If it is exposed, i can implement it, if not, we need bropat's support

InstigatorX commented 1 year ago

Please get debug logs from home assistant and share with me so i can see if this is exposed through addon or not.

If it is exposed, i can implement it, if not, we need bropat's support

Sorry for the stupid question but what exactly should I turn on to get you what you need?

fuatakgun commented 1 year ago

follow the bug template, you will see how to get debug logs from home assistant for this integration

InstigatorX commented 1 year ago

Here's what was output after enabling debug on your custom component...

2023-11-01 09:34:30.870 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'property changed', 'serialNumber': 'T8520Q25231xxxxx', 'name': 'lockStatus', 'value': 3}} 2023-11-01 09:34:30.876 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'property changed', 'serialNumber': 'T8520Q25231xxxxx', 'name': 'locked', 'value': False}} 2023-11-01 09:34:30.877 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'locked', 'serialNumber': 'T8520Q25231xxxxx', 'state': False}} 2023-11-01 09:34:36.259 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'property changed', 'serialNumber': 'T8520Q25231xxxxx', 'name': 'lockStatus', 'value': 4}} 2023-11-01 09:34:36.265 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'property changed', 'serialNumber': 'T8520Q25231xxxxx', 'name': 'locked', 'value': True}} 2023-11-01 09:34:36.266 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'locked', 'serialNumber': 'T8520Q25231xxxxx', 'state': True}} 2023-11-01 09:36:31.793 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'property changed', 'serialNumber': 'T8520Q25231xxxxx', 'name': 'lockStatus', 'value': 3}} 2023-11-01 09:36:31.797 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'property changed', 'serialNumber': 'T8520Q25231xxxxx', 'name': 'locked', 'value': False}} 2023-11-01 09:36:31.798 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'locked', 'serialNumber': 'T8520Q25231xxxxx', 'state': False}} 2023-11-01 09:36:57.124 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'property changed', 'serialNumber': 'T8520Q25231xxxxx', 'name': 'lockStatus', 'value': 4}} 2023-11-01 09:36:57.128 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'property changed', 'serialNumber': 'T8520Q25231xxxxx', 'name': 'locked', 'value': True}} 2023-11-01 09:36:57.130 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'locked', 'serialNumber': 'T8520Q25231xxxxx', 'state': True}} 2023-11-01 09:37:02.521 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'property changed', 'serialNumber': 'T8520Q25231xxxxx', 'name': 'lockStatus', 'value': 3}} 2023-11-01 09:37:02.523 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'property changed', 'serialNumber': 'T8520Q25231xxxxx', 'name': 'locked', 'value': False}} 2023-11-01 09:37:02.524 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'locked', 'serialNumber': 'T8520Q25231xxxxx', 'state': False}} 2023-11-01 09:37:04.152 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'property changed', 'serialNumber': 'T8520Q25231xxxxx', 'name': 'lockStatus', 'value': 4}} 2023-11-01 09:37:04.153 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'property changed', 'serialNumber': 'T8520Q25231xxxxx', 'name': 'locked', 'value': True}} 2023-11-01 09:37:04.154 DEBUG (MainThread) [custom_components.eufy_security.eufy_security_api] _on_message - {'type': 'event', 'event': {'source': 'device', 'event': 'locked', 'serialNumber': 'T8520Q25231xxxxx', 'state': True}}

Debug from eufy-security-ws add-on...would've thought you could grab the value below and add to your custom integration. Maybe as a sensor?

2023-11-01 13:37:02.896 DEBUG [MqttClient.] Received a smart lock message over MQTT { message: { eventType: 259, userId: 'e1e41b56-0a8b-4c3c-bd47-d4909ffxxxxx', data: { timestamp: '1698845822857', uuid: '6203828c-a4e7-4ffa-ba1a-d7503c8xxxxx', data: { stationSn: 'T8520Q25231xxxxx', deviceSn: 'T8520Q25231xxxxx', eventType: 259, eventTime: '1698845822503', shortUserId: '0001', nickName: 'Izzy', userId: 'e1e41b56-0a8b-4c3c-bd47-d4909ffxxxxx', deviceName: 'Back Door' } } } }

On Tue, Oct 31, 2023 at 10:14 AM Fuat Akgün @.***> wrote:

follow the bug template, you will see how to get debug logs from home assistant for this integration

— Reply to this email directly, view it on GitHub https://github.com/fuatakgun/eufy_security/issues/962#issuecomment-1787304731, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANJ2YGE6JESNSO3YRHYMQDYCEBU5AVCNFSM6AAAAAA6NBL3T6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBXGMYDINZTGE . You are receiving this because you authored the thread.Message ID: @.***>

fuatakgun commented 1 year ago

I see that nickname information is not exposed from add-on, so please reach out to bropat to ask to expose this. Handling over add-on logs would help him to deliver it.

When it is done, let me know so I can create the respective sensor here.

InstigatorX commented 1 year ago

Will do, thanks!

On Wed, Nov 1, 2023 at 9:50 AM Fuat Akgün @.***> wrote:

I see that nickname information is not exposed from add-on, so please reach out to bropat to ask to expose this. Handling over add-on logs would help him to deliver it.

When it is done, let me know so I can create the respective sensor here.

— Reply to this email directly, view it on GitHub https://github.com/fuatakgun/eufy_security/issues/962#issuecomment-1788991714, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANJ2YCUA5SC7B3V5YQYDRDYCJHTJAVCNFSM6AAAAAA6NBL3T6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBYHE4TCNZRGQ . You are receiving this because you authored the thread.Message ID: @.***>