Tuya local

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

Yup, that’s the correct way :+1:t3:

2 Likes

I have configured my devices via the Integration Wizard in HA.
Unfortunately, part of my local tuya devices configuration has become defective/lost.
Since I have an older backup of my installation, I would like to retrieve the information from there.
Can you tell me where and in which file local tuya saves the configuration?

Be aware there seems to have been an outage last night with Tuya. This morning (Europe time) I rebooted my core module and all lights came back again.

Unfortunately, I was too impatient and thought it was a problem in my installation and deleted the entries marked as incorrect. Now I’m trying to restore them using my old backup so that I don’t have to laboriously find out all the keys and settings again. Therefore, it would be great if someone knows where local tuya saves this information.