Tuya local

Thanks for the inf. I was able to get the local keys.

1 Like

It’s a struggle but you can get there in the end. I had to spin up a new debían vm, install npm nodejs and all the bits to get the tuya wizard to work. Well worth it though.

Hello all:
Im trying to configure a tuya compatible LED module using tuya local. for now i can control the on/off but cant control the rgb functions, im not sure if you have found a solution for this?

Not sure if you used yaml or the flow but you will need to configure all of the values and it could be a bit of trial and error.
Using either flow or yaml, try these values.

      - platform: light
        friendly_name: Device Light
        id: 4 # Usually 1 or 20
        color_mode: 21 # Optional, usually 2 or 21, default: "none"
        brightness: 22 # Optional, usually 3 or 22, default: "none"
        color_temp: 23 # Optional, usually 4 or 23, default: "none"
        color: 24 # Optional, usually 5 (RGB_HSV) or 24 (HSV), default: "none"
        brightness_lower: 29 # Optional, usually 0 or 29, default: 29
        brightness_upper: 1000 # Optional, usually 255 or 1000, default: 1000
        color_temp_min_kelvin: 2700 # Optional, default: 2700
        color_temp_max_kelvin: 6500 # Optional, default: 6500
        scene: 25 # Optional, usually 6 (RGB_HSV) or 25 (HSV), default: "none"
        music_mode: False # Optional, some use internal mic, others, phone mic. Only internal mic is supported, default: "False"

Hello,

Have you found any solution? If yes, please guide I have few of these switches and I am stuck with IDs to control correct button and control fan speed.

Thanks

Hi all
I have a single tuya switch in wc which I just added and it is working fine. I have problem with a second (2 gang) switch because I can only add 1 of the 2 gangs. Does anybody knows how I could have available both of the gangs?

image

image

edit: I found the solution from another forum member…

Thanks!

RedSnowDonkeyDean Steele

Apr 20

When you use the Local Tuya User Interface (is that a ‘wizard’?) to add the initial device (as a switch), the next window will ask you to add more entities, which is where you select the individual switches and add them in turn. That’s for WiFi switches, though - I don’t have Zigbee switches, so I don’t know if it’s different.

Hey has anyone gotten this integration to send scenes to your lights?
I have some string lights that have 9 scenes i can set them via the cli
but in hass it wont work
image
I updated the scene list in light.py but it doesnt seem to want to send the value to the light
image
They show up in hass


Any help would be appreciated

Figured it out, if you have Atomi outdoor string lights you need to set the color mode to the scene dps

3 Likes

Why was @Eeekfz’s reply hidden? I have been trying to follow Tuya’s v2 Home Assistant progress and this comment seems to provide useful information on that.

I guess because this particular thread is about Tuya Local/Local Tuya and “advertisments” to promote a different approach to Tuya on HA is unethical here besides of simply off-topic.

Tuya Official Home Assistant Integration has its own thread on the forum.

@postlund i’ve added example for covers to yaml

- host: 192.168.1.x
  device_id: xxxxx
  local_key: xxxxx
  friendly_name: Tuya Device
  protocol_version: "3.3"
  entities:
    - platform: cover
      friendly_name: Device Cover
      id: 2
      open_close_cmds: ["on_off"] # Optional, default: "on_off"
      positioning_mode: ["none"] # Optional, default: "none"
      currpos_dps: 3 # Optional, required only for "position" mode
      setpos_dps: 4  # Optional, required only for "position" mode
      span_time: 25  # Full movement time: Optional, required only for "timed" mode

and got error:
Invalid config for [localtuya]: extra keys not allowed @ data[‘localtuya’][0][‘entities’][0][‘currpos_dps’]. Got 3
extra keys not allowed @ data[‘localtuya’][0][‘entities’][0][‘open_close_cmds’]. Got [‘on_off’]
extra keys not allowed @ data[‘localtuya’][0][‘entities’][0][‘positioning_mode’]. Got [‘none’]
extra keys not allowed @ data[‘localtuya’][0][‘entities’][0][‘setpos_dps’]. Got 4
extra keys not allowed @ data[‘localtuya’][0][‘entities’][0][‘span_time’]. Got 25
value must be one of [‘binary_sensor’] for dictionary value @ data[‘localtuya’][0][‘entities’][0][‘platform’]. Got ‘cover’. (See /config/configuration.yaml, line 362).

what is correct format for yaml?

When HA is running fine the local tuya integration seems to work fine… If I however restart it I seem to lose devices:

Logger: custom_components.localtuya.common
Source: custom_components/localtuya/pytuya/init.py:637
Integration: LocalTuya integration (documentation, issues)
First occurred: 19:16:15 (113 occurrences)
Last logged: 19:26:13

[bff…qdi] Connect to 192.168.0.187 failed

Traceback (most recent call last): File “/config/custom_components/localtuya/common.py”, line 139, in _make_connection self._interface = await pytuya.connect( File “/config/custom_components/localtuya/pytuya/init.py”, line 637, in connect _, protocol = await loop.create_connection( File “/usr/local/lib/python3.9/asyncio/base_events.py”, line 1056, in create_connection raise exceptions[0] File “/usr/local/lib/python3.9/asyncio/base_events.py”, line 1041, in create_connection sock = await self._connect_sock( File “/usr/local/lib/python3.9/asyncio/base_events.py”, line 955, in _connect_sock await self.sock_connect(sock, address) File “/usr/local/lib/python3.9/asyncio/selector_events.py”, line 502, in sock_connect return await fut File “/usr/local/lib/python3.9/asyncio/selector_events.py”, line 537, in _sock_connect_cb raise OSError(err, f’Connect call failed {address}’) OSError: [Errno 113] Connect call failed (‘192.168.0.187’, 6668)

Anybody else seeing this? Why would connection fail on restart? I assuming the keys, etc, are managed by the device itself, nothing to do with HA?

Edit: I just restarted HA and all devices are back again… So obviously not a key issue.
Edit2: Although the devices are back, and I unable to control them… The report as being ‘on’ (and they are), but I cant switch them off.

You don’t have to restart the whole HA instance. Look a few posts up at #68.

@Tamsy : Fair enough, i’ll do that next time… But regardless, why does the devices not come back online (some times) when I restart HA? I dont want to have to reload the integration until they are working. :slight_smile:

I have added 4 devices in the yaml.config file as per the github instructions, however my integration shows up like this, rather than the usual way:

image

Once I drill into one of the devices it shows correctly (but obviously only 1 device):

image

Is this coming up correct? I would expect it to show “4 devices and 4 entities”…

I cant answer you that one. But out of what I have experienced with a couple of installations, all on RPI4 devices, HA Supervised installed is that the need for reloading some of the tuya devices after HA restarts is getting less after some time and eventually down to zero after a while. Kind of mystic indeed but I didn’t had to reload a single device out of all the installations I maintain for quite some time now after HA reboots. Feels like things have to settle for a while :crazy_face:

Why through configuration.yaml at all? Just use the much simpler and quite reliable config-flow method instead!

Because I couldnt work out how to add multiple devices using the Wizard. :smiley:

I managed to add one, but then the wizard closed and I couldnt add further devices… Might be me missing something.

After you have done one and have finished the configuration for it you simply start all over again:
Intergrations → Add Integration → Local Tuya Integration → …

It’s as simple as that :slightly_smiling_face:

1 Like

Ah… I was expecting to add more device in the same manner as for example the Zigbee integration, not new integrations for each device… I have redone a couple using the wizard now, and they are still displayed “inside” the integration, so I guess thats the correct way for this integration then:

image

1 Like