bropat / eufy-security-client

This shared library allows to control Eufy security devices by connecting to the Eufy cloud servers and local/remote stations over p2p.
MIT License
505 stars 74 forks source link

[Bug]: Motion Detection Switch and motion detected sensor for T8420x does not work #239

Closed eufysecurity closed 2 years ago

eufysecurity commented 2 years ago

Client version

2.2.0

Node version

14.17.0

Operating System type

Linux

Operating system version

Linux 5 VMware

Describe the bug

Motion Sensor Switch is not working for T8420x. It does not pick up any motion. Motion and Person Motion. The param_type for the Motion Sensor Switch is 6040. Currently get_device_properties_metadata does not return the param_type 6040 here is the log for get_device_properties_metadata for the T8420x:

2022-11-03 15:12:33.660 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - on_message - {'type': 'result', 'success': True, 'messageId': 'get_device_properties_metadata', 'result': {'serialNumber': 'T8420N602xxxxxx', 'properties': {'name': {'key': 'device_name', 'name': 'name', 'label': 'Name', 'readable': True, 'writeable': False, 'type': 'string'}, 'model': {'key': 'device_model', 'name': 'model', 'label': 'Model', 'readable': True, 'writeable': False, 'type': 'string'}, 'serialNumber': {'key': 'device_sn', 'name': 'serialNumber', 'label': 'Serial number', 'readable': True, 'writeable': False, 'type': 'string'}, 'type': {'key': 'device_type', 'name': 'type', 'label': 'Type', 'readable': True, 'writeable': False, 'type': 'number', 'states': {'0': 'Station', '1': 'Camera', '2': 'Sensor', '3': 'Floodlight', '4': 'Camera E', '5': 'Doorbell', '7': 'Battery Doorbell', '8': 'Camera 2', '9': 'Camera 2c', '10': 'Motion Sensor', '11': 'Keypad', '14': 'Camera 2 Pro', '15': 'Camera 2c Pro', '16': 'Battery Doorbell 2', '30': 'Indoor Camera', '31': 'Indoor Camera PT', '32': 'Solo Camera', '33': 'Solo Camera Pro', '34': 'Indoor Camera 1080', '35': 'Indoor Camera PT 1080', '37': 'Floodlight 8422', '38': 'Floodlight 8423', '39': 'Floodlight 2', '44': 'Outdoor Camera 1080P No Light', '45': 'Outdoor Camera 2k', '46': 'Outdoor Camera 1080P', '50': 'Lock Basic', '51': 'Lock Advanced', '52': 'Lock Basic No Finger', '53': 'Lock Basic Advanced No Finger', '54': 'Lock 8503', '55': 'Lock 8530', '56': 'Lock 85A3', '57': 'Lock 8592', '58': 'Lock 8504', '60': 'Solo Camera Spotlight 1080p', '61': 'Solo Camera Spotlight 2k', '62': 'Solo Camera Spotlight Solar', '90': 'SmartDrop, Smart Delivery Box', '91': 'Video Doorbell Dual', '93': 'Video Doorbell Dual (Wired)'}}, 'hardwareVersion': {'key': 'main_hw_version', 'name': 'hardwareVersion', 'label': 'Hardware version', 'readable': True, 'writeable': False, 'type': 'string'}, 'softwareVersion': {'key': 'main_sw_version', 'name': 'softwareVersion', 'label': 'Software version', 'readable': True, 'writeable': False, 'type': 'string'}, 'stationSerialNumber': {'key': 'station_sn', 'name': 'stationSerialNumber', 'label': 'Station serial number', 'readable': True, 'writeable': False, 'type': 'string'}, 'enabled': {'key': 99904, 'name': 'enabled', 'label': 'Camera enabled', 'readable': True, 'writeable': True, 'type': 'boolean', 'commandId': 1035}, 'autoNightvision': {'key': 1013, 'name': 'autoNightvision', 'label': 'Auto Nightvision', 'readable': True, 'writeable': True, 'type': 'boolean'}, 'motionDetection': {'key': 1011, 'name': 'motionDetection', 'label': 'Motion Detection', 'readable': True, 'writeable': True, 'type': 'boolean'}, 'watermark': {'key': 1214, 'name': 'watermark', 'label': 'Watermark', 'readable': True, 'writeable': True, 'type': 'number', 'states': {'1': 'Off', '2': 'On'}}, 'motionDetected': {'key': 'custom_motionDetected', 'name': 'motionDetected', 'label': 'Motion detected', 'readable': True, 'writeable': False, 'type': 'boolean', 'default': False}, 'statusLed': {'key': 1045, 'name': 'statusLed', 'label': 'Status LED', 'readable': True, 'writeable': True, 'type': 'boolean', 'commandId': 6014}, 'pictureUrl': {'key': 'cover_path', 'name': 'pictureUrl', 'label': 'Last Camera Picture URL', 'readable': True, 'writeable': False, 'type': 'string'}, 'light': {'key': 1400, 'name': 'light', 'label': 'Light', 'readable': True, 'writeable': True, 'type': 'boolean'}, 'lightSettingsEnable': {'key': 1403, 'name': 'lightSettingsEnable', 'label': 'Light Enable', 'readable': True, 'writeable': True, 'type': 'boolean'}, 'lightSettingsBrightnessManual': {'key': 1401, 'name': 'lightSettingsBrightnessManual', 'label': 'Light Brightness Manual', 'readable': True, 'writeable': True, 'type': 'number', 'min': 0, 'max': 100}, 'lightSettingsBrightnessMotion': {'key': 1412, 'name': 'lightSettingsBrightnessMotion', 'label': 'Light Brightness Motion', 'readable': True, 'writeable': True, 'type': 'number', 'min': 0, 'max': 100}, 'lightSettingsBrightnessSchedule': {'key': 1413, 'name': 'lightSettingsBrightnessSchedule', 'label': 'Light Brightness Schedule', 'readable': True, 'writeable': True, 'type': 'number', 'min': 0, 'max': 100}, 'lightSettingsMotionTriggered': {'key': 1408, 'name': 'lightSettingsMotionTriggered', 'label': 'Light Motion Triggered Enable', 'readable': True, 'writeable': True, 'type': 'boolean'}, 'lightSettingsMotionTriggeredDistance': {'key': 1210, 'name': 'lightSettingsMotionTriggeredDistance', 'label': 'Light Motion Triggered Distance', 'readable': True, 'writeable': True, 'type': 'number', 'states': {'1': 'Min', '2': 'Low', '3': 'Medium', '4': 'High', '5': 'Max'}}, 'lightSettingsMotionTriggeredTimer': {'key': 1409, 'name': 'lightSettingsMotionTriggeredTimer', 'label': 'Light Motion Triggered Timer', 'readable': True, 'writeable': True, 'type': 'number', 'unit': 'sec', 'states': {'30': '30 sec.', '60': '1 min.', '180': '3 min.', '300': '5 min.', '900': '15 min.'}}, 'motionDetectionSensitivity': {'key': 1272, 'name': 'motionDetectionSensitivity', 'label': 'Motion Detection Sensitivity', 'readable': True, 'writeable': True, 'type': 'number', 'min': 1, 'max': 5}, 'microphone': {'key': 1240, 'name': 'microphone', 'label': 'Microphone', 'readable': True, 'writeable': True, 'type': 'boolean'}, 'speaker': {'key': 1241, 'name': 'speaker', 'label': 'Speaker', 'readable': True, 'writeable': True, 'type': 'boolean'}, 'speakerVolume': {'key': 1230, 'name': 'speakerVolume', 'label': 'Speaker Volume', 'readable': True, 'writeable': True, 'type': 'number', 'min': 1, 'max': 63}, 'audioRecording': {'key': 1366, 'name': 'audioRecording', 'label': 'Audio Recording', 'readable': True, 'writeable': True, 'type': 'boolean'}, 'recordingClipLength': {'key': 1249, 'name': 'recordingClipLength', 'label': 'Recording Clip Length', 'readable': True, 'writeable': True, 'type': 'number', 'min': 30, 'max': 120, 'default': 100, 'unit': 'sec'}, 'recordingRetriggerInterval': {'key': 1250, 'name': 'recordingRetriggerInterval', 'label': 'Recording Clip Length', 'readable': True, 'writeable': True, 'type': 'number', 'unit': 'sec', 'min': 0, 'max': 30, 'default': 0}, 'recordingEndClipMotionStops': {'key': 1251, 'name': 'recordingEndClipMotionStops', 'label': 'Recording end clip early if motion stops', 'readable': True, 'writeable': True, 'type': 'boolean', 'default': True}, 'wifiRssi': {'key': 1142, 'name': 'wifiRssi', 'label': 'Wifi RSSI', 'readable': True, 'writeable': False, 'type': 'number', 'unit': 'dBm'}, 'wifiSignalLevel': {'key': 'custom_wifiSignalLevel', 'name': 'wifiSignalLevel', 'label': 'Wifi Signal Level', 'readable': True, 'writeable': False, 'type': 'number', 'min': 0, 'max': 4, 'states': {'0': 'No signal', '1': 'Weak', '2': 'Normal', '3': 'Strong', '4': 'Full'}}, 'motionDetectionTestMode': {'key': 1243, 'name': 'motionDetectionTestMode', 'label': 'Motion Detection Test Mode', 'readable': True, 'writeable': True, 'type': 'boolean'}, 'snooze': {'key': 1271, 'name': 'snooze', 'label': 'Snooze', 'readable': True, 'writeable': False, 'type': 'boolean'}, 'snoozeTime': {'key': 1271, 'name': 'snoozeTime', 'label': 'Snooze Time', 'readable': True, 'writeable': False, 'type': 'number', 'default': 0, 'unit': 'sec'}, 'personName': {'key': 'custom_personName', 'name': 'personName', 'label': 'Person Name', 'readable': True, 'writeable': False, 'type': 'string', 'default': ''}}}}

