Tuya Component Problems

I will warn you though - I have found it very unreliable and slow especially for my light bulb. The issue is you are forced to use their servers which is the problem. It seems like there used to be a way to control them locally but if I remember correctly that project is kind of dead now.

If you know what you are doing you may be able to reflash it with tasmota or similar - but unless you are confident in what you are doing I wouldn’t recommend this.

Hi Gary,

writing code in configuration.yaml, now Tuya Component is OK…

Thank you!

Hi all,
I’m running the most up2date version of HA 0.94.3.
I have added the tuya config in my configuration.yaml and get the following error:
has anyone an idea what this could be ?

[configuration.yaml:]

tuya:
  username: "[email protected]"
  password: "mypassword"
  country_code: "31"
  platform: "smart_life"

[ERROR LOG]

Error during setup of component tuya
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 156, in _async_setup_component
    component.setup, hass, processed_config)  # type: ignore
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/tuya/__init__.py", line 58, in setup
    tuya.init(username, password, country_code, platform)
  File "/usr/local/lib/python3.7/site-packages/tuyapy/tuyaapi.py", line 44, in init
    self.get_access_token()
  File "/usr/local/lib/python3.7/site-packages/tuyapy/tuyaapi.py", line 68, in get_access_token
    raise TuyaAPIException(message)
tuyapy.tuyaapi.TuyaAPIException: Get accesstoken failed. Username or password error!

Remove the doublequotes (") around username, password, country_code and platform, should work

Done so, but without luck…

tuya:
  username: [email protected]
  password: mypassword
  country_code: 31
  platform: smart_life
1 Like

and is the error message the same as before? IT appears so far that your credentials aren’t accepted.
Also you’ve added smart_life as a platform. Are you 100% this is the platform that you need?
I can’t see what else to try.

Yes, life_smart is the app platform needed for my Aiconditioner

checking the log.

Looks like same error

Got reply from tuya support… No supported device…
Huh? Not taking this answer. Hence the problem seems to be related to authentication…

Received this to inquire this bug…
https://iot.tuya.com/index

Let see if my luck is getting me anywhere

You can literally just start again using the Tuya Smart app. It’s essentially a rebranded version of smart life except it just works better. Give it a try. The only reason manufacturers use the Smart Life app is because they want it to look like there own generic app. They dont want consumers to know that they are just using some cheaply licensed smart tech / software. Give Tuya a try.

Works like a charm ! thanks Phil!

1 Like

Glad to be of help. I read elsewhere about using Tuya and I was damned if I was going to switch. I spent ages trying to get Smart Life app to work but ultimately failed. I spent 10-15 mins switching everything over to Tuya and it all worked straight away.

I really just hope I can save people a lot of time and despair.

This topic has saved me a lot of troubleshooting. Thank you @Phill_Healey

platform: smart_life just doesn’t work. No matter how I configure it. It always reports auth issues in the HA logs. I have an account and I am able to control the switches with the Nedis app.

Switching from Nedis to Tuya worked better, but I’m unable to get correct status of the device I’m using (WIFIP310FWT). The four switches status is always off no matter what I do. I can however control the switches by using switch.turn_on and switch.turn_off. This will correctly switch the selected entity on or off. But the status does not change in HA.
switch.toggle on the other hand does nothing.


Anyone else experiencing this or have any clue what I can do to fix the issue?

I’m on the latest HA 0.97.2.

@mindtripper, you seem to be having the same issue as a handful of other people, myself included, and it’s starting to look like maybe it’s a Tuya API issue. The issue was reported here and here if you want to comment and help get the issue noticed.

2 Likes

@mindtripper there is always going to be a delay between the action (eg turn on / off) and the status being reflected in HA due to the chain of events that needs to take place. However, I have noticed at times this can be a bit too long and looks like the status change isnt coming. I’ve noticed that if I do an action (eg switch on or off) then wait auntil the status is reflected in HA, after this initial action things get much quicker. However, repeating the action just causs lots of data to be transmitted and this can send things out of sync very quickly to the point that it never recovers. Give this a try and wait for the first status update, it might solve your issues.

However, I’ve also noticed that certain errors with other platforms will cause Tuya in particular to not work properly. Check your log files to see if there are any repeated error across multiple system reboots. If there are, try temporarily removing this component/platform and see if that improves your tuya responses.

I cannot get this working at all. I have the TuyaSmart app on phone and all my devices are in it.
I set my configuration.yaml as your example with my details filled in but nothing sems to work. I have tried no quote, doiuble quote and single quotes. I have tried phone number, country code of china (86) and also my “correct” one of 353 (Ireland). It constantly gives me username/password icorrect error

this is my working conf

tuya:
  username: !secret tuya_user
  password: !secret tuya_password
  country_code: 971
  platform: tuya

i dont use any quotes

forgive my ignorance, what is the !secret bit ?

it’s just mapping my sensitive information to the secrets.yaml file. Think of it as a link

Success at last. your config (juan11perez) worked.
thanks