Tuya Integration

Hopefully, you can help. I’m running HA in a Docker container on a Synology and I’m trying to get HA to recognise 2 Medion Power Switches I have connected. The Power switches are working with the TuyaSmart app on Andriod.
As per the docs https://www.home-assistant.io/components/tuya/ I’ve added the following to configuration.yaml:

tuya:
username: [email protected]
password: MyPassword
country_code: 61

But no luck getting it working. Nothing appears in the logs indicating anything is wrong. Do I need local_key and device_id as indicated in early posts in the community forum?
Thanks in advance

1 Like

local_key isn’t required for the default integration - (tuya:)

Couple of questions

  • have you restarted since the config change?
  • you said in Docker - does HA have working IP access outside of the container? (eg other stuff works)

Hi walaj, Yes I have restarted since addingconfig, I’ve also added “platform: tuya” to configuration yaml, still no luck. Yes HA has working Internal IP address, and yes a heap of other stuff works fine.

Didn’t think it would be that simple, but sometimes you never know.

I’m going to assume you have the spacing in the config file correct?

beyond that, I’m stumped (works for me fwiw)

Are your sensors Medion (Aldi brand) ?
Thanks for your help.

I recently setup tuya for a single gosund plug. I noticed country_code you have as a number. I have mine setup as the two letter country code (country_code: US in my case.) I have a feeling it’s not that simple, but worth a shot. I also have “platform: smart_life” that might be something to look into also. Not sure if there’s a tuya_smart platform.

TuyaSmart is the default app - whilst you need to add the platform: clause for other rebadged tuya apps, not for the tuyaSmart app.

My working config:

tuya:
  username: !secret mobilenumber
  password: !secret tuyapasword
  country_code: 61

Ok thanks - just to confirm you are using Medion Power Switches? and HA auto-discovered them (i.e. no manual setup of sensor entities)

Unfortunately, I’m not - I’m running a bunch of Chinese lights switches that I installed. However, they were all auto-discovered with no additional action on my part.

but that raises an interesting point - are the devices supported by the tuya integration - I know the WIFI motion sensors that they make are not.

I just got the smart socket and start with tuya for home assistant. Works just fine. Once config complete check your config and restart your Ha. This will be automatically discover devices that link to your account.

The device found 1 of my device as switch.40086100dc4f22e5d6a4
This is quite hard to find but it will be in your entity_id.
If you think that it didn’t discover all of your devices from tuya. Then go service and do the tuya.pull_devices

tuya:
  username: !secret tuya_user
  password: !secret tuya_passwd  
  country_code: 66
  platform: smart_life  <== put in here the app you use to pull the devices in that app

platform (string)(Optional)The app where your account register.  `tuya`  for Tuya Smart,  `smart_life`  for Smart Life,  `jinvoo_smart`  for Jinvoo Smart.
Default value: tuya

I successfully added my two Jinvoo Wifi “smart” sockets yesterday. Indeed it is hard to identify the new switches by their cryptic names. Initially I searched for “tuya” in the entities list and thought the component did not load properly.

Finally a working integration for this kind of device without the need to flash an alternative firmware.

Hi,
I am new to HA. my entry in configuration.yaml is

Blockquote
tuya:
username: phober
password: password
country_code: 47
platform: smart_life

Blockquote
after restarting HA, i can see tuya pull and update service in Developer tool “dev-service”. but i dont know what to do next.
I am able to connect smart plug with smartlife app as expected, but dont know end to end steps to control through HA.

please guide. Thanks in advance.
Amit

When you add tuya component to home assistant. The switch.xxxxxxxxxxx will be automatically create by ha. You can check the name of the switch from developer tools> states> search for new switch which the name will be a little long and wierd.
Then make it as a group if you have many tuya devices. make the group just created to show in frontend so you can turn on-off devices.

Here is example.

### Connect to Smart Life Acc ##
tuya:
  username: !secret tuya_user
  password: !secret tuya_passwd  
  country_code: 66
  platform: smart_life

## Group ##
group:
  bedroom_1_appliances:
    name: Bedroom 1 Appliances
    entities:
      - switch.40086100dc4f22e5d6a4
2 Likes

Hi,
Thanks for quick reply, but I cannot see/find anything related to switch id. there is only 3 entry “persistent_notification.notification” , sun and yr.

anything i can check in logs and other things to validate the configuration.

Thanks

make sure you have the spacing as Sunonline has shown. Yaml can be unforgiving.

Then check your home-assistant.log (or equivalent) log file to make sure there are no errors related to config generally, or TUYA specifically.

Tuya devices *if supported by the hass integration should show up automagically when you restart hass.

Alternatively, you can call the tuya.pull_devices service from the services developer tool

Blockquote

panel_iframe:
configurator:
title: Configurator
icon: mdi:wrench
url: http://192.168.xx.xx:3218

Connect to Smart Life Acc

tuya:
username: [email protected]
password: xxxx
country_code: 47
platform: smart_life

Blockquote
above is the sample of my configuration.yaml file. I had checked in home-assistant.log… no error found.
I tried tuya.pull_devices also… even after that, no entity is visible in developer tools > state

please share sample of all steps that is required to add tuya (smart life) device added and checked

For me, the smart_life platform didn’t work, after connecting my lamp to the tuya app and switching/removing the platform, it works.

I tried same now… I am trying with Tuya app, but problem is same. I think something is missing not sure what.

tuya:
username: [email protected]
password: XXXX
country_code: 47

check config is good
restarted HA
tried pull_device in developer tool > services
no error in home-assistant.log

still no device visible in Developer tools > state >

what is missing or incorrect ?

For information it is wifi plug and being managed through smartlife app