bropat / eufy-security-ws

Small server wrapper around eufy-security-client library to access it via a WebSocket.
MIT License
176 stars 26 forks source link

Battery sensor shows unexpected behavior #57

Closed kauthmbt closed 2 years ago

kauthmbt commented 2 years ago

Describe the bug
After updating from 0.3.3 to the latest version the battery sensor has problems showing the correct state.

To Reproduce
Steps to reproduce the behavior:

  1. Updating to latest addon + integration (by fuatakgun)

Expected behavior
Battery sensor showing the correct percentage.

Screenshots & Logfiles

eufy1

2021-11-29 20:23:45.609  INFO Eufy Security server listening on port 3000 
2021-11-29 20:23:47.173  INFO Connected to station T8010 on host 192.x.x.x and port 11294 
2021-11-29 20:23:49.047  INFO Push notification connection successfully established 

Versions:

Hardware information about camera

Additional context
I already tried a fallback and reinstalled the old addon(s) from a backup (both Eufy security WS addon + integration). After a reboot the battery sensor will immediately show the correct percentage again:

eufy2

After some usage time it seems like periodically the correct value is shown and after a while drops to 0% again: eufy3 eufy4

fuatakgun commented 2 years ago

I am having the same problem, incoming events are captured below, i will try to capture debug logs.

2021-11-29 17:19:27 - set_event_for_entity - device / T8113N63205014E2 / battery / 52
2021-11-30 09:57:36 - set_event_for_entity - device / T8113N63205014E2 / battery / 51
2021-11-30 21:46:51 - set_event_for_entity - device / T8113N63205014E2 / battery / 0
2021-11-30 21:56:05 - set_event_for_entity - device / T8113N63205014E2 / battery / 51
2021-11-30 22:11:59 - set_event_for_entity - device / T8113N63205014E2 / battery / 0
2021-11-30 23:32:49 - set_event_for_entity - device / T8113N63205014E2 / battery / 67
2021-12-01 08:10:40 - set_event_for_entity - device / T8113N63205014E2 / battery / 100
kauthmbt commented 2 years ago

Additionally I found out that when the ringing sensor is set to TRUE the battery sensor is (almost) immediately updated with the most current battery percentage. ringing_sensor

battery01 battery02

bropat commented 2 years ago

@kauthmbt

The battery value is received via 2 interfaces in the eufy-security-client driver:

It looks like one of the 2 interfaces is now delivering an incorrect value.

To understand exactly which one returns the wrong value I need the debug logs where the problem is visible (the log extract should contain the correct value plus the 0 value of the battery property).

To activate the debug mode, the Docker container must have the parameter DEBUG set with some value (e.g.: "y"). As already described here.

kauthmbt commented 2 years ago

@bropat My challenge over here is that the protocol log window from the addon only shows a limited number of log entries. Maybe @fuatakgun can show me an alternative way if the following information is not yet sufficient for further analysis.

