fuatakgun / eufy_security

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

FR: Value mapping for person name sensors #1037

Open emufan opened 6 months ago

emufan commented 6 months ago

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

As discussed here, the sensors of detected persons (e.g. sensor.door1_person_name, which shows the name of a detected person if the person_detected-sensors are on, uses states, which are not inline with HA standards.

Good: Is delivers the name, if a person is detected, where a name is set.

Not good:

  1. It delivers ''/empty when no person is detected == off. Not good, because in automations, etc. it is hard to impossible to trigger on this (e.g. change from anything to empty) Or change from empty to anything <> empty. I have not a single other entity in any integration, where the state is empty. So a mapping to any default other than ''/empty would be really needed. e.g. off as well. Or whatever.

  2. It delivers "Unkown" if a person is detected but no name is set. Unknown is restricted as well in HA for unknown states of the entity but not for a known state. So a mapping/change any other state would be really needed. e.g. "unkown_person" or "unfamiliar" or whatever.

Thx for all your efforts with this great integration!

fuatakgun commented 4 months ago

please check with latest version, bropat had published a new one with working information

emufan commented 4 months ago

Unfortunately same as before

empty/NULL if nothing is detected. Hard to work with and not common for HA Unknown if someone is not known. Hard to work with and not common for HA / restricted value

And now worse: Even If the eufy app detects known faces, names, the integration always delivers "Unknown".

marcokitzmann commented 3 months ago

Same here, Person Name sensor doesn't give names but "unknown".

kloodhu commented 3 months ago

I've searched the logs a bit and what I found might help. I have eufyCam E330(T8600), Wireless Doorbell(T8210), SoloCam S220(T8134). All connected to the same HomeBase3(T8030). There are two types of entries in the E330's log when it detects a person, while the other two only show the entry containing "nick_name" (I took the log from the Eufy WS addon). In the case of the E330 device, the name can also be seen in the Home Assistant for the "person_name" sensor, and only "Unknown" for the other two.

Is there a way for the integration to read "nick_name" into a sensor?

E330 log:

2024-03-22 12:47:33.044 DEBUG eufy-security-ws:eufy-security-client [push] [PushClient.handleParsedMessage] Push client - DataMessageStanza { message: '{"tag":8,"object":{"id":"6930BCDF","from":"348804314802","to":"fGOEQzM0M4Wuw4DBFAom9G","category":"com.oceanwing.battery.cam","appData":[{"key":"device_sn","value":"T8600P10xxxxxxxx"},{"key":"payload","value":"eyJtc2dfdHlwZSI6MTgsImV2ZW50X3R5cGUiOjMxMTEsImRldmljZV9zbiI6IlQ4NjAwUDEwMjM0MDFEQzkiLCJuYW1lIjoiWWFyZCIsImNoYW5uZWwiOjIsImNpcGhlciI6MCwiY3JlYXRlX3RpbWUiOjE3MTExMTE2NDg5OTcsInRyaWdnZXJfdGltZSI6MTcxMTExMTY0ODk5NywiZmlsZV9wYXRoIjoiL3p4L2hkZF9kYXRhMC9DYW1lcmEwMi8yMDI0MDMvMjAyNDAzMjIxMzQ3MjkvMjAyNDAzMjIxMzQ3Mjkuenh2aWRlbyIsInBpY191cmwiOiIiLCJwaWNfZmlsZXBhdGgiOiIiLCJwdXNoX2NvdW50IjoxLCJub3RpZmljYXRpb25fc3R5bGUiOjEsInN0b3JhZ2VfdHlwZSI6MSwidmlzaW9uIjowLCJtb2RlIjoxLCJzZXNzaW9uX2lkIjoiMjAyNDAzMjJfMTM0NzMyIiwidW5pcXVlX2lkIjoiZjQyN2ViZjQ4NGI0MWI0MDVkNTU5MTkyMjJjMjE3NzkiLCJyZWNvcmRfaWQiOjIwMjQwMzIyMDAwNzMsInBlcnNvbl9pZCI6Miwibmlja19uYW1lIjoiRWRpdCJ9"},{"key":"station_sn","value":"T8030P23xxxxxxxx"},{"key":"google.c.sender.id","value":"348804314802"},{"key":"title","value":"Eufy Security"},{"key":"type","value":"24"},{"key":"push_time","value":"1711111652966"},{"key":"event_time","value":"1711111652139"},{"key":"content","value":"Someone has been spotted"}],"persistentId":"0:1711111652983915%0d2a775cf9fd7ecd","ttl":3600,"sent":"1711111652975"}}' } 2024-03-22 12:47:33.045 DEBUG eufy-security-ws:eufy-security-client [push] [PushNotificationService.onMessage] Raw push message received { 
message: { id: '6930BCDF', from: '348804314802', to: 'fGOEQzM0M4Wuw4DBFAom9G', category: 'com.oceanwing.battery.cam', persistentId: '0:1711111652983915%0d2a775cf9fd7ecd', ttl: 3600, sent: '1711111652975', payload: { device_sn: 'T8600P10xxxxxxxx', payload: { msg_type: 18, event_type: 3111, device_sn: 'T8600P10xxxxxxxx', name: 'Yard', channel: 2, cipher: 0, create_time: 1711111648997, trigger_time: 1711111648997, file_path: '/zx/hdd_data0/Camera02/202403/20240322134729/20240322134729.zxvideo', pic_url: '', pic_filepath: '', push_count: 1, notification_style: 1, storage_type: 1, vision: 0, mode: 1, session_id: '20240322_134732', unique_id: 'f427ebf484b41b405d55919222c21779', record_id: 2024032200073, person_id: 2, nick_name: 'Edit' }, station_sn: 'T8030P23xxxxxxxx', 'google.c.sender.id': '348804314802', title: 'Eufy Security', type: '24', push_time: '1711111652966', event_time: '1711111652139', content: 'Someone has been spotted' } } } 2024-03-22 12:47:33.047 DEBUG eufy-security-ws:eufy-security-client [push] [PushNotificationService.onMessage] Normalized push message received { 
message: { name: 'Yard', event_time: 1711111652139, type: 24, station_sn: 'T8030P23xxxxxxxx', device_sn: 'T8600P10xxxxxxxx', push_time: 1711111652966, title: 'Eufy Security', content: 'Someone has been spotted', channel: 2, cipher: 0, event_session: '20240322_134732', event_type: 3111, file_path: '/zx/hdd_data0/Camera02/202403/20240322134729/20240322134729.zxvideo', pic_url: '', push_count: 1, notification_style: 1, tfcard_status: undefined, alarm_delay_type: undefined, alarm_delay: undefined, alarm_type: undefined, sound_alarm: undefined, user_name: undefined, user_type: undefined, user_id: undefined, short_user_id: undefined, station_guard_mode: undefined, station_current_mode: 1, person_name: 'Edit', sensor_open: undefined, device_online: undefined, fetch_id: undefined, sense_id: undefined, battery_powered: undefined, battery_low: undefined, storage_type: 1, unique_id: 'f427ebf484b41b405d55919222c21779', automation_id: undefined, click_action: undefined, news_id: undefined, msg_type: 18 } } 2024-03-22 12:47:33.048 DEBUG eufy-security-ws:eufy-security-client [main] [EufySecurity.onPushMessage] Received push message { 
message: { name: 'Yard', event_time: 1711111652139, type: 24, station_sn: 'T8030P23xxxxxxxx', device_sn: 'T8600P10xxxxxxxx', push_time: 1711111652966, title: 'Eufy Security', content: 'Someone has been spotted', channel: 2, cipher: 0, event_session: '20240322_134732', event_type: 3111, file_path: '/zx/hdd_data0/Camera02/202403/20240322134729/20240322134729.zxvideo', pic_url: '', push_count: 1, notification_style: 1, tfcard_status: undefined, alarm_delay_type: undefined, alarm_delay: undefined, alarm_type: undefined, sound_alarm: undefined, user_name: undefined, user_type: undefined, user_id: undefined, short_user_id: undefined, station_guard_mode: undefined, station_current_mode: 1, person_name: 'Edit', sensor_open: undefined, device_online: undefined, fetch_id: undefined, sense_id: undefined, battery_powered: undefined, battery_low: undefined, storage_type: 1, unique_id: 'f427ebf484b41b405d55919222c21779', automation_id: undefined, click_action: undefined, news_id: undefined, msg_type: 18 } } 2024-03-22 12:48:13.684 DEBUG eufy-security-ws:eufy-security-client [http] [Station.databaseQueryLatestInfo] Station database query latest info - sending command { stationSN: 'T8030P23xxxxxxxx'

T8134 log:

2024-03-22 12:47:13.679 DEBUG eufy-security-ws:eufy-security-client [push] [PushClient.handleParsedMessage] Push client - DataMessageStanza { message: '{"tag":8,"object":{"id":"692FF177","from":"348804314802","to":"fGOEQzM0M4Wuw4DBFAom9G","category":"com.oceanwing.battery.cam","appData":[{"key":"device_sn","value":"T8134P20xxxxxxxx"},{"key":"payload","value":"eyJtc2dfdHlwZSI6MTgsImV2ZW50X3R5cGUiOjMxMTEsImRldmljZV9zbiI6IlQ4MTM0UDIwMjMyMjNDOUIiLCJuYW1lIjoiRnJvbnQgZ2F0ZSIsImNoYW5uZWwiOjMsImNpcGhlciI6MCwiY3JlYXRlX3RpbWUiOjE3MTExMTE2MzA0ODcsInRyaWdnZXJfdGltZSI6MTcxMTExMTYzMDQ4NywiZmlsZV9wYXRoIjoiL3p4L2hkZF9kYXRhMC9DYW1lcmEwMy8yMDI0MDMvMjAyNDAzMjIxMzQ3MTAvMjAyNDAzMjIxMzQ3MTAuenh2aWRlbyIsInBpY191cmwiOiIiLCJwaWNfZmlsZXBhdGgiOiIiLCJwdXNoX2NvdW50IjoxLCJub3RpZmljYXRpb25fc3R5bGUiOjEsInN0b3JhZ2VfdHlwZSI6MSwidmlzaW9uIjowLCJtb2RlIjoxLCJzZXNzaW9uX2lkIjoiMjAyNDAzMjJfMTM0NzEyIiwidW5pcXVlX2lkIjoiMjVmYjgwZjhlMTFhZDcxZjkxNzQ3NjQ3YTE1ODMwN2MiLCJyZWNvcmRfaWQiOjIwMjQwMzIyMDAwNzIsInBlcnNvbl9pZCI6Miwibmlja19uYW1lIjoiRWRpdCJ9"},{"key":"station_sn","value":"T8030P23xxxxxxxx"},{"key":"google.c.sender.id","value":"348804314802"},{"key":"type","value":"63"},{"key":"title","value":"Eufy Security"},{"key":"push_time","value":"1711111633627"},{"key":"event_time","value":"1711111632746"},{"key":"content","value":"Someone has been spotted"}],"persistentId":"0:1711111633644813%0d2a775cf9fd7ecd","ttl":3600,"sent":"1711111633634"}}' } 2024-03-22 12:47:13.681 DEBUG eufy-security-ws:eufy-security-client [push] [PushNotificationService.onMessage] Raw push message received { 
message: { id: '692FF177', from: '348804314802', to: 'fGOEQzM0M4Wuw4DBFAom9G', category: 'com.oceanwing.battery.cam', persistentId: '0:1711111633644813%0d2a775cf9fd7ecd', ttl: 3600, sent: '1711111633634', payload: { device_sn: 'T8134P20xxxxxxxx', payload: { msg_type: 18, event_type: 3111, device_sn: 'T8134P20xxxxxxxx', name: 'Front gate', channel: 3, cipher: 0, create_time: 1711111630487, trigger_time: 1711111630487, file_path: '/zx/hdd_data0/Camera03/202403/20240322134710/20240322134710.zxvideo', pic_url: '', pic_filepath: '', push_count: 1, notification_style: 1, storage_type: 1, vision: 0, mode: 1, session_id: '20240322_134712', unique_id: '25fb80f8e11ad71f91747647a158307c', record_id: 2024032200072, person_id: 2, nick_name: 'Edit' }, station_sn: 'T8030P23xxxxxxxx', 'google.c.sender.id': '348804314802', type: '63', title: 'Eufy Security', push_time: '1711111633627', event_time: '1711111632746', content: 'Someone has been spotted' } } } 2024-03-22 12:47:13.682 DEBUG eufy-security-ws:eufy-security-client [push] [PushNotificationService.onMessage] Normalized push message received { 
message: { name: 'Front gate', event_time: 1711111632746, type: 63, station_sn: 'T8030P23xxxxxxxx', device_sn: 'T8134P20xxxxxxxx', push_time: 1711111633627, title: 'Eufy Security', content: 'Someone has been spotted', channel: 3, cipher: 0, event_session: '20240322_134712', event_type: 3111, file_path: '/zx/hdd_data0/Camera03/202403/20240322134710/20240322134710.zxvideo', pic_url: '', push_count: 1, notification_style: 1, msg_type: 18, timeout: undefined, tfcard_status: undefined, storage_type: 1, unique_id: '25fb80f8e11ad71f91747647a158307c' } } 2024-03-22 12:47:13.683 DEBUG eufy-security-ws:eufy-security-client [main] [EufySecurity.onPushMessage] Received push message { 
message: { name: 'Front gate', event_time: 1711111632746, type: 63, station_sn: 'T8030P23xxxxxxxx', device_sn: 'T8134P20xxxxxxxx', push_time: 1711111633627, title: 'Eufy Security', content: 'Someone has been spotted', channel: 3, cipher: 0, event_session: '20240322_134712', event_type: 3111, file_path: '/zx/hdd_data0/Camera03/202403/20240322134710/20240322134710.zxvideo', pic_url: '', push_count: 1, notification_style: 1, msg_type: 18, timeout: undefined, tfcard_status: undefined, storage_type: 1, unique_id: '25fb80f8e11ad71f91747647a158307c' } }

kloodhu commented 2 months ago

@fuatakgun could you look after the solution?