rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
2.76k stars 536 forks source link

Multi HA instance limitation #349

Open tblomega opened 3 years ago

tblomega commented 3 years ago

So I am new to HA in general so I got the 'lay of the land' on a raspberry pi (RPi 3, not that it matters).

Having got all my smart home stuff working as desire I decided to setup HA 'For Real' as a VM in the same ProxMox box that hosts my router (OPNSense), Ubiquity Controller, Adguard Home, apache reverse proxy and SSL signer.

There was some unexpected issues(I believe Git was having issues last night), but this morning most everything was able to be setup fine.

Enter Localtuya and my 6 Merkury RGBW bulbs. They could be controlled no problem from the still running HA instance on my RPi3 but would not show up no matter what I tried on the new prox VM simply saying 'unavailable'.

After finding a firewall tick-box checked on the VM's NIC I thought that was the issue but it changed nothing (all other prox firewalls were disabled as expected (That's OPNSense's job, and only for external)).

Finally I shut down the RPi3 and suddenly the Prox VM could see and use the LocalTuya Merkury bulbs.

The unexpected nail-in-the-coffin confirming this idea (having restarted the RPi3 and it couldn't control the bulbs now that the VM was ), was when I restarted the HA server on the VM for a unrelated reason and the RPi3 immediately took over control meaning that when the VM came back on line it could not regain control of them.

The localTuya config is in it's own file that is localtuya: !include localtuya.yaml so on the RPi3 I have now commented out that line and deleted the instances/entities under integrations, preventing the issue.

But why can only one instance of HA see/control the bulbs and any other instances just list them as 'Unavailable' and is there any way to fix this.

(I intend to keep the RPi going as a test bed platform so if I screw something up, I don't have to care)

timmillwood commented 3 years ago

I have a similar issue. I currently use hassOS on a Raspberry Pi, but switching to Docker in LXC container in Proxmox. I setup the HA instance on proxmox, copied the config directory over from hassOS, it got all the integrations, but the localtuya integration doesn't work. I removed it and now it can't discover the tuya devices.

postlund commented 3 years ago

Tuya devices generally only accept one connection at the time and once someone is connected, they stop broadcasting their presence (no one can connect anyway). So this is a limitation in the Tuya devices that we cannot do anything about.