2021-12-08 08:29:15.603  DEBUG [P2PClientProtocol.handleMsg] Station T8010P************ - LOOKUP_ADDR - Got invalid ip address 0.0.0.0, ignoring response... 
2021-12-08 08:29:26.059  DEBUG [PushClient.handleParsedMessage] Login response: GCM -> logged in -> waiting for push messages... 
2021-12-08 08:29:26.063  DEBUG [HTTPApi.request] Request: 
{
  method: 'post',
  endpoint: 'v1/apppush/register_push_token',
  baseUrl: 'https://security-app-eu.eufylife.com',
  token: '** REMOVED **',
  data: {
    is_notification_enable: true,
    token: '** REMOVED **',
    transaction: '1638952166061'
  },
  headers: {
    app_version: 'v3.3.1_1058',
    os_type: 'android',
    os_version: '30',
    phone_model: 'EUFYCLIENT',
    country: 'DE',
    language: 'en',
    openudid: 'c854eb256e52cbd7',
    uid: '',
    net_type: 'wifi',
    mnc: '02',
    mcc: '262',
    sn: '** REMOVED **',
    Model_type: 'PHONE',
    timezone: 'GMT+01:00',
    'Cache-Control': 'no-cache',
    'User-Agent': 'okhttp/3.12.1',
    'X-Auth-Token': '** REMOVED **'
  }
}
2021-12-08 08:29:26.098  DEBUG [PushClient.handleParsedMessage] IqStanza: Not implemented 
{
  tag: 7,
  object: {
    type: 'SET',
    id: '',
    extension: {
      id: 12,
      data: <Buffer >
    }
  }
}
2021-12-08 08:29:26.133  DEBUG [HTTPApi.registerPushToken] Response: 
{
  code: 0,
  msg: 'Succeed.'
}
2021-12-08 08:29:26.136  DEBUG [HTTPApi.registerPushToken] Push token registered successfully 
2021-12-08 08:29:26.139  DEBUG [HTTPApi.request] Request: 
{
  method: 'post',
  endpoint: 'v1/app/review/app_push_check',
  baseUrl: 'https://security-app-eu.eufylife.com',
  token: '** REMOVED **',
  data: {
    app_type: 'eufySecurity',
    transaction: '1638952166138'
  },
  headers: {
    app_version: 'v3.3.1_1058',
    os_type: 'android',
    os_version: '30',
    phone_model: 'EUFYCLIENT',
    country: 'DE',
    language: 'en',
    openudid: 'c854eb256e52cbd7',
    uid: '',
    net_type: 'wifi',
    mnc: '02',
    mcc: '262',
    sn: '** REMOVED **',
    Model_type: 'PHONE',
    timezone: 'GMT+01:00',
    'Cache-Control': 'no-cache',
    'User-Agent': 'okhttp/3.12.1',
    'X-Auth-Token': '** REMOVED **'
  }
}
2021-12-08 08:29:26.175  DEBUG [HTTPApi.checkPushToken] Response: 
{
  code: 0,
  msg: 'Succeed.'
}
2021-12-08 08:29:26.178  DEBUG [HTTPApi.checkPushToken] Push token OK 
2021-12-08 08:29:26.180  INFO [PushNotificationService.<anonymous>] Push notification connection successfully established 
2021-12-08 08:34:26.076  DEBUG [PushClient.sendHeartbeat] Sending heartbeat... 2 
2021-12-08 08:34:26.083  DEBUG [PushClient.buildHeartbeatPingRequest] heartbeatPingRequest 
{
  last_stream_id_received: 2
}
2021-12-08 08:34:26.139  DEBUG [PushClient.handleHeartbeatAck] Heartbeat acknowledge 
{
  tag: 1,
  object: {
    lastStreamIdReceived: 2
  }
}

[MISSING PARTS]

      timestamp: 1612626833000
    },
    chargingStatus: {
      value: 3,
      timestamp: 1638189458000
    },
    ringtoneVolume: {
      value: 0,
      timestamp: 1620291321000
    },
    videoWdr: {
      value: true,
      timestamp: 1619260446000
    },
    statusLed: {
      value: true,
      timestamp: 1612465348000
    },
    battery: {
      value: 89,
      timestamp: 1638952155191
    },
    watermark: {
      value: 1,
      timestamp: 1612509575000
    },
    chimeHomebaseRingtoneType: {
      value: 0,
      timestamp: 1635590889000
    },
    state: {
      value: 1,
      timestamp: 1612465342000
    },
    audioRecording: {
      value: true,
      timestamp: 1612465348000
    },
    autoNightvision: {
      value: true,
      timestamp: 1612465348000
    },
    speakerVolume: {
      value: 100,
      timestamp: 1612465348000
    },
    videoStreamingQuality: {
      value: 2,
      timestamp: 1628006878000
    },
    powerWorkingMode: {
      value: 1,
      timestamp: 1612465348000
    },
    batteryTemperature: {
      value: 6,
      timestamp: 1638156751000
    },
    wifiRssi: {
      value: -48,
      timestamp: 1638952155191
    },
    wifiSignalLevel: {
      value: 4,
      timestamp: 1638185700000
    },
    motionDetectionType: {
      value: 0,
      timestamp: 1612465342000
    },
    motionDetected: {
      value: false,
      timestamp: 0
    },
    personDetected: {
      value: false,
      timestamp: 0
    },
    personName: {
      value: '',
      timestamp: 0
    },
    ringing: {
      value: false,
      timestamp: 0
    }
  }
}
2021-12-08 08:39:26.091  DEBUG [PushClient.sendHeartbeat] Sending heartbeat... 3 
2021-12-08 08:39:26.095  DEBUG [PushClient.buildHeartbeatPingRequest] heartbeatPingRequest 
{
  last_stream_id_received: 3
}
2021-12-08 08:39:26.135  DEBUG [PushClient.handleHeartbeatAck] Heartbeat acknowledge 
{
  tag: 1,
  object: {
    lastStreamIdReceived: 3
  }
}
2021-12-08 08:44:26.101  DEBUG [PushClient.sendHeartbeat] Sending heartbeat... 4 
2021-12-08 08:44:26.105  DEBUG [PushClient.buildHeartbeatPingRequest] heartbeatPingRequest 
{
  last_stream_id_received: 4
}
2021-12-08 08:44:26.146  DEBUG [PushClient.handleHeartbeatAck] Heartbeat acknowledge 
{
  tag: 1,
  object: {
    lastStreamIdReceived: 4
  }
}

[MISSING PARTS]

      timestamp: 1628006780000
    },
    chimeIndoor: {
      value: false,
      timestamp: 1612465348000
    },
    motionDetectionSensitivity: {
      value: 3,
      timestamp: 1612465348000
    },
    chimeHomebaseRingtoneVolume: {
      value: 14,
      timestamp: 1612626833000
    },
    chargingStatus: {
      value: 3,
      timestamp: 1638189458000
    },
    ringtoneVolume: {
      value: 0,
      timestamp: 1620291321000
    },
    videoWdr: {
      value: true,
      timestamp: 1619260446000
    },
    statusLed: {
      value: true,
      timestamp: 1612465348000
    },
    battery: {
      value: 89,
      timestamp: 1638952155191
    },
    watermark: {
      value: 1,
      timestamp: 1612509575000
    },
    chimeHomebaseRingtoneType: {
      value: 0,
      timestamp: 1635590889000
    },
    state: {
      value: 1,
      timestamp: 1612465342000
    },
    audioRecording: {
      value: true,
      timestamp: 1612465348000
    },
    autoNightvision: {
      value: true,
      timestamp: 1612465348000
    },
    speakerVolume: {
      value: 100,
      timestamp: 1612465348000
    },
    videoStreamingQuality: {
      value: 2,
      timestamp: 1628006878000
    },
    powerWorkingMode: {
      value: 1,
      timestamp: 1612465348000
    },
    batteryTemperature: {
      value: 6,
      timestamp: 1638156751000
    },
    wifiRssi: {
      value: -48,
      timestamp: 1638952155191
    },
    wifiSignalLevel: {
      value: 4,
      timestamp: 1638185700000
    },
    motionDetectionType: {
      value: 0,
      timestamp: 1612465342000
    },
    motionDetected: {
      value: false,
      timestamp: 0
    },
    personDetected: {
      value: false,
      timestamp: 0
    },
    personName: {
      value: '',
      timestamp: 0
    },
    ringing: {
      value: false,
      timestamp: 0
    }
  }
}

Looks for me that the battery value from the docker is "89" and therefore is indeed correctly registered. However the entity _sensor.doorbellbattery still shows "0" as the integration debug shows:

