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
70.92k stars 29.58k forks source link

Tuya WiFi presence sensor not fully supported #104625

Open rbreahna opened 9 months ago

rbreahna commented 9 months ago

The problem

The tuya ZY-M201-WIFI24G sensor is only partially supported with just a few entities unlike the ZigBee version whe using the tuya cloud Integration. There is only a binary sensor that doesn't do the job and many config options as well as entities are missing compared to the ZigBee version.

What version of Home Assistant Core has the issue?

core-2023.11.3

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

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

Screenshot_20231128_011849_Home Assistant

No response

home-assistant[bot] commented 9 months 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)

issue-triage-workflows[bot] commented 6 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

rafaeljustinox commented 6 months ago

HI @frenck. I'm also facing same problems.

@zlinoliver @frenck Just adding some details here that can help the team to solve this problem.

First of all, device is a ZY-M100 24G Wi-Fi. On Home Assistant Tuya integration, it appears as WIFI24G Presence Sensor (n3bow00a2vpwgtvx)

I've downloaded the diagnostics when sensor was in different states. Basically, status_range is the same. Here you can notice that device has 5 features.

...
"status_range": {
  "presence_state": {
    "type": "Enum",
    "value": {
      "range": [
        "none",
        "presence"
      ]
    }
  },
  "sensitivity": {
    "type": "Integer",
    "value": {
      "unit": "",
      "min": 1,
      "max": 10,
      "scale": 0,
      "step": 1
    }
  },
  "far_detection": {
    "type": "Integer",
    "value": {
      "unit": "M",
      "min": 150,
      "max": 550,
      "scale": 2,
      "step": 100
    }
  },
  "target_dis_closest": {
    "type": "Integer",
    "value": {
      "unit": "M",
      "min": 0,
      "max": 1000,
      "scale": 2,
      "step": 1
    }
  },
  "illuminance_value": {
    "type": "Integer",
    "value": {
      "unit": "LUX",
      "min": 0,
      "max": 20000,
      "scale": 0,
      "step": 1
    }
  }
}
...

Nobody state

image

"status": {
    "presence_state": "none",
    "sensitivity": 6,
    "far_detection": 150,
    "target_dis_closest": 0,
    "illuminance_value": 565
}

Micro move state

image

"status": {
    "presence_state": "presence",
    "sensitivity": 6,
    "far_detection": 150,
    "target_dis_closest": 150,
    "illuminance_value": 665
}

Presence state

And finally, the most desired state, when presence is detected: image

"status": {
    "presence_state": "move",
    "sensitivity": 6,
    "far_detection": 150,
    "target_dis_closest": 150,
    "illuminance_value": 857
}

Summary

In my opinion, the problem is that the statuses are being mapped incorrectly. Instead of move, it emits presence. Instead of presence, it emits move.

It would be great if we could also have access to the 3 types of status: none, move and presence.

It would also be great if we could have an entity for the illuminance sensor.

dentex commented 3 months ago

I was wondering if any issue was already opened, since I had the same thought: I couldn't see the light sensor entity and the target distance entity. This thing it's fairly basic with just the movement detection :) immagine Thanks for any update.

pvrobays commented 2 months ago

Bump. I'm using the ZY-M100 wifi 24g. I get the same sensor (motion) and configurations (far/near detection + sensitivity) as @dentex. The two main sensors I'm missing is:

FYI, I also use the zigbee variant which does have these sensors available in HA.

@Tuya @zlinoliver @frenck, can you give us any update whether or not this is in the pipeline to implement? I'm glad to help where I possibly can.

lodytrepels commented 1 month ago

I'm also using the ZY-M100 wifi 24g. And I'm also interested in the missing sensors in Home Assistant:

The Zigbee-variant does have these informatie availaible in HA, but I want to switch to the WIFI-version.

@tuya @zlinoliver @frenck: can you tell me of there is a update coming or that this isn't in the pipeline to implement.

DreadorUK commented 3 weeks ago

There is a work around for now if you have to wifi version if you need it for simple movement activation automations

Use Virtual Switch in Home Assistant to trigger automations

Whilst there is no way to pass Lux values in Smart Life you could use Lux Automation to turn on and off an extra virtual switch to trigger light checks for HA automations

lodytrepels commented 3 weeks ago

Thank you for this workaround.

Unfortunately, that does not solve the problem with the missing lux value. It is also important for me to be able to use it.

So I'm hoping for an update that will make these values ​​available as well. Otherwise I have to switch to the Zigbee version of the sensor.

DreadorUK commented 3 weeks ago

I created another virtual switch which I used an automation in app to switch on if 20 was below x and turned off if above 20 then in home assistant I just prior to turning on lights with motion checked if it was dark enough if virtual switch was on.

If you wanted a range you could get funky and have a switch for 50 lux or under a switch for between 50 and 100 etc

Works for my needs anyhow

lodytrepels commented 1 week ago

Thank you for the tip. That is indeed a great way to come up with a temporary alternative. Hopefully there will also be full integration of the WiFi version.