make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.31k stars 515 forks source link

Request support for Nedis SmartLife Outdoor Camera WiFi #914

Closed oleg-d closed 1 year ago

oleg-d commented 1 year ago

Log Message

Logger: custom_components.tuya_local.config_flow
Source: custom_components/tuya_local/config_flow.py:49
Integration: Tuya Local ([documentation](https://github.com/make-all/tuya-local), [issues](https://github.com/make-all/tuya-local/issues))
First occurred: 6:20:08 PM (2 occurrences)
Last logged: 6:20:08 PM

    Device matches None with quality of 0%. DPS: {"updated_at": 1689952807.33672, "115": "eyJ2IjoiMy4wIiwiYnVja2V0IjoidHktZXUtc3RvcmFnZTMwLXBpYyIsImZpbGVzIjpbWyIvMzcyZGRiLTcxNTM5OTMyLXBwMDFlYzM5MDljYzBjOTE5NDMxL2RldGVjdC8xNjg5OTUyODA2LmpwZWciLCIyZDg5ZTA2OGM4MjFjNjcwIl1dfQ=="}
    Report this to https://github.com/make-all/tuya-local/issues/

Information about DPS mappings

{
  "result": {
    "model": "{\"modelId\":\"000002mtpi\",\"services\":[{\"actions\":[],\"code\":\"\",\"description\":\"\",\"events\":[],\"name\":\"默认服务\",\"properties\":[
{\"abilityId\":101,\"accessMode\":\"rw\",\"code\":\"basic_indicator\",\"description\":\"设备设置页面-基本功能设置\\n设备指示灯是否打开,true打开,false关闭\",\"name\":\"状态指示灯\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}},
{\"abilityId\":103,\"accessMode\":\"rw\",\"code\":\"basic_flip\",\"description\":\"设备设置页面-基本功能设置\\n使直播画面垂直翻转,true打开翻转,false关闭翻转\",\"name\":\"画面翻转\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}},
{\"abilityId\":104,\"accessMode\":\"rw\",\"code\":\"basic_osd\",\"description\":\"设备设置页面-基本功能设置\\n时间水印功能开关,true打开水印,false关闭水印\",\"name\":\"时间水印\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}},
{\"abilityId\":106,\"accessMode\":\"rw\",\"code\":\"motion_sensitivity\",\"description\":\"0-2,灵敏度依次增加;仅为灵敏度,0并不是关闭移动侦测报警;规定0为低灵敏度,1为中灵敏度,2为高灵敏度。\",\"name\":\"移动侦测灵敏度\",\"typeSpec\":{\"range\":[\"0\",\"1\",\"2\"],\"type\":\"enum\",\"typeDefaultValue\":\"0\"}},
{\"abilityId\":108,\"accessMode\":\"rw\",\"code\":\"basic_nightvision\",\"description\":\"0:自动\\n1:关\\n2:开\",\"name\":\"红外夜视\",\"typeSpec\":{\"range\":[\"0\",\"1\",\"2\"],\"type\":\"enum\",\"typeDefaultValue\":\"0\"}},
{\"abilityId\":109,\"accessMode\":\"ro\",\"code\":\"sd_storge\",\"description\":\"示例:\\n---2017.07.08更新---\\n单位改为kb\\n---\\n3503775744|778977280|2718158848\\n其中第一字符串是总容量,第二个字符串是已使用的容量,第三个是剩余容量\",\"name\":\"获取存储卡容量\",\"typeSpec\":{\"maxlen\":255,\"type\":\"string\",\"typeDefaultValue\":\"\"}},
{\"abilityId\":110,\"accessMode\":\"ro\",\"code\":\"sd_status\",\"description\":\"status:sd卡状态,1-正常,2-异常,3-空间不足,4-正在格式化,5-无SD卡;\",\"name\":\"存储卡状态\",\"typeSpec\":{\"max\":5,\"min\":1,\"scale\":1,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":1,\"unit\":\"\"}},
{\"abilityId\":111,\"accessMode\":\"rw\",\"code\":\"sd_format\",\"description\":\"无参数\",\"name\":\"存储卡格式化\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}},
{\"abilityId\":115,\"accessMode\":\"ro\",\"code\":\"movement_detect_pic\",\"description\":\"该功能实现请参考SDK\\n---------------\\n{\\\"dp_id\\\",\\\"bucket;object;key\\\"}/{\\\"dp_id\\\",\\\"bucket;object;\\\"}\\n\\nbucket:根文件夹;objcet:文件路径;key:加密\",\"name\":\"移动侦测\",\"typeSpec\":{\"maxlen\":128,\"type\":\"raw\"}},
{\"abilityId\":117,\"accessMode\":\"ro\",\"code\":\"sd_format_state\",\"description\":\"返回错误码:\\n-2000:SD卡正在格式化\\n-2001:SD卡格式化异常\\n-2002:无SD卡\\n-2003:SD卡错误\\n\\n//正数为格式化进度\",\"name\":\"格式化状态\",\"typeSpec\":{\"max\":20000,\"min\":-20000,\"scale\":1,\"step\":1,\"type\":\"value\",\"typeDefaultValue\":-20000,\"unit\":\"\"}},
{\"abilityId\":134,\"accessMode\":\"rw\",\"code\":\"motion_switch\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-yundong\",\"attribute\":\"4\"},\"name\":\"移动报警开关\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}},
{\"abilityId\":139,\"accessMode\":\"rw\",\"code\":\"decibel_switch\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-yinliang\",\"attribute\":\"4\"},\"name\":\"声音侦测报警开关\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}},
{\"abilityId\":140,\"accessMode\":\"rw\",\"code\":\"decibel_sensitivity\",\"description\":\"0代表低灵敏度;1代表高灵敏度\",\"name\":\"声音侦测灵敏度\",\"typeSpec\":{\"range\":[\"0\",\"1\"],\"type\":\"enum\",\"typeDefaultValue\":\"0\"}},
{\"abilityId\":141,\"accessMode\":\"ro\",\"code\":\"decibel_upload\",\"description\":\"用于报警消息推送,app上会显示通知\",\"name\":\"检测到声音\",\"typeSpec\":{\"maxlen\":255,\"type\":\"string\",\"typeDefaultValue\":\"\"}},
{\"abilityId\":150,\"accessMode\":\"rw\",\"code\":\"record_switch\",\"description\":\"设备设置页面-存储卡设置\\nSD卡录像开关,true为打开,false为关闭\\n功能关闭时,不录像到SD卡\",\"name\":\"SD卡录像开关\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}},
{\"abilityId\":151,\"accessMode\":\"rw\",\"code\":\"record_mode\",\"description\":\"设备设置页面-存储卡设置\\nSD卡录像模式选择,1为事件录像(检测到移动再录像到SD卡),2为连续录像\",\"extensions\":{\"iconName\":\"icon-dp_circle\",\"attribute\":\"4\"},\"name\":\"录像模式\",\"typeSpec\":{\"range\":[\"1\",\"2\"],\"type\":\"enum\",\"typeDefaultValue\":\"1\"}},
{\"abilityId\":168,\"accessMode\":\"rw\",\"code\":\"motion_area_switch\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-setting\"},\"name\":\"报警区域开关\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}},
{\"abilityId\":169,\"accessMode\":\"rw\",\"code\":\"motion_area\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-setting\"},\"name\":\"报警区域\",\"typeSpec\":{\"maxlen\":255,\"type\":\"string\",\"typeDefaultValue\":\"\"}},
{\"abilityId\":253,\"accessMode\":\"rw\",\"code\":\"onvif_change_pwd\",\"description\":\"APP下发\\n{\\\"oldpwd\\\":\\\"oldpassword\\\",\\\"newpwd\\\":\\\"newpassword\\\"}\\n\\n设备返回\\n1.修改成功, 返回ok,APP返回上一级菜单。\\n\\n{\\\"res\\\":\\\"ok\\\"}\\n2.修改失败,返回failed,并附加errcode错误码,APP展示错误原因。\\n\\n{\\\"res\\\":\\\"failed\\\",\\\"errcode\\\":1}\\n错误码:\\n1:当前密码输入错误\\n2:密码不符合规则\",\"name\":\"密码修改\",\"typeSpec\":{\"maxlen\":255,\"type\":\"string\",\"typeDefaultValue\":\"\"}},
{\"abilityId\":254,\"accessMode\":\"ro\",\"code\":\"onvif_ip_addr\",\"description\":\"格式  xxx.xxx.xxx.xxx  \",\"name\":\"onvif IP上报\",\"typeSpec\":{\"maxlen\":255,\"type\":\"string\",\"typeDefaultValue\":\"\"}},
{\"abilityId\":255,\"accessMode\":\"rw\",\"code\":\"onvif_switch\",\"description\":\"\",\"name\":\"onvif开关\",\"typeSpec\":{\"type\":\"bool\",\"typeDefaultValue\":false}}]}]}"
  },
  "success": true,
  "t": 1689953150801,
  "tid": "dfdedcb227da11ee94e0a2e0adfc0b14"
}

Product ID

  "product_id": "irt8xftriwhxbzsn",
  "product_name": "Outdoor Camera WIFICO11CWT",

Information about how the device functions

Link to product page on Nedis website https://nedis.com/en-us/product/safety-and-security/cameras/outdoor-cameras/550671323/smartlife-outdoor-camera-wi-fi-hd-720p-ip65-internal-16gb-12-v-dc-with-motion-sensor-night-vision-silver-white

To be honest I am just looking to get the video feed into Tuya Local HA I would be happy. Not planning on using any of the settings through HA.

make-all commented 1 year ago

There is no support for video feed locally, as far as I can tell video support requires the cloud for Tuya cameras. I do see a still image in the log though, but it is the only data coming from the device, which may not be the case all the time.

szupi-ipuzs commented 1 year ago

@oleg-d , according to this website, this camera offers onvif and local stream via rtsp. Could you confirm this? If so, I might buy one too :) and then I could try to create tuya-local setup...

oleg-d commented 1 year ago

@szupi-ipuzs tbh i am not quite sure if it does. i am currently using an integration (this one) which exposes the camera feed locally so i can view that with the use of go2rtc

make-all commented 1 year ago

The dp data contains onvif settings, but it is not clear whether that is enough to get local camera streaming working. In any case, onvif video would be best handled by another integration which I think already exists.

AlderForrest commented 1 year ago

confirmed that model WIFICO11CWT works with ONVIF integration on Home Assistant. ONVIF must switched on with mobil app (e.g. Nedis SmartLife), user:admin and pass: admin (by default).

ONFIL streams (with credentials above): onvif://admin:admin@your-camera-ip:8000?subtype=IPCProfilesToken0 (HD) onvif://admin:admin@your-camera-ip:8000?subtype=IPCProfilesToken1 (low res)

works also with VLC player on network stream (with credentials above):: rtsp://admin:admin@your-camera-ip:8554/Streaming/Channels/101 (HD) rtsp://admin:admin@your-camera-ip:8554/Streaming/Channels/102 (low res)

szupi-ipuzs commented 1 year ago

I've just got the same camera and rtsp working, but it does not seem to broadcast any dpids by itself (tried with tinytuya). I do however see it changing the values on the mobile app request. Sadly, tuya-local seems to wait for dpid 115, and I have no idea how to force the camera to broadcast. @oleg-d, did you do any tricks with mobile app to do that? I can smell "new firmware" issues again...

@make-all , is there a way to force tuya-local to use a manually-selected yaml config file for a device?

oleg-d commented 1 year ago

@szupi-ipuzs I didn't do any tricks on the mobile app, I am simply using the Smart Life app (not the Nedis app).

szupi-ipuzs commented 1 year ago

Just for the record, I managed to make the camera return dpids values by using this simple tinytuya script:

import tinytuya

#tinytuya.set_debug(True)

dpids = [101, 103, 104, 106, 108, 109, 110, 111, 115, 117, 134, 139, 140, 141, 150, 151, 168, 169, 253, 254, 255]

for dpid in dpids:
    d = tinytuya.Device('REDACTED', 'REDACTED',
      'REDACTED',
      'device22')

    d.set_version(3.3)

    print(" > Send Request for dpid " + str(dpid) + " < ")
    d.add_dps_to_request(dpid)
    payload = d.generate_payload(tinytuya.DP_QUERY)
    d.send(payload)

    data = d.receive()
    while data:
        print('Received Payload: %r' % data)
        data = d.receive()

So it seems I got a "device22" issue, where each dpid needs to be requested separately (as described eg. here) @make-all , any chance for integrating this way of device detection in tuya-local? Maybe as an option, for the "advanced" users? If we know the device is of "22" type and we know the dpids...

UPDATE: I've just noticed that simply querying the dpids with the above scripts resets the values to defaults and even triggers formatting of sd-card. So right now I don't recommend using this solution...