rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
3k stars 565 forks source link

Support for Tuya Cameras #1516

Open FGOD1983 opened 1 year ago

FGOD1983 commented 1 year ago

I noticed that there is no support yet for Tuya platform Camera's

Would be nice if you can add them.

In my case it is the LSC Rotatable Camera with the following data point according to Tuya IoT:

English(EN)
My Space
Query Properties
Parameter(Request Method: GET)
Params
device_id
{deviceid}
codes
Debugging Result
View Docs
Locate Errors
During API debugging, the platform uses the authorization key (Access ID & Access Secret) of the current project to get a temporary token and initiate API calls to access your data and online resources. Proceed with caution.
Request URLCopy
curl --request GET "https://openapi.tuyaeu.com/v2.0/cloud/thing/{deviceid}/shadow/properties" --header "sign_method: HMAC-SHA256" --header "client_id: {clientid}" --header "t: 1696867227661" --header "mode: cors" --header "Content-Type: application/json" --header "sign: {sign}" --header "access_token: {token}"
ResponseCopy
{
  "result": {
    "properties": [
      {
        "code": "basic_flip",
        "custom_name": "",
        "dp_id": 103,
        "time": 1696867021325,
        "value": false
      },
      {
        "code": "basic_osd",
        "custom_name": "",
        "dp_id": 104,
        "time": 1696867021355,
        "value": false
      },
      {
        "code": "basic_private",
        "custom_name": "",
        "dp_id": 105,
        "time": 1696867021383,
        "value": false
      },
      {
        "code": "motion_sensitivity",
        "custom_name": "",
        "dp_id": 106,
        "time": 1696867021429,
        "value": "0"
      },
      {
        "code": "basic_nightvision",
        "custom_name": "",
        "dp_id": 108,
        "time": 1696867021466,
        "value": "0"
      },
      {
        "code": "sd_storge",
        "custom_name": "",
        "dp_id": 109,
        "time": 1696867227179,
        "value": "258048|0|258048"
      },
      {
        "code": "sd_status",
        "custom_name": "",
        "dp_id": 110,
        "time": 1696867021530,
        "value": 1
      },
      {
        "code": "sd_format",
        "custom_name": "",
        "dp_id": 111,
        "time": 1696866015033,
        "value": false
      },
      {
        "code": "movement_detect_pic",
        "custom_name": "",
        "dp_id": 115,
        "time": 1696867136373,
        "value": "eyJ2IjoiMy4wIiwiYnVja2V0IjoidHktZXUtc3RvcmFnZTMwLXBpYyIsImZpbGVzIjpbWyIvYTc4NjE0LTQ2NzE0NjAyLXliZ2QyNDRmYzRiMjMwODkxMGRkL2RldGVjdC8xNjk2ODY3MTM1LmpwZWciLCJmOTYyMGY2NzczNzUwODg2Il1dfQ=="
      },
      {
        "code": "ptz_stop",
        "custom_name": "",
        "dp_id": 116,
        "time": 1696866210935,
        "value": true
      },
      {
        "code": "sd_format_state",
        "custom_name": "",
        "dp_id": 117,
        "time": 1696866030389,
        "value": 0
      },
      {
        "code": "ptz_control",
        "custom_name": "",
        "dp_id": 119,
        "time": 1696866210681,
        "value": "5"
      },
      {
        "code": "ptz_calibration",
        "custom_name": "",
        "dp_id": 132,
        "time": 1696866015033,
        "value": false
      },
      {
        "code": "motion_switch",
        "custom_name": "",
        "dp_id": 134,
        "time": 1696866030022,
        "value": true
      },
      {
        "code": "decibel_switch",
        "custom_name": "",
        "dp_id": 139,
        "time": 1696866188265,
        "value": true
      },
      {
        "code": "decibel_sensitivity",
        "custom_name": "",
        "dp_id": 140,
        "time": 1696866029965,
        "value": "0"
      },
      {
        "code": "record_switch",
        "custom_name": "",
        "dp_id": 150,
        "time": 1696866030303,
        "value": true
      },
      {
        "code": "record_mode",
        "custom_name": "",
        "dp_id": 151,
        "time": 1696866030345,
        "value": "1"
      },
      {
        "code": "siren_switch",
        "custom_name": "",
        "dp_id": 159,
        "time": 1696866268141,
        "value": false
      },
      {
        "code": "motion_tracking",
        "custom_name": "",
        "dp_id": 161,
        "time": 1696866133104,
        "value": true
      },
      {
        "code": "alarm_message",
        "custom_name": "",
        "dp_id": 185,
        "time": 1696866816813,
        "value": "eyJ2IjoiNS4wIiwiY21kIjoiaXBjX2JhbmciLCJ0eXBlIjoiaW1hZ2UiLCJ3aXRoIjoicmVzb3VyY2VzIiwiZmlsZXMiOltbInR5LWV1LXN0b3JhZ2UzMC1waWMiLCIvYTc4NjE0LTQ2NzE0NjAyLXliZ2QyNDRmYzRiMjMwODkxMGRkL2RldGVjdC8xNjk2ODY2ODE1LmpwZWciLCIzYWFkZWE1MzMzZGVkNWEzIiwiMTY5OTQ1ODgxNiJdXX0="
      },
      {
        "code": "basic_anti_flicker",
        "custom_name": "",
        "dp_id": 188,
        "time": 1696866030493,
        "value": "1"
      }
    ]
  },
  "success": true,
  "t": 1696867229244,
  "tid": "f7c55aa766bc11ee9ecb2e37e0a5aa6f"
}
ntlgr commented 1 year ago

I have a tuya camera and it works perfectly with localtuya

pergolafabio commented 1 year ago

How do you add an camera entity with localtuya? Since cameras don't use DP values?

ntlgr commented 1 year ago

You're unlucky as I have this system offline as I am moving home. I will probably restart it in a month or so. I have access to the backups but I can't seem to find my config of localtuya in a file. If you can guide me where the config is stored I can look it up.

pergolafabio commented 1 year ago

It's indeed in a hidden folder :

config/.storage/core.config_entries

pergolafabio commented 1 year ago

Wonder how you did it, cause on mainpage of this localtuya, they also tell that camera entity is not supported :-)

ntlgr commented 1 year ago

It looks like I was wrong. For the camera I was using the official tuya integration that leverages the cloud. Sorry :(