Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Wrong interpretaion of presence sensor #326

Closed
2 of 3 tasks
salos1982 opened this issue Aug 9, 2024 · 11 comments
Closed
2 of 3 tasks

[Bug]: Wrong interpretaion of presence sensor #326

salos1982 opened this issue Aug 9, 2024 · 11 comments
Labels
bug Something isn't working

Comments

@salos1982
Copy link

LocalTuya Version

2024.7.0

Home Assistant Version

2024.7.4

Environment

  • Does the device work using the Home Assistant Tuya Cloud component?
  • Is this device connected to another local integration, including Home Assistant and any other tools?
  • The devices are within the same HA subnet, and they get discovered automatically when I add them

What happened?

I use a presence sensor ZY-M100-WIFI24G. The sensor shows presence only when the micro move is detected.
You can watch the video with the Home Assistant application and Tuya application on the same screen
https://drive.google.com/file/d/1NzC4G3YGyktqP3NcMDckImimDDKviItm/view?usp=sharing

Steps to reproduce.

Enter the room with presence sensor - tuya app detects movement but local Tuya does not
Stay still for about 5 seconds - Tuya app detects micro-movements and local Tuya detects the presence
Go out of the room and wait about 10 seconds - Tuya app detects nobody and local Tuya detects nobody.

Relevant log output

No response

Diagnostics information.

No response

@salos1982 salos1982 added the bug Something isn't working label Aug 9, 2024
@salos1982 salos1982 changed the title [Bug]: Wronfg interpretaion os presence sensor [Bug]: Wronfg interpretaion of presence sensor Aug 9, 2024
@salos1982 salos1982 changed the title [Bug]: Wronfg interpretaion of presence sensor [Bug]: Wrong interpretaion of presence sensor Aug 9, 2024
@salos1982
Copy link
Author

I had a look into the code and found that for presence detected value "presence" but in my case it is not binary sensor it is enum I can see this in cloud description

"1": {
          "code": "presence_state",
          "custom_name": "",
          "dp_id": 1,
          "time": 1723354592547,
          "type": "enum",
          "value": "none",
          "id": 1,
          "accessMode": "ro",
          "values": "{\"type\": \"enum\", \"range\": [\"none\", \"presence\", \"move\"]}"
        },

correct values are ["none", "presence", "move"]"
This means that the presence sensor is on if the value is not equal to "none".
In the code, the presence sensor is on if the value is equal to "presence"

@xZetsubou
Copy link
Owner

Can you post the device diagnostics

@Theo16
Copy link

Theo16 commented Aug 18, 2024

I have the same sensor and it has been working perfectly for over a year. Here is my template file.
sensor_presence.txt

@xZetsubou
Copy link
Owner

Homeassistant binary sensor can only have false or true values if you want "the state type" you may need to use "Sensor" but this not ideal for HA or the Device as it will reports the value of the DP e.g. none, presence and move.

So you may need to go to Devices -> Localtuya -> Reconfigure existing device -> Choose the device
On the DP 1 configuration insert presence as the "On value"

Or use @Theo16 template if the devices are the same

@salos1982
Copy link
Author

salos1982 commented Aug 19, 2024

@salos1982
Copy link
Author

I have the same sensor and it has been working perfectly for over a year. Here is my template file. sensor_presence.txt

I do not understand what you sent me. It is part of a config but I do not know when to put it

@salos1982
Copy link
Author

@Theo16 It seems we have different devices: your device has the entity "Detection delay" with id 101 and I have the same entity with an id 102. There are couple of other differences in devices

@xZetsubou
Copy link
Owner

@salos1982 What are you trying to reach here? do you want the device detect the movement ? if yes then do the steps here #326 (comment)

@salos1982
Copy link
Author

I do not understand what I should do. I click reconfigure existing device and got
image
Click apply
got
image
It seems everything is as you described.
Then click apply multiple times and got success message
But I still have the same issues. Sensor detected only static presence not movement

@Theo16
Copy link

Theo16 commented Aug 21, 2024

@salos1982 try to config id 104 as binary sensor and set on value as "exist" and check if this sensor change value in the same time as in Tuya app.

@salos1982
Copy link
Author

After all modification and restart the

@salos1982 try to config id 104 as binary sensor and set on value as "exist" and check if this sensor change value in the same time as in Tuya app.

Thanks, that helps me. I've added new sensor and it works correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants