eufy-security-ws icon indicating copy to clipboard operation
eufy-security-ws copied to clipboard

[Question]: State vs Properties

Open fuatakgun opened this issue 1 year ago • 13 comments

Ask your question

In schema version 7, start_listening response was including all devices and stations with their current states (all properties too).

In schema version 11, start listening response was including very limited properties and I have to rely on get_properties call to fetch additional information.

What is the condition in terms of expected place of these attributes (eg: motionDetectionType)

Example output of start_listening:

        {
          'name': 'Entrance',
          'model': 'T8113-Z',
          'serialNumber': 'T8113N63205014E2',
          'hardwareVersion': 'T8113-Z',
          'softwareVersion': '5.4.6',
          'stationSerialNumber': 'T8010N2320460480',
          'enabled': True,
          'state': 1,
          'battery': 38,
          'batteryTemperature': 25,
          'lastChargingDays': 21,
          'lastChargingTotalEvents': 2598,
          'lastChargingRecordedEvents': 2283,
          'lastChargingFalseEvents': 315,
          'batteryUsageLastWeek': 0,
          'motionDetected': False,
          'personDetected': False,
          'personName': '',
          'antitheftDetection': False,
          'motionDetection': True,
          'rtspStream': True,
          'watermark': 1,
          'wifiRSSI': -48,
          'pictureUrl': 'xyz',
          'ledStatus': False
        }

Example output of get_device_properties:

{
  'type': 'result',
  'success': True,
  'messageId': 'get_device_properties',
  'result': {
    'serialNumber': 'T8410P20210912B3',
    'properties': {
      'motionDetected': False,
      'personDetected': False,
      'personName': '',
      'petDetected': False,
      'soundDetected': False,
      'cryingDetected': False,
      'name': 'Garden',
      'model': 'T8410',
      'serialNumber': 'T8410P20210912B3',
      'type': 31,
      'hardwareVersion': 'P2',
      'softwareVersion': '2.1.2.2',
      'stationSerialNumber': 'T8410P20210912B3',
      'rtspStreamUrl': 'rtsp://admin:[email protected]/live0',
      'rotationSpeed': 4,
      'notificationCrying': True,
      'notificationPet': True,
      'motionDetection': True,
      'soundDetectionSensitivity': 5,
      'enabled': True,
      'audioRecording': True,
      'soundDetectionType': 2,
      'notificationAllOtherMotion': True,
      'statusLed': True,
      'speaker': True,
      'continuousRecordingType': 0,
      'petDetection': False,
      'motionTracking': True,
      'watermark': 0,
      'microphone': True,
      'videoRecordingQuality': 2,
      'soundDetection': True,
      'videoStreamingQuality': 1,
      'imageMirrored': False,
      'notificationType': 2,
      'rtspStream': True,
      'speakerVolume': 100,
      'notificationAllSound': True,
      'autoNightvision': True,
      'continuousRecording': True,
      'motionDetectionType': 1,
      'notificationPerson': True,
      'motionDetectionSensitivity': 5,
      'pictureUrl': 'xyz'
    }
  }
}

fuatakgun avatar Jul 29 '22 17:07 fuatakgun

One option could be keeping only identification information in start_listening response and moving all state information into get_properties so all will be kept under one API. Some attributes can only be found in start_listening response such as;

  • state
  • battery
  • all other battery specific attributes
  • antitheftDetection
  • wifiRSSI
  • ledStatus (probably replaced as statusLed)

fuatakgun avatar Jul 29 '22 17:07 fuatakgun

Note: The above examples are not from the same device.

bropat avatar Jul 30 '22 13:07 bropat

You mean, because of different devices, is this not valid? Or you need this information for the identical devices? Or i should not conclude anything yet?

fuatakgun avatar Jul 30 '22 15:07 fuatakgun

No, that was just an info. I think your suggestion makes sense, but I have to check a few things first.

bropat avatar Jul 30 '22 15:07 bropat

Agreed, i will also share these from same device to guarantee the completeness.

fuatakgun avatar Jul 30 '22 15:07 fuatakgun

@fuatakgun

