0x5e / homebridge-tuya-platform

Make homebridge-tuya-platform great again.
MIT License
222 stars 67 forks source link

How can I expose DP instructions as a separated sensor? #290

Open felipehjcosta opened 1 year ago

felipehjcosta commented 1 year ago

Device Infomation JSON File

{
      "active_time": 1674473480,
      "biz_type": 0,
      "category": "hps",
      "create_time": 1674473480,
      "icon": "smart/icon/ay15431316572284AcPZ/94b1bdcbb24c806e8f74e4993b67131f.jpg",
      "id": "eb69f530d9d1f4abedjny9",
      "ip": "",
      "lat": "",
      "lon": "",
      "model": "",
      "name": "Sensor de presença Escritório ",
      "online": true,
      "owner_id": "",
      "product_id": "",
      "product_name": "ZigBee呼吸存在传感器",
      "status": [
        {
          "code": "presence_state",
          "value": "presence"
        },
        {
          "code": "sensitivity",
          "value": 6
        },
        {
          "code": "near_detection",
          "value": 10
        },
        {
          "code": "far_detection",
          "value": 160
        },
        {
          "code": "checking_result",
          "value": "check_success"
        },
        {
          "code": "target_dis_closest",
          "value": 114
        }
      ],
      "sub": true,
      "time_zone": "-03:00",
      "uid": "",
      "update_time": 1682082079,
      "uuid": ""
}

Detail Informations

I have a presence sensor which it's also a luminance sensor and I would like to expose it as a separated sensor

Specifications

path = /v1.0/devices/eb69f530d9d1f4abedjny9/specifications
data = {
  "result": {
    "category": "hps",
    "functions": [
      {
        "code": "sensitivity",
        "type": "Integer",
        "values": "{\"min\":0,\"max\":9,\"scale\":0,\"step\":1}"
      },
      {
        "code": "near_detection",
        "type": "Integer",
        "values": "{\"unit\":\"M\",\"min\":0,\"max\":950,\"scale\":2,\"step\":10}"
      },
      {
        "code": "far_detection",
        "type": "Integer",
        "values": "{\"unit\":\"M\",\"min\":0,\"max\":950,\"scale\":2,\"step\":10}"
      }
    ],
    "status": [
      {
        "code": "presence_state",
        "type": "Enum",
        "values": "{\"range\":[\"none\",\"presence\"]}"
      },
      {
        "code": "sensitivity",
        "type": "Integer",
        "values": "{\"min\":0,\"max\":9,\"scale\":0,\"step\":1}"
      },
      {
        "code": "near_detection",
        "type": "Integer",
        "values": "{\"unit\":\"M\",\"min\":0,\"max\":950,\"scale\":2,\"step\":10}"
      },
      {
        "code": "far_detection",
        "type": "Integer",
        "values": "{\"unit\":\"M\",\"min\":0,\"max\":950,\"scale\":2,\"step\":10}"
      },
      {
        "code": "checking_result",
        "type": "Enum",
        "values": "{\"range\":[\"checking\",\"check_success\",\"check_failure\",\"others\",\"comm_fault\",\"radar_fault\"]}"
      },
      {
        "code": "target_dis_closest",
        "type": "Integer",
        "values": "{\"unit\":\"M\",\"min\":0,\"max\":1000,\"scale\":2,\"step\":1}"
      }
    ]
  },
  "success": true,
  "t":,
  "tid": ""
}

Table of Instructions

DP Instruction Standard Instruction
presence_state presence_state
sensitivity sensitivity
near_detection near_detection
far_detection far_detection
checking_result checking_result
target_dis_closest target_dis_closest
detection_delay -
fading_time -
cli -
illuminance -
0x5e commented 1 year ago

it's not able to separete now, the next major version I will plan to do this, there's so many combination products :(

felipehjcosta commented 1 year ago

That would be awesome! A lot of devices are reaching the market with a lot of combinations!