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
879 stars 207 forks source link

Error creating the InfraredTV Remote device driver #210

Open Jhonattan-Souza opened 3 years ago

Jhonattan-Souza commented 3 years ago

Describe the bug Im trying to add the Infrared TV remote capabilities, writing the device driver but when I send the commands this is the response:

I`ve also tried with just 'value' as the parameter in the json, but without success.

POST, url = https://openapi.tuyaus.com/v1.0/devices/ebc41ada7f2f4cdda9dfda/commands, params = None, body = {'commands': [{'code': 'Volume+', 'values': 'Volume+'}]}

POST, url = https://openapi.tuyaus.com/v1.0/devices/ebc41ada7f2f4cdda9dfda/commands, params = None, body = {'commands': [{'code': 'Volume+', 'values': 'Volume+'}]}

Response: {
  "code": 500,
  "msg": "system error, please contact the admin",
  "success": false,
  "t": 1627156652057
}

Response: {
  "code": 500,
  "msg": "system error, please contact the admin",
  "success": false,
  "t": 1627156652057
}

Can you guys help me with this ?

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

{
"active_time": 1625840556,
"biz_type": 18,
"category": "infrared_tv",
"create_time": 1625840556,
"icon": "smart/icon/1538041570h4qms2354ni_0.png",
"id": "ebc41ada7f2f4cdda9dfda",
"ip": "",
"lat": "",
"local_key": "2959b3407a843b1a",
"lon": "",
"name": "TV",
"node_id": "662f041dab8b4246",
"online": true,
"owner_id": "11596570",
"product_id": "ZAx1jolkKaiu8JtM",
"product_name": "TV",
"status": [],
"sub": true,
"time_zone": "+08:00",
"uid": "az1576125271010d3j7N",
"update_time": 1627153028,
"uuid": "ebc41ada7f2f4cdda9dfda"
}

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

{
"result": {
"category": "infrared_tv",
"functions": [
{
"code": "-/--",
"type": "STRING",
"values": "-/--"
},
{
"code": "0",
"type": "STRING",
"values": "0"
},
{
"code": "1",
"type": "STRING",
"values": "1"
},
{
"code": "2",
"type": "STRING",
"values": "2"
},
{
"code": "3",
"type": "STRING",
"values": "3"
},
{
"code": "4",
"type": "STRING",
"values": "4"
},
{
"code": "5",
"type": "STRING",
"values": "5"
},
{
"code": "6",
"type": "STRING",
"values": "6"
},
{
"code": "7",
"type": "STRING",
"values": "7"
},
{
"code": "8",
"type": "STRING",
"values": "8"
},
{
"code": "9",
"type": "STRING",
"values": "9"
},
{
"code": "Back",
"type": "STRING",
"values": "Back"
},
{
"code": "C",
"type": "ENUM",
"values": "{\"min\":1,\"max\":999,\"scale\":0,\"step\":1,\"type\":\"Integer\"}"
},
{
"code": "Channel+",
"type": "STRING",
"values": "Channel+"
},
{
"code": "Channel-",
"type": "STRING",
"values": "Channel-"
},
{
"code": "Down",
"type": "STRING",
"values": "Down"
},
{
"code": "Home",
"type": "STRING",
"values": "Home"
},
{
"code": "Left",
"type": "STRING",
"values": "Left"
},
{
"code": "Menu",
"type": "STRING",
"values": "Menu"
},
{
"code": "OK",
"type": "STRING",
"values": "OK"
},
{
"code": "Power",
"type": "STRING",
"values": "Power"
},
{
"code": "Right",
"type": "STRING",
"values": "Right"
},
{
"code": "Up",
"type": "STRING",
"values": "Up"
},
{
"code": "Volume+",
"type": "STRING",
"values": "Volume+"
},
{
"code": "Volume-",
"type": "STRING",
"values": "Volume-"
}
],
"status": []
},
"success": true,
"t": 1627155298523
}

Additional context Add any other context or logs about the problem here.

tsutsuku commented 3 years ago

@Jhonattan-Souza IR uses Extension APIs, not like normal devices. https://developer.tuya.com/en/docs/cloud/universal-infrared?id=K9jgsgd7buln4

You are welcome to create a new PR at https://github.com/tuya/tuya-iot-python-sdk. It will be better to develop a new IR driver base on it.

Jhonattan-Souza commented 3 years ago

Thank you tsutsuku, I will take a look on it!

Jhonattan-Souza commented 3 years ago

Hi @tsutsuku :)

I'm finishing the implementation of the infrared into the sdk , but, looking at the docs, there's no option to receive feedback from the physical controller, to start a automation from a physical remote arriving at the Tuya IR,

Can you guide me towards this problem? I don't know how to apply devices to receive notification in the mqtt o.o