tuya / tuya-home-assistant

Home Assistant integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, maintained by the Home Assistant Community and Tuya Developer Team.
MIT License
857 stars 206 forks source link

Tuya Doorbell #353

Open Zeunas opened 2 years ago

Zeunas commented 2 years ago

Device normal info

Device info (please complete the following information, which can be found in log): like this:

{
"active_time": 1618070357,
"biz_type": 18,
"category": "sp",
"create_time": 1618070357,
"icon": "smart/icon/ay15372371921250HFeV/627001a418dace4ba63512f221d34bb3.jpg",
"id": "bf4cbb6ae874bf65322amd",
"ip": "***",
"lat": "***",
"local_key": "***",
"lon": "***",
"name": "Doorbell",
"online": true,
"owner_id": "4826775",
"product_id": "ormfprbeceg0jps8",
"product_name": "Security Camera",
"status": [
{
"code": "basic_flip",
"value": false
},
{
"code": "basic_osd",
"value": true
},
{
"code": "sd_storge",
"value": "30920704|1511709|29408995"
},
{
"code": "sd_status",
"value": 1
},
{
"code": "sd_format",
"value": true
},
{
"code": "movement_detect_pic",
"value": "eyJidWNrZXQiOiJ0eS1ldS1zdG9yYWdlMzAiLCJmaWxlcyI6W1siLzFkZDBhYi00ODI2Nzc1LWh3eGRkOWE3NWM0ZmZlYTgwNDMyL2RldGVjdC8xNjI4ODkyMzMzLmpwZWc/cGFyYW09eU00Z0ljb0kwR3lWNWhMWWF2TGFBMVd6bGtIbEJxV2YyRGcvQ0REMXl1QT0iLCIiXV0sInYiOiIzLjAifQ=="
},
{
"code": "sd_format_state",
"value": 0
},
{
"code": "doorbell_active",
"value": ""
},
{
"code": "wireless_electricity",
"value": 100
},
{
"code": "wireless_powermode",
"value": "1"
},
{
"code": "wireless_lowpower",
"value": 50
},
{
"code": "wireless_awake",
"value": false
},
{
"code": "pir_switch",
"value": "3"
}

Device specifications (please complete the following information, which can be found in log): Same device's id, like this:

2021-08-13 22:21:30 DEBUG (SyncWorker_9) [tuya iot] Request: method = GET, url = https://openapi.tuyaeu.com/v1.0/devices/bf4cbb6ae874bf65322amd/specifications, params = None, body = None, t = 1628889690354
2021-08-13 22:21:30 DEBUG (SyncWorker_9) [tuya iot] Response: {
"result": {
"category": "sp",
"functions": [
{
"code": "basic_flip",
"type": "Boolean",
"values": "{}"
},
{
"code": "basic_osd",
"type": "Boolean",
"values": "{}"
},
{
"code": "sd_format",
"type": "Boolean",
"values": "{}"
},
{
"code": "wireless_lowpower",
"type": "Integer",
"values": "{\"unit\":\"\",\"min\":10,\"max\":50,\"scale\":1,\"step\":1}"
},
{
"code": "wireless_awake",
"type": "Boolean",
"values": "{}"
},
{
"code": "pir_switch",
"type": "Enum",
"values": "{\"range\":[\"0\",\"1\",\"2\",\"3\"]}"
}
],
"status": [
{
"code": "basic_flip",
"type": "Boolean",
"values": "{}"
},
{
"code": "basic_osd",
"type": "Boolean",
"values": "{}"
},
{
"code": "sd_storge",
"type": "String",
"values": "{\"maxlen\":255}"
},
{
"code": "sd_status",
"type": "Integer",
"values": "{\"unit\":\"\",\"min\":1,\"max\":5,\"scale\":1,\"step\":1}"
},
{
"code": "sd_format",
"type": "Boolean",
"values": "{}"
},
{
"code": "movement_detect_pic",
"type": "Raw",
"values": "{}"
},
{
"code": "sd_format_state",
"type": "Integer",
"values": "{\"unit\":\"\",\"min\":-20000,\"max\":20000,\"scale\":1,\"step\":1}"
},
{
"code": "doorbell_active",
"type": "String",
"values": "{\"maxlen\":255}"
},
{
"code": "wireless_electricity",
"type": "Integer",
"values": "{\"unit\":\"\",\"min\":0,\"max\":100,\"scale\":1,\"step\":1}"
},
{
"code": "wireless_powermode",
"type": "Enum",
"values": "{\"range\":[\"0\",\"1\"]}"
},
{
"code": "wireless_lowpower",
"type": "Integer",
"values": "{\"unit\":\"\",\"min\":10,\"max\":50,\"scale\":1,\"step\":1}"
},
{
"code": "wireless_awake",
"type": "Boolean",
"values": "{}"
},
{
"code": "pir_switch",
"type": "Enum",
"values": "{\"range\":[\"0\",\"1\",\"2\",\"3\"]}"
}
]
},
"success": true,
"t": 1628889690437
}

It should be possible to decode (with Base64) the raw data from "movement_detect_pic" and convert it to a motion event for a binary sensor. Also by decoding the same raw data I believe that it may be possible to extract the image from from that movement and perhaps integrate it as a camera on HA (I read the link to the image in the raw data is only accessible for 60 seconds thou).

rasho6169 commented 2 years ago

Tuya please add to IOT, was not available in version 1 and is still missing in version 2 (beta). Your company claims to be working with Home Assistant to improve integration, but still lacks drivers for DEVICES and relying on enthusiast to implement the entities without having the base frame work. Somewhat hard to go forward if foundation is not laid. Please update IOT to include all STANDARD STATUS SET. https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq Current SDK does not have category SP, and doubtfully more other categories. To pull a request is futile unless its a category supported by python SDK, which is very few compared to what available on android SDK. Please update IOT and SDK.

Once the foundation is there developers and enthusiast can pull request to implement and improve upon this base foundation, thus creating a reliable TUYA DEVICE in Home Assistant which will promote your product to a wider community and be more competitive to other companies competing in Home Automation

frenck commented 2 years ago

Some basics for doorbells have been implemented in the Home Assistant Core version of the integration and are pending release with Home Assistant 2021.11. This is mainly camera support. Doorbell push events is currently in progress.

FragMenthor commented 2 years ago

A few months have already passed, lots of new versions, and still this seem to be forgotten... I'm not a programmer, but other sensors of my Tuya doorbell are present, only the usefull ones are left out: doorbell press, camera and motion sensor. Without them the doorbell is pretty useless, those sensores are the base triggers for every thinkable automation based on a smart doorbell... Any news on this? Should be in Home assistant 2021.11 (as of october last year), 5 months later, version 2022.03 and nothing changed. Will this be supported or shall I just drop this, sell mine in second hand and buy a more reliable one outside Tuya ecosystem?

JurajNyiri commented 2 years ago

@FragMenthor as a workaround until this is fixed, you can use a universal local solution I described here.

Zeunas commented 2 years ago

I have dropped this actually...got rid of mine and bought a eufy doorbell camera instead. Much more relaliable, better quality and with a goog integration support on home assistant.

FragMenthor commented 2 years ago

@FragMenthor as a workaround until this is fixed, you can use a universal local solution I described here.

I already tried using my Broadlink to capture RF, and could not get any code, so probably not worth investing in another device just to try to capture something that I don't know if it is even possible, just to cover for a flaw that, I hope, soon will get covered. If not, soon, I will go for another solution.. But thanks for your feedback!!

JurajNyiri commented 2 years ago

@FragMenthor I also have broadlinks and it cannot be used as permanent capture device and cannot capture any RF code, while sonoff RF can (except rolling codes). One needs to use right tool for the job.

FragMenthor commented 2 years ago

@FragMenthor I also have broadlinks and it cannot be used as permanent capture device and cannot capture any RF code, while sonoff RF can (except rolling codes). One needs to use right tool for the job.

Yeah, thanks, I know that it can't be permanently used, but should catch "something" in learning mode, and it doens't. Afraid to buy one more device, add to and already overloaded wifi network, just to try to catch something that should be direct and easy... But thanks again, I see your point and you are right, the right tools do make a difference.

FragMenthor commented 2 years ago

Thought I just leave here the links to my logs that I posted in LocalTuya integration, in despair:

https://github.com/rospogrigio/localtuya/issues/449

Hope this gets covered "soon" (TM)

JurajNyiri commented 2 years ago

@FragMenthor just to clarify for any future readers, nor broadlink or sonoff with orig firmware can capture any rf code. They can capture mostly their own rf codes, or very limited spectrum. As per the tasmota docs:

The device is shipped with Itead firmware which supports a limited set of RF devices limited to mostly just Sonoff devices (a single 24-bit RF protocol).

The trick to sonoff is flashing the RF chip on it with Portisch, to unlock the full potential.

// last message from me on this topic to not sidetrack discussion here from the original purpose - supporting events on tuya doorbells via wifi.

x5engine commented 1 year ago

I have a tuyau peephole camera will it work too

sacredprey005 commented 1 year ago

I also have a sonoff rf bridge with portisch but it still wont capture anything useful from my tuya doorbell and even on my other dumb 433 doorbell.. so hopefully tuya can add support for doorbell events

lboue commented 1 year ago

Is there anything new on this subject?

karolzamosc commented 11 months ago

Hi, any news...?

almirus commented 10 months ago

hi! i have a camera Laxi-Mini9S It also have motion detection function (without button)

{
  "result": {
    "active_time": 1632943995,
    "biz_type": 0,
    "category": "sp",
    "create_time": 1632943995,
    "icon": "smart/icon/ay1511509043755MhIx1/a83766e4b6f490f8053ef60cd7bb61aa.png",
    "id": "HIDDEN",
    "ip": "109.252.108.24",
    "lat": "HIDDEN",
    "local_key": "HIDDEN",
    "lon": "HIDDEN",
    "model": "",
    "name": "Laxi-Mini9S(安凯V300)",
    "online": true,
    "owner_id": "36487050",
    "product_id": "dcdwcufgkyneudnn",
    "product_name": "M4-TY ",
    "status": [
      {
        "code": "basic_indicator",
        "value": false
      },
      {
        "code": "basic_flip",
        "value": false
      },
      {
        "code": "basic_osd",
        "value": false
      },
      {
        "code": "motion_sensitivity",
        "value": "0"
      },
      {
        "code": "basic_nightvision",
        "value": "0"
      },
      {
        "code": "sd_storge",
        "value": "30639|30119|520"
      },
      {
        "code": "sd_status",
        "value": 1
      },
      {
        "code": "sd_format",
        "value": false
      },
      {
        "code": "movement_detect_pic",
        "value": "eyJidWNrZXQiOiJ0eS1ldS1zdG9yYWdlMzAtcGljIiwiZmlsZXMiOltbIi9mN2UyNDAtMzY0ODcwNTAtcHAwMWM2NDFjZjBiZTY1MWE0ZjkvZGV0ZWN0LzE2OTIzMDQxMDguanBlZz9wYXJhbT1FcEVwZlJEa1VOMmVKQ3krdjJYNjFvZ0RaTWhYSjliOVVkQngxNUl6ci9RPSIsIiJdXSwidiI6IjMuMCJ9"
      },
      {
        "code": "sd_format_state",
        "value": -20000
      },
      {
        "code": "motion_switch",
        "value": true
      },
      {
        "code": "decibel_switch",
        "value": false
      },
      {
        "code": "decibel_sensitivity",
        "value": "1"
      },
      {
        "code": "decibel_upload",
        "value": ""
      },
      {
        "code": "record_switch",
        "value": true
      },
      {
        "code": "record_mode",
        "value": "1"
      }
    ],
    "sub": false,
    "time_zone": "+03:00",
    "uid": "HIDDEN",
    "update_time": 1692303267,
    "uuid": "HIDDEN"
  },
  "success": true,
  "t": 1692304243574,
  "tid": "f05b22f83d3c11eea9649a766792eea9"
}
{
  "result": {
    "category": "sp",
    "functions": [
      {
        "code": "basic_indicator",
        "dp_id": 101,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "basic_flip",
        "dp_id": 103,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "basic_osd",
        "dp_id": 104,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "motion_sensitivity",
        "dp_id": 106,
        "type": "Enum",
        "values": "{\"range\":[\"0\",\"1\",\"2\"]}"
      },
      {
        "code": "basic_nightvision",
        "dp_id": 108,
        "type": "Enum",
        "values": "{\"range\":[\"0\",\"1\",\"2\"]}"
      },
      {
        "code": "sd_format",
        "dp_id": 111,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "motion_switch",
        "dp_id": 134,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "decibel_switch",
        "dp_id": 139,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "decibel_sensitivity",
        "dp_id": 140,
        "type": "Enum",
        "values": "{\"range\":[\"0\",\"1\"]}"
      },
      {
        "code": "record_switch",
        "dp_id": 150,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "record_mode",
        "dp_id": 151,
        "type": "Enum",
        "values": "{\"range\":[\"1\",\"2\"]}"
      }
    ],
    "status": [
      {
        "code": "basic_indicator",
        "dp_id": 101,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "basic_flip",
        "dp_id": 103,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "basic_osd",
        "dp_id": 104,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "motion_sensitivity",
        "dp_id": 106,
        "type": "Enum",
        "values": "{\"range\":[\"0\",\"1\",\"2\"]}"
      },
      {
        "code": "basic_nightvision",
        "dp_id": 108,
        "type": "Enum",
        "values": "{\"range\":[\"0\",\"1\",\"2\"]}"
      },
      {
        "code": "sd_storge",
        "dp_id": 109,
        "type": "String",
        "values": "{\"maxlen\":255}"
      },
      {
        "code": "sd_status",
        "dp_id": 110,
        "type": "Integer",
        "values": "{\"min\":1,\"max\":5,\"scale\":0,\"step\":1}"
      },
      {
        "code": "sd_format",
        "dp_id": 111,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "movement_detect_pic",
        "dp_id": 115,
        "type": "Raw",
        "values": "{}"
      },
      {
        "code": "sd_format_state",
        "dp_id": 117,
        "type": "Integer",
        "values": "{\"min\":-20000,\"max\":200000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "motion_switch",
        "dp_id": 134,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "decibel_switch",
        "dp_id": 139,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "decibel_sensitivity",
        "dp_id": 140,
        "type": "Enum",
        "values": "{\"range\":[\"0\",\"1\"]}"
      },
      {
        "code": "decibel_upload",
        "dp_id": 141,
        "type": "String",
        "values": "{\"maxlen\":255}"
      },
      {
        "code": "record_switch",
        "dp_id": 150,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "record_mode",
        "dp_id": 151,
        "type": "Enum",
        "values": "{\"range\":[\"1\",\"2\"]}"
      }
    ]
  },
  "success": true,
  "t": 1692304357117,
  "tid": "3410ac723d3d11eeb3f09e6a0abc163a"
}
almirus commented 10 months ago

https://developer.tuya.com/en/docs/iot-device-dev/sdk?id=K95019g5w3eiq#title-25-Motion%20detection%20(general)

sznt commented 4 months ago

So how can you integrate things like "doorbell_active" to Home Assistant from Tuya Cloud?