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]: LocalTuya does not change fan speed #267

Closed
3 tasks
Lurker00 opened this issue Jun 8, 2024 · 6 comments
Closed
3 tasks

[Bug]: LocalTuya does not change fan speed #267

Lurker00 opened this issue Jun 8, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@Lurker00
Copy link

Lurker00 commented Jun 8, 2024

LocalTuya Version

2024.6.0

Home Assistant Version

2024.6.1

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 have a WiFi fan, with 3 speeds, integers as a list. When I change the speed, the log shows that percentage is correctly translated into the list value, but the speed does not change. You can see on screenshots that the speed control is medium or high, but the value remains 33%. If I change the speed from SmartLife, HA displays 66% or 100% as appropriate.

So, actually, HA/LocalTuya can only turn the fan off or on at the low speed.

Screenshots

Снимок экрана 2024-06-08 125310

Снимок экрана 2024-06-08 125342

Steps to reproduce.

Change fan speed from HA.

Relevant log output

2024-06-08 12:46:42.790 INFO (MainThread) [custom_components.localtuya.fan] Fan async_set_percentage from list: 66 > 2
2024-06-08 12:47:09.071 INFO (MainThread) [custom_components.localtuya.fan] Fan async_set_percentage from list: 100 > 3
2024-06-08 12:49:11.351 INFO (MainThread) [custom_components.localtuya.fan] Fan async_set_percentage from list: 66 > 2
2024-06-08 12:49:28.339 INFO (MainThread) [custom_components.localtuya.fan] Fan async_set_percentage from list: 100 > 3

Diagnostics information.

localtuya-944c1616039a1d1ec6b9745179bff74e-Iot Fan Tower T1 -db41ae908ba13db49c2a0f489757fa32.json

@Lurker00 Lurker00 added the bug Something isn't working label Jun 8, 2024
@xZetsubou
Copy link
Owner

Re-configure the device and choose the DP Value on fan step "str" instead of "int"

@Lurker00
Copy link
Author

Lurker00 commented Jun 8, 2024

It works now! Now I see, that the device_cloud_info defines fan_speed as a string:

        "3": {
          "code": "fan_speed",
          "custom_name": "",
          "dp_id": 3,
          "time": 1717689204394,
          "value": "3",
          "type": "Enum",
          "values": "{\"type\": \"enum\", \"range\": [\"1\", \"2\", \"3\"]}",
          "id": 3,
          "accessMode": "rw"
        },

but it was mistakenly interpreted as int:

          "fan_speed_ordered_list": "1,2,3",
          "fan_dps_type": "int",

@xZetsubou
Copy link
Owner

It's not about the auto configuration, I mean I don't even understand what's the point of having the user to choose the type of the DP, As far as I saw if the speed DP is defined as "ordered list" and it always "String" and if it' defined as min/max it always "Integer"

I haven't made changes for fan but I may actually force the DP to be string type if speed defined as list, 🤔

@Lurker00
Copy link
Author

Lurker00 commented Jun 8, 2024

It's not about the auto configuration

I can't say for sure that I never touched those settings. OK, it works now and it is good! Thank you!

Not related, but while I can ask you without creating a ticket...

Is it correct that _async_reconnect stops on the first met disabled device?

async def _async_reconnect(now):
"""Try connecting to devices not already connected to."""
reconnect_devices = []
for host, dev in hass_localtuya.devices.items():
dev_id = dev._device_config.id
if check_if_device_disabled(hass, entry, dev_id):
return
if not dev.connected:
asyncio.create_task(dev.async_connect())

I have some disabled devices and now I wonder if they may prevent reconnecting to other devices.

@xZetsubou
Copy link
Owner

xZetsubou commented Jun 8, 2024

It does may break the reconnect process, thank you for pointing that It should be continue instead of return.

@xZetsubou xZetsubou added the master/next-release Fixed in master branch, Will be ready in the next release label Jun 8, 2024
Copy link

This issue was closed because it was resolved on the release: 2024.7.0

@github-actions github-actions bot added stale and removed master/next-release Fixed in master branch, Will be ready in the next release stale labels Jul 11, 2024
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

2 participants