2021-12-08 10:55:43 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - set_ws - connect
2021-12-08 10:55:43 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - on_open - executed
2021-12-08 10:55:43 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - WebSocket message sent. {"messageId": "set_api_schema", "command": "set_api_schema", "schemaVersion": 6}
2021-12-08 10:55:43 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - WebSocket message sent. {"messageId": "start_listening", "command": "start_listening"}
2021-12-08 10:55:43 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - check_if_started_listening
2021-12-08 10:55:43 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - wait start - devices
2021-12-08 10:55:43 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - wait - 0 - devices None
2021-12-08 10:55:43 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - process_messages started
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - on_message - {'type': 'result', 'success': True, 'messageId': 'set_api_schema', 'result': {}}
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - on_message - {'type': 'result', 'success': True, 'messageId': 'start_listening', 'result': {'state': {'driver': {'version': '1.4.0', 'connected': True, 'pushConnected': True}, 'stations': [{'name': '** REMOVED **', 'model': 'T8010', 'serialNumber': 'T8010** REMOVED **', 'hardwareVersion': 'P0', 'softwareVersion': '2.1.8.5h', 'lanIpAddress': '** REMOVED **', 'macAddress': '** REMOVED **', 'currentMode': 1, 'guardMode': 1, 'connected': True, 'type': 0, 'timeFormat': 1, 'alarmVolume': 26, 'alarmTone': 1, 'promptVolume': 16, 'notificationSwitchModeSchedule': False, 'notificationSwitchModeGeofence': False, 'notificationSwitchModeApp': False, 'notificationSwitchModeKeypad': False, 'notificationStartAlarmDelay': True}], 'devices': [{'name': 'Doorbell', 'model': 'T8210', 'serialNumber': 'T8210** REMOVED **', 'hardwareVersion': 'T8210', 'softwareVersion': '2.2.3.3', 'stationSerialNumber': 'T8010** REMOVED **', 'enabled': True, 'state': 1, 'battery': 0, 'batteryTemperature': 6, 'lastChargingDays': -1, 'lastChargingTotalEvents': 1886, 'lastChargingRecordedEvents': 1580, 'lastChargingFalseEvents': 306, 'batteryUsageLastWeek': 8, 'motionDetected': False, 'personDetected': False, 'personName': '', 'ringing': False, 'autoNightvision': True, 'motionDetection': False, 'watermark': 1, 'wifiRSSI': -48, 'pictureUrl': '** REMOVED **', 'type': 7, 'motionDetectionType': 0, 'speakerVolume': 100, 'ringtoneVolume': 0, 'audioRecording': True, 'powerWorkingMode': 1, 'recordingEndClipMotionStops': True, 'recordingClipLength': 60, 'recordingRetriggerInterval': 2, 'videoStreamingQuality': 2, 'videoWDR': True, 'chimeIndoor': False, 'chimeHomebase': True, 'chimeHomebaseRingtoneVolume': 14, 'chimeHomebaseRingtoneType': 0, 'notificationType': 2, 'notificationRing': 1, 'notificationMotion': 0, 'motionDetectionSensitivity': 3, 'statusLed': True, 'chargingStatus': 3, 'wifiSignalLevel': 4}]}}}
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - WebSocket message sent. {"messageId": "get_properties", "command": "device.get_properties", "serialNumber": "T8210** REMOVED **"}
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - on_message - {'type': 'result', 'success': True, 'messageId': 'get_properties', 'result': {'serialNumber': 'T8210** REMOVED **', 'properties': {'name': {'value': 'Doorbell', 'timestamp': 1638880295000}, 'model': {'value': 'T8210', 'timestamp': 1638880295000}, 'serialNumber': {'value': 'T8210** REMOVED **', 'timestamp': 1638880295000}, 'type': {'value': 7, 'timestamp': 1638880295000}, 'hardwareVersion': {'value': 'T8210', 'timestamp': 1638880295000}, 'softwareVersion': {'value': '2.2.3.3', 'timestamp': 1620740746000}, 'stationSerialNumber': {'value': 'T8010** REMOVED **', 'timestamp': 1638880295000}, 'lastChargingDays': {'value': -1, 'timestamp': 1638880295000}, 'lastChargingFalseEvents': {'value': 306, 'timestamp': 1638880295000}, 'lastChargingRecordedEvents': {'value': 1580, 'timestamp': 1638880295000}, 'lastChargingTotalEvents': {'value': 1886, 'timestamp': 1638880295000}, 'batteryUsageLastWeek': {'value': 8, 'timestamp': 1638880295000}, 'pictureUrl': {'value': '** REMOVED **', 'timestamp': 1638880284000}, 'recordingClipLength': {'value': 60, 'timestamp': 1638954591006}, 'recordingRetriggerInterval': {'value': 2, 'timestamp': 1638954591006}, 'recordingEndClipMotionStops': {'value': True, 'timestamp': 1638954591006}, 'notificationType': {'value': 2, 'timestamp': 1619029379000}, 'notificationRing': {'value': 1, 'timestamp': 1619029379000}, 'notificationMotion': {'value': 0, 'timestamp': 1619029379000}, 'chimeHomebase': {'value': True, 'timestamp': 1613064204000}, 'motionDetection': {'value': False, 'timestamp': 1619433706000}, 'enabled': {'value': True, 'timestamp': 1628006780000}, 'chimeIndoor': {'value': False, 'timestamp': 1612465348000}, 'motionDetectionSensitivity': {'value': 3, 'timestamp': 1612465348000}, 'chimeHomebaseRingtoneVolume': {'value': 14, 'timestamp': 1612626833000}, 'chargingStatus': {'value': 3, 'timestamp': 1638189458000}, 'ringtoneVolume': {'value': 0, 'timestamp': 1620291321000}, 'videoWdr': {'value': True, 'timestamp': 1619260446000}, 'statusLed': {'value': True, 'timestamp': 1612465348000}, 'battery': {'value': 0, 'timestamp': 1638955476891}, 'watermark': {'value': 1, 'timestamp': 1612509575000}, 'chimeHomebaseRingtoneType': {'value': 0, 'timestamp': 1635590889000}, 'state': {'value': 1, 'timestamp': 1612465342000}, 'audioRecording': {'value': True, 'timestamp': 1612465348000}, 'autoNightvision': {'value': True, 'timestamp': 1612465348000}, 'speakerVolume': {'value': 100, 'timestamp': 1612465348000}, 'videoStreamingQuality': {'value': 2, 'timestamp': 1628006878000}, 'powerWorkingMode': {'value': 1, 'timestamp': 1612465348000}, 'batteryTemperature': {'value': 6, 'timestamp': 1638156751000}, 'wifiRssi': {'value': -48, 'timestamp': 1638954591418}, 'wifiSignalLevel': {'value': 4, 'timestamp': 1638185700000}, 'motionDetectionType': {'value': 0, 'timestamp': 1612465342000}, 'motionDetected': {'value': False, 'timestamp': 0}, 'personDetected': {'value': False, 'timestamp': 0}, 'personName': {'value': '', 'timestamp': 0}, 'ringing': {'value': False, 'timestamp': 0}}}}
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - WebSocket message sent. {"messageId": "get_p2p_livestream_status", "command": "device.is_livestreaming", "serialNumber": "T8210** REMOVED **"}
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - WebSocket message sent. {"messageId": "get_rtsp_livestream_status", "command": "device.is_rtsp_livestreaming", "serialNumber": "T8210** REMOVED **"}
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - on_message - {'type': 'result', 'success': True, 'messageId': 'get_p2p_livestream_status', 'result': {'serialNumber': 'T8210** REMOVED **', 'livestreaming': False}}
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - on_message - {'type': 'result', 'success': True, 'messageId': 'get_rtsp_livestream_status', 'result': {'serialNumber': 'T8210** REMOVED **', 'livestreaming': False}}
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - wait - 1 - devices {'T8210** REMOVED **': <custom_components.eufy_security.const.Device object at 0x7f963ca460>}
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - get_device_properties
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - get_device_properties - <custom_components.eufy_security.const.Device object at 0x7f963ca460>
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - wait start - properties
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - wait - 0 - properties {'name': {'value': 'Doorbell', 'timestamp': 1638880295000}, 'model': {'value': 'T8210', 'timestamp': 1638880295000}, 'serialNumber': {'value': 'T8210** REMOVED **', 'timestamp': 1638880295000}, 'type': {'value': 7, 'timestamp': 1638880295000}, 'hardwareVersion': {'value': 'T8210', 'timestamp': 1638880295000}, 'softwareVersion': {'value': '2.2.3.3', 'timestamp': 1620740746000}, 'stationSerialNumber': {'value': 'T8010** REMOVED **', 'timestamp': 1638880295000}, 'lastChargingDays': {'value': -1, 'timestamp': 1638880295000}, 'lastChargingFalseEvents': {'value': 306, 'timestamp': 1638880295000}, 'lastChargingRecordedEvents': {'value': 1580, 'timestamp': 1638880295000}, 'lastChargingTotalEvents': {'value': 1886, 'timestamp': 1638880295000}, 'batteryUsageLastWeek': {'value': 8, 'timestamp': 1638880295000}, 'pictureUrl': {'value': '** REMOVED **', 'timestamp': 1638880284000}, 'recordingClipLength': {'value': 60, 'timestamp': 1638954591006}, 'recordingRetriggerInterval': {'value': 2, 'timestamp': 1638954591006}, 'recordingEndClipMotionStops': {'value': True, 'timestamp': 1638954591006}, 'notificationType': {'value': 2, 'timestamp': 1619029379000}, 'notificationRing': {'value': 1, 'timestamp': 1619029379000}, 'notificationMotion': {'value': 0, 'timestamp': 1619029379000}, 'chimeHomebase': {'value': True, 'timestamp': 1613064204000}, 'motionDetection': {'value': False, 'timestamp': 1619433706000}, 'enabled': {'value': True, 'timestamp': 1628006780000}, 'chimeIndoor': {'value': False, 'timestamp': 1612465348000}, 'motionDetectionSensitivity': {'value': 3, 'timestamp': 1612465348000}, 'chimeHomebaseRingtoneVolume': {'value': 14, 'timestamp': 1612626833000}, 'chargingStatus': {'value': 3, 'timestamp': 1638189458000}, 'ringtoneVolume': {'value': 0, 'timestamp': 1620291321000}, 'videoWdr': {'value': True, 'timestamp': 1619260446000}, 'statusLed': {'value': True, 'timestamp': 1612465348000}, 'battery': {'value': 0, 'timestamp': 1638955476891}, 'watermark': {'value': 1, 'timestamp': 1612509575000}, 'chimeHomebaseRingtoneType': {'value': 0, 'timestamp': 1635590889000}, 'state': {'value': 1, 'timestamp': 1612465342000}, 'audioRecording': {'value': True, 'timestamp': 1612465348000}, 'autoNightvision': {'value': True, 'timestamp': 1612465348000}, 'speakerVolume': {'value': 100, 'timestamp': 1612465348000}, 'videoStreamingQuality': {'value': 2, 'timestamp': 1628006878000}, 'powerWorkingMode': {'value': 1, 'timestamp': 1612465348000}, 'batteryTemperature': {'value': 6, 'timestamp': 1638156751000}, 'wifiRssi': {'value': -48, 'timestamp': 1638954591418}, 'wifiSignalLevel': {'value': 4, 'timestamp': 1638185700000}, 'motionDetectionType': {'value': 0, 'timestamp': 1612465342000}, 'motionDetected': {'value': False, 'timestamp': 0}, 'personDetected': {'value': False, 'timestamp': 0}, 'personName': {'value': '', 'timestamp': 0}, 'ringing': {'value': False, 'timestamp': 0}}
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - WebSocket message sent. {"messageId": "poll_refresh", "command": "driver.poll_refresh"}
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] Finished fetching eufy_security data in 0.002 seconds (success: True)
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - coordinator initialized - {'devices': {'T8210** REMOVED **': <custom_components.eufy_security.const.Device object at 0x7f963ca460>}, 'stations': {'T8010** REMOVED **': <custom_components.eufy_security.const.Device object at 0x7f963caaf0>}}
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security Doorbell - set_is_streaming - start - False - False - False
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security Doorbell - set_is_streaming - end - False - False - False
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - camera setup entries - [<Entity Doorbell: Idle - 0 %>]
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - binary init - state.statusLed
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - binary init - state.motionDetected
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - binary init - state.motionDetection
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - binary init - state.personDetected
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - binary init - state.ringing
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - binary init - state.autoNightvision
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - binary init - state.audioRecording
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - binary init - state.enabled
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security - binary init - is_streaming
2021-12-08 10:55:44 DEBUG (MainThread) [custom_components.eufy_security] eufy_security Doorbell - T8210** REMOVED ** - True
bropat commented 2 years ago

@kauthmbt

I need the entire log of eufy-security-ws. What you posted above is not enough.

fuatakgun commented 2 years ago

I was able to pin down my specific issue, when my 2c camera is being charged using non-default charger, it was jumping between 0 and correct value and charge was very slow. I have used direct usb charger and I can see that it is not happening. @kauthmbt , is your camera being charged while this issue is happening?

image

skrobul commented 2 years ago

fwiw, upgrading the custom component (fuatakgun/eufy_security) to latest version(ff37f6) solved the "0 battery" problem for me. There were some updates to it since this issue has been opened. My troubleshooting workflow connecting directly to eufy-security-ws with client and checking that battery is reported correctly which means the problem is likely on the home assistant side

kauthmbt commented 2 years ago

@fuatakgun The video doorbell is wired to the doorbell and therefore using the wiring for charging.

Nevertheless: The default behavior is no permanent charging of the battery. Normally the charging process only starts around 70% residual power. Then it charges up to 90% and switches the charging process off again.

@skrobul Thanks for the hint - I was hopeful but unfortunately it did not last long. Screenshot 2021-12-13 205644 It got back to normal after upgrading the custom component at 19:40 - but at 20:11 it switched back to "0" again.

fuatakgun commented 2 years ago

Yes, my initial assessment was wrong, issue repeated again, i will share debug logs soon.

fuatakgun commented 2 years ago

fwiw, upgrading the custom component (fuatakgun/eufy_security) to latest version(ff37f6) solved the "0 battery" problem for me. There were some updates to it since this issue has been opened. My troubleshooting workflow connecting directly to eufy-security-ws with client and checking that battery is reported correctly which means the problem is likely on the home assistant side

This is not a valid validation method to find out root cause. Home assistant integration doesn't impose any business logic other than exposing sensors and applying push notifications. Somewhere earlier, this push notification was received as zero battery but checking over eufy-security-ws client cannot have the same problem as current state is different.

fuatakgun commented 2 years ago

I have been waiting this thing to happen for whole day, it did not happen :) of course

bropat commented 2 years ago

Perhaps this problem is only present with doorbells?

fuatakgun commented 2 years ago

Nope, having same problem with my 2c camera, not recently though. I am following this closely and try to come up with debug logs

eikowagenknecht commented 2 years ago

Any news on this? It also affects some of my devices:

fuatakgun commented 2 years ago

It is on me to generate debug logs and a bit busy nowadays.

fuatakgun commented 2 years ago

hey @bropat, please find specific logs from eufy-security-ws when the issue had happened. When this had happened, received an event from web socket listener as property_changed

doorbell: T8210P00204807C8 base station: T8010P2320483306