In the next version (schema version 13) I will only list the serial numbers of the devices and stations in the start_listening response. The rest will be obtained by calling get_properties_metadata and get_properties by sending the respective serial number. What do you think?

bropat avatar Aug 25 '22 16:08 bropat

That is a great step forward for standardizing the responses, suits for me. I will also incorporate these into home assistant, thanks

fuatakgun avatar Aug 25 '22 16:08 fuatakgun

@fuatakgun

I have published a first release candidate (1.0.0-rc.1). This already has the changes discussed above. Docker image is available.

Can you test the new version?

Thank you!

bropat avatar Aug 27 '22 16:08 bropat

testing candidate version, one out of topic question, is this an expected order of messages, more specifically Push notification connection closed

2022-08-28 16:37:24.396  INFO  Eufy Security server listening on host 0.0.0.0, port 3000
2022-08-28 16:37:26.531  INFO  Connected to station T8010N2320460480 on host 87.240.aa.bb and port xxx
2022-08-28 16:37:28.147  INFO  Push notification connection closed
2022-08-28 16:37:34.514  INFO  Connected to station T8410P20210912B3 on host 87.240.aa.bb and port yyy
2022-08-28 16:37:34.600  INFO  Push notification connection successfully established
2022-08-28 16:37:34.604  INFO  Push notification connection successfully established

fuatakgun avatar Aug 28 '22 16:08 fuatakgun

I might be doing something wrong here, correct me if that is the case, bumped local schema version to 13 and start_listening response includes many attributes than serial_number.

docker command;

 docker run -it -e [email protected] -e PASSWORD=password -e COUNTRY=LU -p 3000:3000 bropat/eufy-security-ws:1.0.0-rc.1

response of start_listening;

