iRayanKhan / homebridge-tuya

A Homebridge plugin to control Tuya devices locally.
MIT License
380 stars 160 forks source link

Can only control low speed of fan using plugin #425

Open psycoticninja opened 8 months ago

psycoticninja commented 8 months ago

Checklist

Describe the bug

When controlling fan via Home app, I can only control the low speed. Trying to change to medium/high speeds will turn off the fan.

In the Homebridge logs, I see the following (which is mentioned in the Common Issues Wiki BUT using homebridge-tuya-web plugin I cannot discover the device).

[Tuya] Sending Lounge Room Fan {"1":false}
[Tuya] Sending Lounge Room Fan {"1":false}
[Tuya] Heard back from Lounge Room Fan with command 8
[Tuya] Heard back from Lounge Room Fan with command 8
[Tuya] Sending Lounge Room Fan {"1":false}
[Tuya] Heard back from Lounge Room Fan with command 8
[Tuya] Sending Lounge Room Fan {"3":"1"}
[Tuya] Sending Lounge Room Fan {"1":true}
[Tuya] Sending Lounge Room Fan {"3":"1"}
[Tuya] Heard back from Lounge Room Fan with command 8
[Tuya] Sending Lounge Room Fan {"3":"1"}
[Tuya] Sending Lounge Room Fan {"3":"2"}
[Tuya] Sending Lounge Room Fan {"3":"2"}
[Tuya] Sending Lounge Room Fan {"3":"2"}
[Tuya] Sending Lounge Room Fan {"3":"3"}
[Tuya] Sending Lounge Room Fan {"3":"3"}
[Tuya] Sending Lounge Room Fan {"3":"1"}
[Tuya] Sending Lounge Room Fan {"1":false}
[Tuya] Sending Lounge Room Fan {"1":false}
[Tuya] Heard back from Lounge Room Fan with command 8
[Tuya] Sending Lounge Room Fan {"1":false}
[Tuya] Heard back from Lounge Room Fan with command 8
[Tuya] Sending Lounge Room Fan {"3":"1"}
[Tuya] Sending Lounge Room Fan {"1":true}
[Tuya] Heard back from Lounge Room Fan with command 8
[Tuya] Heard back from Lounge Room Fan with command 8

The device in question is Arlec 40cm Smart Pedestal Fan With Remote.

From the Tuya IoT platform site for the fan I can control the speeds 1-3 and this works.

To Reproduce

Steps to reproduce the behavior:

Control fan via Home app, speeds 2 and 3 (medium/high) turn off the fan.

Expected behavior

A clear and concise description of what you expected to happen.

When set to 50%, change to medium speed. When set to 100%, change to high speed.

Screenshots

Environment (please complete the following information):

Additional context Add any other context about the problem here.

Controlling the fan via Tuya IoT Platform (standard instructions):

fan_speed_percent   
Integer 
{
  "unit": "",
  "min": 1,
  "max": 3,
  "scale": 0,
  "step": 1
}

Plugin configuration snippet

   "devices": [
        {
            "name": "Lounge Room Fan",
            "type": "Fan",
            "manufacturer": "Arlec",
            "model": "40cm Smart Pedestal Fan With Remote",
            "id": "XXX",
            "key": "XXX",
            "dpActive": "1",
            "dpRotationSpeed": "3"
        }

Is this a issue with the API or potentially a plugin misconfiguration? It is strange that this works via Tuya IoT platform but not the plugin itself.

05TEVE commented 5 months ago

Hi @psycoticninja, I have pushed a new beta (3.1.0-beta.2). I have made a few changes to the fan controller logic. Can you give it a try on that version and see if that fixes the issue?

psycoticninja commented 5 months ago

Hi @05TEVE, I’ve just updated to the beta plugin and tested this but it looks like I am still seeing the same issue.

05TEVE commented 5 months ago

Is it possible to provide the Tuya Device Specifications here? You should be able to find this in JSON format from the Tuya API. Device Controls -> Query Properties.

I am guessing that the DP id specified for the speed controls may not be right.

psycoticninja commented 5 months ago

Updated just in case of any unnecessary IDs potentially exposed.

{
  "result": {
    "properties": [
      {
        "code": "switch",
        "custom_name": "",
        "dp_id": 1,
        "time": 1705320408162,
        "value": false
      },
      {
        "code": "mode",
        "custom_name": "",
        "dp_id": 2,
        "time": 1705291321204,
        "value": "Normal"
      },
      {
        "code": "fan_speed",
        "custom_name": "",
        "dp_id": 3,
        "time": 1705319971441,
        "value": 1
      },
      {
        "code": "switch_horizontal",
        "custom_name": "",
        "dp_id": 5,
        "time": 1705291321430,
        "value": false
      },
      {
        "code": "light",
        "custom_name": "",
        "dp_id": 15,
        "time": 1705320383119,
        "value": true
      },
      {
        "code": "countdown_set",
        "custom_name": "",
        "dp_id": 22,
        "time": 1705291321632,
        "value": "cancel"
      },
      {
        "code": "countdown_left",
        "custom_name": "",
        "dp_id": 23,
        "time": 1705291321728,
        "value": 0
      }
    ]
  },
  "success": true,
  "t": 1705359944732,
  "tid": "XXXXXXXXXXXXXXXXXXXX"
}
psycoticninja commented 3 months ago

Hi @05TEVE did you ever get a chance to look at this further?

I ended up installing the latest plugin v3.1,0, the issue is still present.

I have Max Speed set to 3 and Default Speed to 2.

Any ideas?

jlg89 commented 1 month ago

If you use tuya-cli to pull the switch parameters, does that match the queried properties?