xZetsubou / hass-localtuya

🔹 A Home Assistant integration to handle Tuya devices locally "fork from localtuya"
https://xzetsubou.github.io/hass-localtuya/
GNU General Public License v3.0
287 stars 30 forks source link

[Bug]: No support for rotating knob of a scene switch #278

Open Lurker00 opened 2 weeks ago

Lurker00 commented 2 weeks ago

LocalTuya Version

2024.6.0

Home Assistant Version

2024.6.3

Environment

What happened?

The main miss is DP 12 (knob_switch_mode_1). If possible, please also add DP 11 (mode).

Thanks in advance!

Steps to reproduce.

Add a button with rotary knob

Relevant log output

No response

Diagnostics information.

localtuya-944c1616039a1d1ec6b9745179bff74e-ВС_ Чёрная кнопка-099d905c14c6bdc888d685615d2c34d8.json

xZetsubou commented 2 weeks ago

That depends of the device knob supports local functions this looks similar to this issue #218 . Could you verify that the DPS 12 and 11 is controllable with events "https://github.com/xZetsubou/hass-localtuya/issues/218#issuecomment-2094078021"

You can also try to change these DPS with Set DP Service Try this two values and see if the device will react to the changes:

DP 11

service: localtuya.set_dp
data:
  device_id: bf1b1ee083d83ee39bgibq
  dp: 11
  value: remote_control # OR "wireless_switch"

DP 12

service: localtuya.set_dp
data:
  device_id: bf1b1ee083d83ee39bgibq
  dp: 12
  value: clockwise_rotation # OR "anticlockwise_rotation"
Lurker00 commented 2 weeks ago

OK, I've read that issue. I'll do the tests having enough spare time and notify you.

Lurker00 commented 1 week ago

I confirm that both DP's work.

I've added them manually to Configuration. When the knob is in the wireless_switch mode, the rotation status in HA is updated when I rotate the knob, as appropriate. When the knob is in the remote_control, the status is not updated.

When I switch between modes by triple clicking the knob, the status of the mode in HA is updated correctly. If I change the mode from HA, the knob changes its mode on the next wake up.

I didn't try to manually call the services, as you suggested, because changing the mode via HA UI does exactly the same, and it does not have sense to change the rotation direction this way: this DP is for notifications from the device (just like similar DPs for scene switch buttons).