I just confirmed that all 6 fans are on the most recent/same firmware and tried installation again. Same results.
more long shots … there was a recent update to Local Tuya that broke some of my fans … and I had to re-install … did you do the update?
I think that’s the update that caused a few of my fans to break, I reconfigured them and copied them down and I thought they were working for a few days (despite me noticing the difference in the setup) and then realized some days later that the setups were behaving differently.
So I am on the most recent local tuya. Today, trying to fool with it and clicking too much I clicked ‘restore defaults’ in the API Explorer which I idiotically thought would be basic settings. No, wiped them out of Tuya completely; no worries, I readded them, they now have a new ID and local key but I still get the same results on both of these and none of the others.
I just got it to work accidentally on purpose?
I had another local tuya control issue with some light scenes. Long story short, through that exercise, I got deep enough into the local tuya code to be dangerous and I provided a silly workaround which I am prefacing by saying is not the correct approach but is working without adverse effects.
Remembering back how Local Tuya kept detecting two fans as fans and the rest as DPS 1 Entities. The DPS 1 Entities all worked, the imported fans all failed full control. I could not figure out why two fans are recognized differently, nor do I know how to make them be recognized differently. But what I did was change copy the requirements to match the requirements of the fans that were working.
I know the first time local tuya pushes an update, this will be borked, but if I get full local control of all my fans again, I don’t care and I will keep overwriting the code. I’m putting this here because apparently a bunch of us have tuya fans and they’re all different and they all behave differently (even if bought in the same batch) and maybe this will help somebody coming behind me.
Wowza - I have no idea what is going on here … but am happy you managed to find a temporary fix !
May I suggest a more permanent solution?
Since you have all your device details, why not use this ? Then in the Tuya app, select the options you have one at a time, run the above test.py script again after each one and take note of the DPS and it’s value. Do this for however many speed settings you have.
From here you just call service: localtuya.set_dp with the value you want to send. Done.
I have done something similar here, there’s some code there which may help you.
The initial setup probably took the longest. Going forward, this script will come in super handy on future devices.
All the best
I’ve been putting this off for weeks because I’ve invested so much time in the two remaining fans that use the same device because the integration recognizes them differently. Today, I sat down and just tried every single setting and I got it to work. I replicated it to the other fan and now all the fans work the same. I have removed the Smartlife integration from Alexa which was temporarily doing the lifting on the last 2 fans. I still don’t understand why these are different when they are all the same device; I’m just glad I finally hit the magical combination of settings to make all of them work the same.
Here were the ones that I had no trouble with:
Here are the ones that I had lots of trouble with because the settings aren’t the same/intuitive:
I really just hope this helps somebody in the future because this has been a 2 month journey for me.
thx @Sergeantpup and all
I am also spending hours to figure this out with no success
I have gotten the light and switch to both work but no matter what I tried I cannot get the fan speed to work with Home assistant
This is my current simplified configuration.yaml section anther non of the options worked for me
localtuya:
- host: 192.168.0.194
device_id: XX
local_key: YYY
friendly_name: Office fanlight
protocol_version: "3.3"
entities:
- platform: light
friendly_name: Light
id: 15
- platform: switch
friendly_name: switch
id: 1
- platform: fan
friendly_name: Fan
id: 3
fan_speed_control: 3
I have tried using fan_speed_control
, fan_ordered_list
, fan_speed_min/max
etc with no success
I have also tried via the flow config and enabling Fan speed modes list
nothing seems to work and I always only get an entity with a switch which always beings back the fan speed to 1
no matter what
any help would be super appreciated !
Z
I think you’ve got your numbers mixed up and that would stand to reason the weird behavior
a 3 speed fan with just a basic on/off light:
Fan: DPS 1
Fan speed control: DPS 3
Fan speed mode list: (user choice)
Minimum fan speed: 1
Maximum fan speed: 3
Light: DPS 9
For a 10 speed fan with warm/cool light
Fan: DPS 1
Fan speed control: DPS 3
Fan speed mode list: User choice
Fan Direction: DPS 103
Miniumum fan speed: 1
Maximum fan speed: 10
Light warm: DPS 9
Brightness: 10
Minumum brightness: 1
Maximum brightness: 1000 (yes that’s one thousand)
Light cool: DPS 101
Brightness: 102
Minumum brightness: 1
Maximum brightness: 1000 (yes that’s one thousand)
thx so much @Sergeantpup , im a complete neewb and can’t really code so really appreciate your help though I must say im still very confused
I tried both the control flow and YAML approaches today (wasted the whole day on this ) but still dont fully understand
I have a 6 speed Tuya fan (with wifi Tuya and an RF remote). i managed to get the switch and light to work but as I said the fan is complete broken/dosent work here.
I have in the developer API page got all the data ie
{
"result": {
"category": "fs",
"functions": [
{
"code": "switch",
"dp_id": 1,
"type": "Boolean",
"values": "{}"
},
{
"code": "mode",
"dp_id": 2,
"type": "Enum",
"values": "{\"range\":[\"normal\",\"sleep\",\"nature\"]}"
},
{
"code": "fan_speed",
"dp_id": 3,
"type": "Enum",
"values": "{\"range\":[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]}"
},
so not sure when you say DPS 1 for fan yet DPS3 for speed. in the Gui i think DPS1 is taken by the switch , or am I horribly confusing things?
in the yaml I tried as you suggested to add the min/Mac speeds but all I get is a toggle that only sends the fan to 1
entities:
- platform: light
friendly_name: Light
id: 15
- platform: switch
friendly_name: switch
id: 1
- platform: fan
friendly_name: Fan
id: 3
fan_speed_min: 1
fan_speed_max: 6
really appreciate your help!
best
Z
Now that I know you’re using the GUI, I can help you better.
For a 3 speed fan, regular light on/off switch
For the newer, more advanced fans (that probably include your 6 speed fan)
Let’s start here and see how far that gets you. I don’t mind helping, I’ve only been on HA since Jan but I’ve learned enough like everyone else to know that TUYA stuff can be tricky. All my TUYA stuff is rock solid now.
thx so much again @Sergeantpup !
ok I tried following you screenshots 1:1 but still dont think it works (ie the fan component) in the integration is again only a toggle that reverts to 1
.
here are the screens
and here is the results
thx again
Z
thx!
yeah I click through but every click on the speed bar reverts the fan to speed 1
for some bizarre reason…
any guess what im doing wrong?
Z
as long as you’ve confirmed that the 3 in this screenshot is the current speed setting of the fan (that’s how you validate DPS 3 is the fan speed), then yes this all looks right. I’ve now triple compared it to mine and can’t see anything you’ve done wrong.
One thing to note, if you’ve been swapping out the settings left and right on the fan in HA and pressing buttons, sometimes the fan can get confused and not work properly until you sever the power and restore it (even if you’ve subsequently added the correct settings). I noticed this when I went down the list of settings one by one. Some seemed to temporarily cause confusion with the device until it rebooted and I pushed fresh commands. I really think you’ve got the correct config here.
thx again!
this is all trippy so when I use the actual toggle
to turn on and off the fan then it goes from stop
and then back to 3
I guess I can live with that…
But does the slider work for you to go through all fan levels (or did I misunderstand that)? for me any movement of the slider brings the fan back to the 1
speed. and then any further sliding does nothing (doesn’t stop or go back to 3
)
sorry again for all the noise, really appreciate your help @Sergeantpup
Z
I can use the slider and get either 3 settings or 10 based on the fan.
ha yeah that dosent work here. ok thx again ill try and see if the localtuya folks can help on github
thx again
Z
Hi @Sergeantpup and all
sorry to nudge again but after almost a month with my tuya fan im kinda frustrated and bummed out I actually bought the fan (it took me tons of time to install on the ceiling so dont think im sending it back…haha )
anyway I posted 3 weeks ago in the localtuya GitHub but got zero responses there…
so far all I managed to get is a fan on/off and light on/off in Home assistant …
I can’t change the speed at all and even more annoying is that I cant change the light level…
im at desperation point so would really love to get any ideas from the community on what else is left to try…
thx alot in advance
Z
I seem to be having a similar issue to you @zeltak. If I add it the way you have inside the fan entity and use the slider, it just defaults to a value and sets the fan to off. I’ve noticed the value it changes to is the last value set by the remote.
If I use the remote the slider happily changes to match the value from the remote but as soon as I manually make a change to it it bugs out.
The only workaround I have found is to add the fan speed value as a separate entity using ‘number’. Slider works fine there.