Here are all of the param_types that returns for the device:

{ "device_id": 11093XXXXX, "is_init_complete": false, "device_sn": "T8420N6021XXXXXX", "device_name": "Front Yard", "device_model": "T8420X", "time_zone": "EST5EDT,M3.2.0,M11.1.0", "device_type": 3, "device_channel": 0, "station_sn": "T8420N6021XXXXXX", "schedule": "", "schedulex": "", "wifi_mac": "XXXXXXXXXXXX", "main_sw_version": "2.0.6.1", "main_hw_version": "P1", "sec_sw_version": "2.0.3.0", "sec_hw_version": "P1", "sector_id": 0, "event_num": 277, "wifi_ssid": "XXXXXX", "ip_addr": "192.168.XXX.XXX", "volume": "Anker_sToleE_rz", "main_sw_time": 1661317976, "bind_time": 1655942786, "bt_mac": "XXXXXXXXXXXX", "cover_path": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "cover_time": 1667500791, "local_ip": "", "language": "en", "sku_number": "", "lot_number": "", "cpuid": "", "create_time": 1620992027, "update_time": 1667500852, "status": 1, "svr_domain": "", "svr_port": 0, "station_conn": { "station_sn": "T8420N6021XXXXXX", "station_name": "Front Yard", "station_model": "T8420X", "main_sw_version": "2.0.6.1", "main_hw_version": "P1", "p2p_did": "SECCAMA-XXXXXX-XXXXX", "push_did": "SECCAMA-XXXXXX-XXXXX", "ndt_did": "SECCAMA-XXXXXX-XXXXX", "p2p_conn": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "app_conn": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "binded": false, "setup_code": "", "setup_id": "", "bt_mac": "XXXXXXXXXXXX", "wifi_mac": "XXXXXXXXXXXX", "dsk_key": "", "expiration": 0 }, "family_num": 0, "member": { "family_id": 1113XXXXXX, "station_sn": "T8420N6021XXXXXX", "admin_user_id": "XXXXXXXXXXXXXXXXXXXXXX", "member_user_id": "XXXXXXXXXXXXXXXXXXXXX", "short_user_id": "", "member_type": 1, "permissions": 0, "member_nick": "", "action_user_id": "XXXXXXXXXXXXXXXXXXXXXX", "fence_state": 0, "extra": "", "member_avatar": "", "house_id": "XXXXXXXXXXXXXXXXXXXXXXX", "create_time": 1657035155, "update_time": 1657035155, "status": 1, "email": "XXXXXXXXXXXXXXXXX", "nick_name": "XXXXXXXXX", "avatar": "", "action_user_email": "XXXXXXXXXXXXXXXXXXXXX", "action_user_name": "XXXXXXXXXXXXXXXXX" }, "permission": null, "params": [ { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 1403, "param_value": "1", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 1412, "param_value": "25", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 6045, "param_value": "1", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 1013, "param_value": "1", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 1401, "param_value": "99", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 1230, "param_value": "100", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 1045, "param_value": "1", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 6014, "param_value": "1", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 1250, "param_value": "0", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 2002, "param_value": "0", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 1409, "param_value": "30", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 0, "device_sn": "T8420N6021XXXXXX", "param_type": 2037, "param_value": "1656788058", "create_time": 1656788059, "update_time": 1656788059, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 1400, "param_value": "0", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 0, "device_sn": "T8420N6021XXXXXX", "param_type": 1225, "param_value": "9", "create_time": 1656806791, "update_time": 1656806791, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 6020, "param_value": "3", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 6022, "param_value": "1", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 6050, "param_value": "0", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 0, "device_sn": "T8420N6021XXXXXX", "param_type": 1271, "param_value": "", "create_time": 1656788059, "update_time": 1656788059, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 6012, "param_value": "1", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 1414, "param_value": "0", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 2001, "param_value": "true", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 0, "device_sn": "T8420N6021XXXXXX", "param_type": 6042, "param_value": "{\"polygens\":[],\"zonecount\":0}", "create_time": 1655953498, "update_time": 1655953498, "status": 1 }, { "param_id": 0, "device_sn": "T8420N6021XXXXXX", "param_type": 1239, "param_value": "11", "create_time": 1656806817, "update_time": 1656806817, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 1408, "param_value": "0", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 6041, "param_value": "5", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 2034, "param_value": "2", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 1241, "param_value": "1", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 2031, "param_value": "0", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 6023, "param_value": "1", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 1413, "param_value": "100", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 1240, "param_value": "1", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 1145, "param_value": "0", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 6040, "param_value": "1", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 1207, "param_value": "0", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 0, "device_sn": "T8420N6021XXXXXX", "param_type": 1134, "param_value": "0", "create_time": 1655942801, "update_time": 1655942801, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 1249, "param_value": "60", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 6053, "param_value": "16", "create_time": 1655942787, "update_time": 1655942787, "status": 1 }, { "param_id": 1797XXXXXX, "device_sn": "T8420N6021XXXXXX", "param_type": 1251, "param_value": "1", "create_time": 1655942787, "update_time": 1655942787, "status": 1 } ], "pir_total": 0, "pir_none": 0, "pir_missing": 0, "week_pir_total": 0, "week_pir_none": 0, "month_pir_total": 0, "month_pir_none": 0, "charging_days": 0, "charing_total": 0, "charging_reserve": 0, "charging_missing": 0, "battery_usage_last_week": 0, "virtual_version": "", "relate_devices": null }

To reproduce

  1. Cannot turn motion detection for flood light on or off

and

  1. Create Motion on the floodlight cam.
  2. get a notification on phone app
  3. eufy security ws does not detect any motion

Screenshots & Logfiles

No response

Additional context

No response

bropat commented 2 years ago

@eufysecurity

The Floodlight T8420 and the Floodlight T8420X have the same device type, so I have to implement a workaround for both to work. Would you be willing to share the device with me so I can implement it correctly?

eufysecurity commented 2 years ago

Yes, what email address do I share it too?

eufysecurity commented 2 years ago

I found the email address. It is share with you now.

bropat commented 2 years ago

Thanks! I also need the country where the device was registered.

eufysecurity commented 2 years ago

Thanks! I also need the country where the device was registered.

US

bropat commented 2 years ago

You can remove the sharing. This device will be supported in the next release (2.2.1).

eufysecurity commented 2 years ago

Thanks Pat

bropat commented 2 years ago

Fixed in version 2.2.1.