{
  'state': {
    'driver': {
      'version': '2.2.0-rc.2',
      'connected': True,
      'pushConnected': True
    },
    'stations': [
      {
        'name': 'Home Base',
        'model': 'T8010',
        'serialNumber': 'T8010N2320460480',
        'hardwareVersion': 'P0',
        'softwareVersion': '3.1.9.0h',
        'lanIpAddress': '192.168.xxx',
        'macAddress': '8C:85:80:75:2B:75',
        'currentMode': 1,
        'guardMode': 1,
        'connected': True
      },
      {
        'name': 'Garden',
        'model': 'T8410',
        'serialNumber': 'T8410P20210912B3',
        'hardwareVersion': 'P2',
        'softwareVersion': '2.1.2.4',
        'lanIpAddress': '192.168.xxx',
        'macAddress': '8C85808C2D45',
        'currentMode': 1,
        'guardMode': 1,
        'connected': True
      }
    ],
    'devices': [
      {
        'name': 'Entrance',
        'model': 'T8113-Z',
        'serialNumber': 'T8113N63205014E2',
        'hardwareVersion': 'T8113-Z',
        'softwareVersion': '5.4.7',
        'stationSerialNumber': 'T8010N2320460480',
        'enabled': True,
        'state': 1,
        'battery': 72,
        'batteryTemperature': 27,
        'lastChargingDays': 18,
        'lastChargingTotalEvents': 1279,
        'lastChargingRecordedEvents': 1248,
        'lastChargingFalseEvents': 31,
        'batteryUsageLastWeek': 0,
        'motionDetected': False,
        'personDetected': False,
        'personName': '',
        'antitheftDetection': False,
        'motionDetection': True,
        'rtspStream': True,
        'watermark': 1,
        'wifiRSSI': -42,
        'pictureUrl': 'xxx',
        'ledStatus': False
      },
      {
        'name': 'Garage',
        'model': 'T8113-Z',
        'serialNumber': 'T8113N63205018FC',
        'hardwareVersion': 'T8113-Z',
        'softwareVersion': '5.4.7',
        'stationSerialNumber': 'T8010N2320460480',
        'enabled': True,
        'state': 1,
        'battery': 76,
        'batteryTemperature': 28,
        'lastChargingDays': 31,
        'lastChargingTotalEvents': 554,
        'lastChargingRecordedEvents': 323,
        'lastChargingFalseEvents': 231,
        'batteryUsageLastWeek': 9,
        'motionDetected': False,
        'personDetected': False,
        'personName': '',
        'antitheftDetection': False,
        'motionDetection': True,
        'rtspStream': True,
        'watermark': 1,
        'wifiRSSI': -53,
        'pictureUrl': 'xxx',
        'ledStatus': False
      },
      {
        'name': 'LivingRoom',
        'model': 'T8113',
        'serialNumber': 'T8113N1320483643',
        'hardwareVersion': 'eufy2_mini',
        'softwareVersion': '1.7.4',
        'stationSerialNumber': 'T8010N2320460480',
        'enabled': True,
        'state': 1,
        'battery': 61,
        'batteryTemperature': 28,
        'lastChargingDays': 20,
        'lastChargingTotalEvents': 2015,
        'lastChargingRecordedEvents': 1694,
        'lastChargingFalseEvents': 321,
        'batteryUsageLastWeek': 0,
        'motionDetected': False,
        'personDetected': False,
        'personName': '',
        'antitheftDetection': False,
        'motionDetection': True,
        'rtspStream': True,
        'watermark': 1,
        'wifiRSSI': -46,
        'pictureUrl': 'xxx',
        'ledStatus': False
      },
      {
        'name': 'FrontDoor',
        'model': 'T8113',
        'serialNumber': 'T8113N13204824BE',
        'hardwareVersion': 'eufy2_mini',
        'softwareVersion': '1.7.4',
        'stationSerialNumber': 'T8010N2320460480',
        'enabled': True,
        'state': 1,
        'battery': 96,
        'batteryTemperature': 22,
        'lastChargingDays': 0,
        'lastChargingTotalEvents': 51,
        'lastChargingRecordedEvents': 0,
        'lastChargingFalseEvents': 51,
        'batteryUsageLastWeek': 10,
        'motionDetected': False,
        'personDetected': False,
        'personName': '',
        'antitheftDetection': True,
        'motionDetection': True,
        'rtspStream': True,
        'watermark': 1,
        'wifiRSSI': -72,
        'pictureUrl': 'xxx',
        'ledStatus': False
      },
      {
        'name': 'Garden',
        'model': 'T8410',
        'serialNumber': 'T8410P20210912B3',
        'hardwareVersion': 'P2',
        'softwareVersion': '2.1.2.4',
        'stationSerialNumber': 'T8410P20210912B3',
        'enabled': True,
        'motionDetected': False,
        'personDetected': False,
        'personName': '',
        'soundDetected': False,
        'petDetected': False,
        'cryingDetected': False,
        'autoNightvision': True,
        'motionDetection': True,
        'soundDetection': True,
        'petDetection': False,
        'rtspStream': True,
        'watermark': 0,
        'ledStatus': False
      }
    ]
  }
}

fuatakgun avatar Aug 28 '22 16:08 fuatakgun

Are you sure you are using schema version 13? In eufy-security-ws there is a client, when using this, I get the expected answer for schema version 13, only with the serial numbers. You can try it yourself.

bropat avatar Aug 28 '22 17:08 bropat

My bad, sending in wrong order, let me fix the order

``

{"messageId": "start_listening", "command": "start_listening"} {"messageId": "set_api_schema", "command": "set_api_schema", "schemaVersion": 13} {"messageId": "driver_connect", "command": "driver.connect"}



fuatakgun avatar Aug 28 '22 17:08 fuatakgun

you were right, just receiving the responses of serial numbers;

{
  "type": "result",
  "success": true,
  "messageId": "start_listening",
  "result": {
    "state": {
      "driver": {
        "version": "2.2.0-rc.2",
        "connected": true,
        "pushConnected": true,
        "mqttConnected": false
      },
      "stations": [
        "T8010N2320460480",
        "T8410P20210912B3"
      ],
      "devices": [
        "T8113N63205014E2",
        "T8113N63205018FC",
        "T8113N1320483643",
        "T8113N13204824BE",
        "T8410P20210912B3"
      ]
    }
  }
}

fuatakgun avatar Aug 28 '22 17:08 fuatakgun