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
71.14k stars 29.81k forks source link

Human Presence Sensor not recognized by official Tuya integration #123357

Open EnzoD86 opened 1 month ago

EnzoD86 commented 1 month ago

The problem

I just bought this device, but it is not recognized by Home Assistant. There are no entities.

image

What version of Home Assistant Core has the issue?

core-2024.8.0

What was the last working version of Home Assistant Core?

No response

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

{
        "id": "bfb1d0ecbb75a14c63ijab",
        "name": "Human Presence Sensor",
        "category": "kg",
        "product_id": "wzp9yjsobanavsut",
        "product_name": "Human Presence Sensor",
        "online": true,
        "sub": false,
        "time_zone": "+02:00",
        "active_time": "2024-08-08T09:46:36+00:00",
        "create_time": "2024-08-08T09:46:36+00:00",
        "update_time": "2024-08-08T09:46:36+00:00",
        "function": {},
        "status_range": {},
        "status": {},
        "home_assistant": {
          "name": "Human Presence Sensor",
          "name_by_user": null,
          "disabled": false,
          "disabled_by": null,
          "entities": []
        },
        "set_up": false,
        "support_local": true
      }

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

This is the detail of the device taken from tuya iot platform:

{ "result": { "active_time": 1723110396, "biz_type": 18, "category": "kg", "create_time": 1723110396, "icon": "smart/icon/ay1573546958261faWcj/a0501f989d70120d098023fbd9e6a658.png", "id": "bfb1d0ecbb75a14c63ijab", "ip": "***.***.***.***", "lat": "44.6", "local_key": "****************", "lon": "11.05", "model": "", "name": "Human Presence Sensor", "online": false, "owner_id": "55190972", "product_id": "wzp9yjsobanavsut", "product_name": "Human Presence Sensor", "status": [], "sub": false, "time_zone": "+02:00", "uid": "eu16500238564415oxW0", "update_time": 1723114169, "uuid": "189c7b0e1f86abf8" }, "success": true, "t": 1723153671440, "tid": "dc42142a55cf11ef8d1002b5f94b0719" }

home-assistant[bot] commented 1 month 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` Renames 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. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


tuya documentation tuya source (message by IssueLinks)

Captain-Beaky commented 1 month ago

I can confirm this. HA 2024.7.3

Captain-Beaky commented 1 month ago

And on 2024.8.0

EnzoD86 commented 1 month ago

I added the detail of the device taken from Tuya IoT Platform

EnzoD86 commented 1 month ago

Hi, I did some investigating and this problem occurs because the manufacturer of the device did not use a standard instruction set. I noticed that the device category is "kg" which should be used for switches and not for an presence sensor. Furthermore, from the Tuya IOT platform I was unable to access the device's DP's because the "Get Device Specify" API gave me an error. After several attempts I changed the instruction set from Standard Instruction to DPI Instruction and in this way I was able to view the DP's of the device.

I managed to map my device to the tuya-local integration and it works perfectly.

I don't know if cases like these are handled by the official tuya integration. If necessary and if you intend to implement this device I can attach the DP's that I extracted. Otherwise you can close this issue.

Thank you

Amirel91 commented 1 month ago

Hi, I did some investigating and this problem occurs because the manufacturer of the device did not use a standard instruction set. I noticed that the device category is "kg" which should be used for switches and not for an presence sensor. Furthermore, from the Tuya IOT platform I was unable to access the device's DP's because the "Get Device Specify" API gave me an error. After several attempts I changed the instruction set from Standard Instruction to DPI Instruction and in this way I was able to view the DP's of the device.

I managed to map my device to the tuya-local integration and it works perfectly.

I don't know if cases like these are handled by the official tuya integration. If necessary and if you intend to implement this device I can attach the DP's that I extracted. Otherwise you can close this issue.

Thank you

Ciao Enzo,

we bought the same device and i have the same issue, can you help me explaining me how to fix it? Thanks a lot! Ps: Sono italiano ma non so se è il caso di rispondere in italiano, magari può essere utile anche ad altri! Grazie!

EnzoD86 commented 1 month ago

Ciao Enzo,

we bought the same device and i have the same issue, can you help me explaining me how to fix it? Thanks a lot! Ps: Sono italiano ma non so se è il caso di rispondere in italiano, magari può essere utile anche ad altri! Grazie!

Ciao @Amirel91, we risk going off-topic!

Anyway, I opened a pull request on the tuya local project with the implementation of this device; in the next days/weeks it should be implemented and you should be able to configure it through that integration. I hope this will solve your problem!

Niek commented 1 week ago

Same issue here, it would be great if the official implementation supports it.

srjit commented 5 days ago

I was able to identify entities for this device following the instructions (up to step 5) from this guide.

However, when I ran the command mentioned in step 7, no devices were detected. Instead, I used the "Link App Account" option under the "Devices" tab, and by scanning the QR code from the Smart Life phone app which already had the presence sensor linked.

Afterwards, I installed Local Tuya via HACS and followed the instructions under the "Adding the Integration" section. Hope this helps.

Screenshot 2024-09-08 at 12 07 42 AM
remusache commented 2 days ago

I was able to identify entities for this device following the instructions (up to step 5) from this guide.

However, when I ran the command mentioned in step 7, no devices were detected. Instead, I used the "Link App Account" option under the "Devices" tab, and by scanning the QR code from the Smart Life phone app which already had the presence sensor linked.

Afterwards, I installed Local Tuya via HACS and followed the instructions under the "Adding the Integration" section. Hope this helps.

Screenshot 2024-09-08 at 12 07 42 AM

@srjit Is there a chance you could provide a tutorial or a more in depth on how exactly you managed to add it to HA? Thank you.

srjit commented 2 days ago

Certainly. Here you go.

On your phone

  1. Install the Smart Life app
  2. Use the + sign at the right top to scan and add your presence sensor to the app.

On the web

  1. Create an account on Tuya IoT.
  2. Navigate to Cloud > Development and click on Create Cloud Project:
    • Set Industry to "Smart Home"
    • Set Development Method to "Smart Home"
    • Select the Western America data center (or your region).
  3. You will receive an Access ID (Client ID) and Access Secret (Client Secret). ; You will need this later.
  4. Go to the Devices tab and click on Link App Account.
  5. Note the UID from the details page; you will need this later.
  6. Scan the QR code using the SmartLife app (Use the scanner at the right top in "Me" tab of the app).
  7. You should now be able to view all your Tuya devices which are present in the Smart Life app.
  8. In Home Assistant, install LocalTuya (https://github.com/rospogrigio/localtuya).
  9. Add a LocalTuya device integration with the following details:
    • Select the appropriate API server region.
    • Enter the Access ID and Secret from step 3.
    • Use the UID from step 5 as the User ID.
  10. Although I had 3 other devices in the IoT web, only the presence sensor was showing up here for some reason.

Once correctly configured it should show up like this Screenshot 2024-09-11 at 12 16 27 PM

remusache commented 2 days ago

Hello @srjit Thank you so much for getting back to me so quikly… much appreciated :) Well… I've done all of that but unfortunately I get no devices in the Integration entries.

Screenshot 2024-09-11 at 20 00 52 Screenshot 2024-09-11 at 21 34 54

IMG_0197

Niek commented 2 days ago

I used this integration instead and it works fine:

https://github.com/make-all/tuya-local

It would still be nice if the official Tuya integration supports it though.

remusache commented 2 days ago

Thank you @Niek :) That worked like a charm.