device / T8210P00204807C8 / battery / 0

2022-01-13 16:14:12.336  DEBUG [P2PClientProtocol.handleMsg] Station T8010P2320483306 - DATA CONTROL - received from host 35.158.59.61:15056 - Processing sequence 35...
2022-01-13 16:14:12.336  DEBUG [P2PClientProtocol.parseDataMessage] Station T8010P2320483306 - Received data
{
  seqNo: 35,
  header: {
    commandId: 2111,
    bytesToRead: 8,
    channel: 0,
    signCode: 0,
    type: 0
  },
  bytesRead: 8,
  bytesToRead: 8,
  firstPartMessage: true,
  messageSize: 24
}
2022-01-13 16:14:12.337  DEBUG [P2PClientProtocol.handleDataControl] Station T8010P2320483306 - SUB1G_REP_UNPLUG_POWER_LINE
{
  payload: '\x03\x00\x00\x00\x00\x00\x00\x00'
}
2022-01-13 16:14:12.338  DEBUG [P2PClientProtocol.handleMsg] Station T8010P2320483306 - DATA CONTROL - Received expected sequence (seqNo: 35 queuedData.size: 0)
2022-01-13 16:14:12.376  DEBUG [P2PClientProtocol.handleMsg] Station T8010P2320483306 - DATA CONTROL - received from host 35.158.59.61:15056 - Processing sequence 35...
2022-01-13 16:14:12.377  DEBUG [P2PClientProtocol.handleMsg] Station T8010P2320483306 - DATA CONTROL - Received already processed sequence (seqNo: 35 queuedData.size: 0)

I will send you the whole logs as an email.

fuatakgun commented 2 years ago

Email is sent

trullock commented 2 years ago

I also have this issue. How do I get https://github.com/fuatakgun/eufy_security_addon into debug mode so I can report something useful? Thanks

fuatakgun commented 2 years ago

