home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.18k stars 30.2k forks source link

Tuya Integration : Pet Feeder #83346

Closed Jens-Wymeersch closed 1 year ago

Jens-Wymeersch commented 1 year ago

The problem

My pet feeder gets recognized by the integration, but the entities that are created don't work or are irrelevant.

What version of Home Assistant Core has the issue?

2022.11.5

What was the last working version of Home Assistant Core?

NA

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Tuya

Link to integration documentation on our website

https://www.home-assistant.io/integrations/tuya

Diagnostics information

Here is the information I see in Home Assistant :

image

The following configuration entities work :

The following entities don't work :

I'm missing entities :

In Tuya I find following data points

{
  "result": [
    {
      "category": "sp",
      "devices": [
        "devicename"
      ],
      "functions": [
        {
          "code": "basic_indicator",
          "desc": "basic indicator",
          "name": "basic indicator",
          "type": "Boolean",
          "values": "{}"
        },
        {
          "code": "basic_osd",
          "desc": "basic osd",
          "name": "basic osd",
          "type": "Boolean",
          "values": "{}"
        },
        {
          "code": "basic_nightvision",
          "desc": "basic nightvision",
          "name": "basic nightvision",
          "type": "Enum",
          "values": "{\"range\":[\"0\",\"1\",\"2\"]}"
        },
        {
          "code": "sd_format",
          "desc": "sd format",
          "name": "sd format",
          "type": "Boolean",
          "values": "{}"
        },
        {
          "code": "motion_record",
          "desc": "motion record",
          "name": "motion record",
          "type": "Boolean",
          "values": "{}"
        },
        {
          "code": "record_switch",
          "desc": "record switch",
          "name": "record switch",
          "type": "Boolean",
          "values": "{}"
        },
        {
          "code": "record_mode",
          "desc": "record mode",
          "name": "record mode",
          "type": "Enum",
          "values": "{\"range\":[\"1\",\"2\"]}"
        },
        {
          "code": "device_restart",
          "desc": "device restart",
          "name": "device restart",
          "type": "Boolean",
          "values": "{}"
        }
      ],
      "product_id": "8zrzjldq07tlxnlv"
    }
  ],
  "success": true,
  "t": number,
  "tid": "tid"
}

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @tuya, @zlinoliver, @frenck, mind taking a look at this issue as it has been labeled with an integration (tuya) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `tuya` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Change the title of the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign tuya` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


tuya documentation tuya source (message by IssueLinks)

frenck commented 1 year ago

Could you download the device diagnostics from Home Assistant and attach those? Thanks 👍

../Frenck

Jens-Wymeersch commented 1 year ago

@frenck Here you go

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.11.5",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.10.7",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Asia/Jerusalem",
    "os_name": "Linux",
    "os_version": "5.15.74",
    "supervisor": "2022.11.2",
    "host_os": "Home Assistant OS 9.3",
    "docker_version": "20.10.18",
    "chassis": "vm",
    "run_as_root": true
  },
  "custom_components": {
    "openmediavault": {
      "version": "1.3.0",
      "requirements": []
    },
    "favicon": {
      "version": "10.4",
      "requirements": []
    },
    "fontawesome": {
      "version": "2.1.5",
      "requirements": []
    },
    "simpleicons": {
      "version": "v2.2.0",
      "requirements": [
        "simpleicons==7.14.0"
      ]
    },
    "var": {
      "version": "0.15.0",
      "requirements": []
    },
    "localtuya": {
      "version": "4.1.1",
      "requirements": []
    },
    "tesla_custom": {
      "version": "3.5.2",
      "requirements": [
        "teslajsonpy==3.3.0"
      ]
    },
    "climate_ip": {
      "version": "3.5.2",
      "requirements": [
        "requests>=2.21.0",
        "xmljson>=0.2.0"
      ]
    },
    "hacs": {
      "version": "1.28.4",
      "requirements": [
        "aiogithubapi>=22.2.4"
      ]
    },
    "alexa_media": {
      "version": "4.3.2",
      "requirements": [
        "alexapy==1.26.4",
        "packaging>=20.3",
        "wrapt>=1.12.1"
      ]
    },
    "browser_mod": {
      "version": "2.1.2",
      "requirements": []
    },
    "nuki_ng": {
      "version": "0.2.1",
      "requirements": []
    },
    "openrgb": {
      "version": "2.2",
      "requirements": [
        "openrgb-python==0.2.10"
      ]
    },
    "remote_homeassistant": {
      "version": "3.6",
      "requirements": []
    },
    "climate_template": {
      "version": "0.6.0",
      "requirements": []
    }
  },
  "integration_manifest": {
    "domain": "tuya",
    "name": "Tuya",
    "documentation": "https://www.home-assistant.io/integrations/tuya",
    "requirements": [
      "tuya-iot-py-sdk==0.6.6"
    ],
    "dependencies": [
      "ffmpeg"
    ],
    "codeowners": [
      "@Tuya",
      "@zlinoliver",
      "@frenck"
    ],
    "config_flow": true,
    "iot_class": "cloud_push",
    "dhcp": [
      {
        "macaddress": "105A17*"
      },
      {
        "macaddress": "10D561*"
      },
      {
        "macaddress": "1869D8*"
      },
      {
        "macaddress": "381F8D*"
      },
      {
        "macaddress": "508A06*"
      },
      {
        "macaddress": "68572D*"
      },
      {
        "macaddress": "708976*"
      },
      {
        "macaddress": "7CF666*"
      },
      {
        "macaddress": "84E342*"
      },
      {
        "macaddress": "D4A651*"
      },
      {
        "macaddress": "D81F12*"
      }
    ],
    "integration_type": "hub",
    "loggers": [
      "tuya_iot"
    ],
    "is_built_in": true
  },
  "data": {
    "endpoint": "https://openapi.tuyaeu.com",
    "auth_type": 0,
    "country_code": "32",
    "app_type": "tuyaSmart",
    "mqtt_connected": true,
    "disabled_by": null,
    "disabled_polling": false,
    "name": "Pet Feeder Niki",
    "model": "PP001",
    "category": "sp",
    "product_id": "8zrzjldq07tlxnlv",
    "product_name": "Smart Pet Feeder",
    "online": true,
    "sub": false,
    "time_zone": "+02:00",
    "active_time": "2022-12-04T17:00:56+00:00",
    "create_time": "2022-12-04T17:00:56+00:00",
    "update_time": "2022-12-04T17:01:17+00:00",
    "function": {
      "basic_indicator": {
        "type": "Boolean",
        "value": {}
      },
      "basic_osd": {
        "type": "Boolean",
        "value": {}
      },
      "basic_nightvision": {
        "type": "Enum",
        "value": {
          "range": [
            "0",
            "1",
            "2"
          ]
        }
      },
      "sd_format": {
        "type": "Boolean",
        "value": {}
      },
      "motion_record": {
        "type": "Boolean",
        "value": {}
      },
      "record_switch": {
        "type": "Boolean",
        "value": {}
      },
      "record_mode": {
        "type": "Enum",
        "value": {
          "range": [
            "1",
            "2"
          ]
        }
      },
      "device_restart": {
        "type": "Boolean",
        "value": {}
      }
    },
    "status_range": {
      "basic_indicator": {
        "type": "Boolean",
        "value": {}
      },
      "basic_osd": {
        "type": "Boolean",
        "value": {}
      },
      "basic_nightvision": {
        "type": "Enum",
        "value": {
          "range": [
            "0",
            "1",
            "2"
          ]
        }
      },
      "sd_storge": {
        "type": "String",
        "value": {
          "maxlen": 255
        }
      },
      "sd_status": {
        "type": "Integer",
        "value": {
          "min": 1,
          "max": 5,
          "scale": 0,
          "step": 1
        }
      },
      "sd_format": {
        "type": "Boolean",
        "value": {}
      },
      "motion_record": {
        "type": "Boolean",
        "value": {}
      },
      "sd_format_state": {
        "type": "Integer",
        "value": {
          "min": -20000,
          "max": 200000,
          "scale": 0,
          "step": 1
        }
      },
      "record_switch": {
        "type": "Boolean",
        "value": {}
      },
      "record_mode": {
        "type": "Enum",
        "value": {
          "range": [
            "1",
            "2"
          ]
        }
      },
      "device_restart": {
        "type": "Boolean",
        "value": {}
      }
    },
    "status": {
      "basic_indicator": true,
      "basic_osd": true,
      "basic_nightvision": 0,
      "sd_storge": "100|0|100",
      "sd_status": 5,
      "sd_format": false,
      "motion_record": false,
      "sd_format_state": 0,
      "record_switch": true,
      "record_mode": 1,
      "device_restart": false
    },
    "home_assistant": {
      "name": "Pet Feeder Niki",
      "name_by_user": null,
      "disabled": false,
      "disabled_by": null,
      "entities": [
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": null,
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "camera.smart_pet_feeder",
            "state": "recording",
            "attributes": {
              "access_token": "df458448c82258bc9106d01a4dede881e944bbac79bfb2c07ebce7123f4b772e",
              "model_name": "Smart Pet Feeder",
              "brand": "Tuya",
              "frontend_stream_type": "hls",
              "entity_picture": "**REDACTED**",
              "friendly_name": "Pet Feeder Niki",
              "supported_features": 2
            },
            "last_changed": "2022-12-05T18:29:54.580106+00:00",
            "last_updated": "2022-12-05T18:54:23.761778+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "light.smart_pet_feeder_indicator_light",
            "state": "on",
            "attributes": {
              "supported_color_modes": [
                "onoff"
              ],
              "color_mode": "onoff",
              "friendly_name": "Pet Feeder Niki Indicator Light",
              "supported_features": 0
            },
            "last_changed": "2022-12-05T18:28:39.379029+00:00",
            "last_updated": "2022-12-05T18:28:39.379029+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": "tuya__record_mode",
          "icon": null,
          "original_icon": "mdi:record-rec",
          "unit_of_measurement": null,
          "state": {
            "entity_id": "select.smart_pet_feeder_record_mode",
            "state": "1",
            "attributes": {
              "options": [
                "1",
                "2"
              ],
              "device_class": "tuya__record_mode",
              "icon": "mdi:record-rec",
              "friendly_name": "Pet Feeder Niki Record mode"
            },
            "last_changed": "2022-12-05T18:31:21.727796+00:00",
            "last_updated": "2022-12-05T18:31:21.727796+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": "tuya__basic_nightvision",
          "icon": null,
          "original_icon": "mdi:theme-light-dark",
          "unit_of_measurement": null,
          "state": {
            "entity_id": "select.smart_pet_feeder_night_vision",
            "state": "0",
            "attributes": {
              "options": [
                "0",
                "1",
                "2"
              ],
              "device_class": "tuya__basic_nightvision",
              "icon": "mdi:theme-light-dark",
              "friendly_name": "Pet Feeder Niki Night vision"
            },
            "last_changed": "2022-12-05T18:30:11.074934+00:00",
            "last_updated": "2022-12-05T18:30:11.074934+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "original_icon": "mdi:record-rec",
          "unit_of_measurement": null,
          "state": {
            "entity_id": "switch.smart_pet_feeder_video_recording",
            "state": "on",
            "attributes": {
              "icon": "mdi:record-rec",
              "friendly_name": "Pet Feeder Niki Video Recording"
            },
            "last_changed": "2022-12-05T18:29:54.580261+00:00",
            "last_updated": "2022-12-05T18:29:54.580261+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "original_icon": "mdi:record-rec",
          "unit_of_measurement": null,
          "state": {
            "entity_id": "switch.smart_pet_feeder_motion_recording",
            "state": "off",
            "attributes": {
              "icon": "mdi:record-rec",
              "friendly_name": "Pet Feeder Niki Motion Recording"
            },
            "last_changed": "2022-12-05T01:01:18.254310+00:00",
            "last_updated": "2022-12-05T01:01:18.254310+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "original_icon": "mdi:watermark",
          "unit_of_measurement": null,
          "state": {
            "entity_id": "switch.smart_pet_feeder_time_watermark",
            "state": "on",
            "attributes": {
              "icon": "mdi:watermark",
              "friendly_name": "Pet Feeder Niki Time Watermark"
            },
            "last_changed": "2022-12-05T18:29:13.416507+00:00",
            "last_updated": "2022-12-05T18:29:13.416507+00:00"
          }
        }
      ]
    }
  }
}
frenck commented 1 year ago

The Tuya IoT Cloud API provides us with the following functions for your device:

    "function": {
      "basic_indicator": {
        "type": "Boolean",
        "value": {}
      },
      "basic_osd": {
        "type": "Boolean",
        "value": {}
      },
      "basic_nightvision": {
        "type": "Enum",
        "value": {
          "range": [
            "0",
            "1",
            "2"
          ]
        }
      },
      "sd_format": {
        "type": "Boolean",
        "value": {}
      },
      "motion_record": {
        "type": "Boolean",
        "value": {}
      },
      "record_switch": {
        "type": "Boolean",
        "value": {}
      },
      "record_mode": {
        "type": "Enum",
        "value": {
          "range": [
            "1",
            "2"
          ]
        }
      },
      "device_restart": {
        "type": "Boolean",
        "value": {}
      }
    },
    "status_range": {
      "basic_indicator": {
        "type": "Boolean",
        "value": {}
      },
      "basic_osd": {
        "type": "Boolean",
        "value": {}
      },
      "basic_nightvision": {
        "type": "Enum",
        "value": {
          "range": [
            "0",
            "1",
            "2"
          ]
        }
      },
      "sd_storge": {
        "type": "String",
        "value": {
          "maxlen": 255
        }
      },
      "sd_status": {
        "type": "Integer",
        "value": {
          "min": 1,
          "max": 5,
          "scale": 0,
          "step": 1
        }
      },
      "sd_format": {
        "type": "Boolean",
        "value": {}
      },
      "motion_record": {
        "type": "Boolean",
        "value": {}
      },
      "sd_format_state": {
        "type": "Integer",
        "value": {
          "min": -20000,
          "max": 200000,
          "scale": 0,
          "step": 1
        }
      },
      "record_switch": {
        "type": "Boolean",
        "value": {}
      },
      "record_mode": {
        "type": "Enum",
        "value": {
          "range": [
            "1",
            "2"
          ]
        }
      },
      "device_restart": {
        "type": "Boolean",
        "value": {}
      }

And provides us with the following status information on your device:

    "status": {
      "basic_indicator": true,
      "basic_osd": true,
      "basic_nightvision": 0,
      "sd_storge": "100|0|100",
      "sd_status": 5,
      "sd_format": false,
      "motion_record": false,
      "sd_format_state": 0,
      "record_switch": true,
      "record_mode": 1,
      "device_restart": false
    },

I'm missing entities :

  • feed - ability to give a portion or multiple up to 5
  • sensor information related to the status of the feeder (empty or not?)
  • motion sensor

As you can see in the diagnostics dump you have provided, the Tuya IoT Cloud API simply doesn't provide any of that information. We can't create entities that provide controls or information if that isn't supplied by the vendor.

If you think that is an error, please contact Tuya.

Sorry! I wish I had better new for you.

../Frenck

pergolafabio commented 1 year ago

Hi @frenck , I have also a wifi pet feeder and the exact same issue...tuya integration/API only discovered some entities as in log above, no feed entity for example...

I traced down the smart life app, and discovered there were a lot more DPs that are not visible on the IOT tuya platform... In my case 201 was the DP to use the feed..

I now use localtuya instead todo the feed by sending a value to 201...

Is it possible to add manually DP in this integration if the are not discovered correctly?

I used this action to get all values, also the hidden ones: tuya.m.my.group.device.list