The problem is that, when you enable debug mode inside home assistant add-on, you will not be able to get all the log lines. I am skipping this to add intentionally as it would not add any value to add debug option.

You should run this as a docker instance to generate valuable log files otherwise even though i enable debug option in add-on, you will not be able to capture all of them.

For this specific issue, i had done the work and shared them with @bropat , nothing needed anymore.

trullock commented 2 years ago

so just docker run -it -e USERNAME=email@address.com -e PASSWORD=password_goes_here -e DEBUG=true -e COUNTRY=GB -p 3000:3000 bropat/eufy-security-ws:0.7.0?

Will that spurt sufficient logs?

Should I disable my HA addon first, do they interfere with each other?

fuatakgun commented 2 years ago

if you are running in the same host, you have to disable the add-on, yes.

For debug logs, use this below;

docker run -it -e DEBUG=1 -e USERNAME=email@address.com -e PASSWORD=password_goes_here -p 3000:3000 bropat/eufy-security-ws:0.7.0
trullock commented 2 years ago

Brill, logs obtained and emailed

bropat commented 2 years ago

Issue found will be fixed in next release (https://github.com/bropat/eufy-security-client/issues/109).

bropat commented 2 years ago

Version 0.8.0 released

kauthmbt commented 2 years ago

First of all: sorry for commenting on this "closed" issue again. If it is not intended let me know and I will create an additional one and link it.

It looked good after the release of 0.8.0. At least I got no dropping to "0" since the update (06.02.2022). At least yesterday (with 0.8.2) and today (0.8.3) the sensor dropped to "0" again in case of the doorbell pressed event. Can't really be sure about the same behaviour was already valid for 0.8.0 because this was the first time doorbell was pressed after the update.

image

As I have seen that additional users encountered the same behaviour with T8210 it might be interesting if they can reproduce the same issue on their devices as well. @eikowagenknecht , @trullock , @TuomasPakkanen ?

trullock commented 2 years ago

I can confirm on 0.8.2 I'm getting a value for battery

kauthmbt commented 2 years ago

@trullock Does it even keep the value when the doorbell is pressed?

trullock commented 2 years ago

I assume so, as its been pressed since installing 0.8.2 and it still has a value

kauthmbt commented 2 years ago

OK - thx for your feedback. This issue is driving me nuts I suppose..

TuomasPakkanen commented 2 years ago

Hi,

Thanks for pinging me as well. Thought also that this was already fixed but looking at the doorbell battery sensor now it has dropped to zero from about 25 percent this morning. The doorbell itself was not pressed then but it did probably register a motion event when I left home.

Beer17HWAM commented 2 years ago

Same here, dropped to 0% during the day. Nobody pressed the doorbell. Version 0.8.1.

bropat commented 2 years ago

The doorbell sends some power events via P2P. It could be that something was misinterpreted here and it therefore comes to these 0 values. So that I can refine it further and then finally solve the problem, I need from you the debug logs where I see exactly which P2P event with which data has caused it. I don't have a doorbell myself and therefore can't check it.

kauthmbt commented 2 years ago

I am trying to fetch the logs with the instructions @fuatakgun provided above (after adjusting the ws version of course) at least for my scenario. Hoping that I will ab able to manage on my own because I am not a command-line pro...

eikowagenknecht commented 2 years ago

I'm on 0.8.3 and the battery states are still completely unreliable (showing 0% where the camery has almost full battery): image

image

kauthmbt commented 2 years ago

Debug log finally obtained and emailed.

Beer17HWAM commented 2 years ago

@bropat Did you find the problem?

emufan commented 2 years ago

Same here. 2 out of 4 2C cameras dropped to 0. The other two still show values like 81%, but I don't know, if this is only better than the faulty 2 or correct.

KnalleArie commented 2 years ago

When will the next release be available with the fix?

BadgerLoaf commented 1 year ago

Sorry for commenting on a closed issue, and if required I am more than happy to raise a new case.

However I have recently set up a T8210 doorbell and I appear to have the same issue as described above, where the battery level does not update and remains static... currently mine shows as 60%, even though I have recently charged it fully.

I am running v2.8.0 of https://github.com/fuatakgun/eufy_security

Is there anything I can do to provide useful debug information @fuatakgun ?

Thanks for your help!