Can you share the hardware on your lan? Ubiquiti hardware? UDM Pro? Are using a UDP broadcast utility? Your previous message indicated that your vLAN did not block WAN access (which if I understood you correctly means your devices still are accessing Tuya servers).
This is what I have been trying to implement for some time, so thanks.
I’ve got a UDM-Pro, US-16-XG, USW-24, a pair of AP-Lite’s and an AP-LR.
I did install a multicast relay on the UDM-Pro to attempt to allow the broadcast info through but couldn’t get it working.
I do allow my IoT VLAN full access to the internet. If somebody from China wants to see that I can turn on my lights, then so be it. If I were to have something more sensitive on there, then I may be more concerned about blocking access to the net. Although for that I also have a NoT network where it is blocked so I could just move the sensitive device onto there. But the IoT VLAN has no access to data or anything on other networks with the exception of the hole punched through to let them talk to HA.
The devices uses broadcast, not multicast, that’s why it doesn’t work. I think the easiest way to work around this is to write a script that listens to these broadcasts and just forwards them to another IP (unicast). Then run it on a node on the same network as the tuya devices and point it towards home assistant.
This is the one I was trying to get working which should do broadcast and multicast. I can get it loaded and running on the UDM-P, which is very simple to do. But by default it only relays broadcast packets on port 6969.
It should be configurable to relay 6666 and 6667 as well, but waiting on clarification on how to do actually configure that.
Is it normal that when I reboot home assistant, sometimes the tuya switches via localtuya will become unavailable? I have reboot home assistant a few times to get the switches back.
I have a TUYA - 4 Gang Switch & 1 Gang Fan. Essentially this connect power 4 switch point + 1 FAN. I have used local tuya and able to integrate. The part I am struggling is to control FAN Speed. I can turn on/off all 5 of them. The FAN has a speed from 1 to 24.
My DPS Setting
Switches - 1 to 4
FAN - 5
Fan Speed - 105
I have even changed the FAN.PY config to reflect “0”…“24” and mapped them. But no luck
a. DO we need to add specific entries in configuration.yaml? If yes any guidance/sample config.
b. There is a service.yaml in local tuya for changing DPS setting. Any idea what this can be used for
@Tamsy
this is the model I have. the DPS setting.As you can see id:3 is also a light siwthc. I can turn on and off all swithces. Unfortunately cannot control fan regulator. The fan speed is 1 to 24 as against 3 speed.
What do you mean by OTA. For local tuya you need to do several things before you could actually set it up. But for tuya device that is not supported will be very difficult to install
Have localtuya up and running and all my 9 lights working in HA. After this I used iptables on my DNS server to drop all requests coming from the lights and blocked these IPs from accessing the internet.
Now, in the Smart Life app on my phone, 7 out of 9 lights have went offline. I actually expected all lights to go offline in the app. Correct?
Strange thing about those 2 lights that are still online in the smart life app, they keep switching off and online and when they are online for a few seconds, I can control the lights. On the USG firewall, I can see requests from just one of these two lights coming in and getting dropped. All kind of strange. I powered off both lights and then on again, but that doesn’t change anything.
Questions:
Will they maybe remove themselves in a few days from the app???
If I can still control them through my phone using the smart life app, does this mean there is still a connection to the internet somehow?
Is my assumption correct that they should all be offline in the Smart Life app?
More in a few couple of minutes (can take >20 minutes though) than in a few days.
Most probably yes. Readme.md says
NOTE - Nov 2020: If you plan on integrating these devices on a network that has internet and blocking their internet access, you must block DNS requests too (to the local DNS server eg 192.168.1.1). If you only block outbound internet then the device will sit in zombie state, it will refuse / not respond to any connections with the localkey. Connect the devices first with an active internet connection, grab each device localkey and then implement the block.
My understanding of the smartlife app is it actually connects local to the device using the local keys if the phone is on the same wifi network as the devices, and doesn’t always route through the cloud. There was actually a method (not sure if it still works) where you can get the tuya keys for devices off a rooted android phone.
Therefore, I could see the devices still being controllable on the local network with the smartlife app even if the devices are blocked from accessing the internet.
Do you see a difference with the way the devices are listed in the smartlife app between being on wifi vs cell connection?
As for some ancient Smart Life app versions it was possible to extract the local keys directly from a rooted Android phone. Unfortunately this doesn’t work anymore since quite a while.
The control centre for tuya devices is surley located in the tuya cloud. The Smart Life app is only communicating directly with tuya devices during the pairing process. Just cut off your internet connection and try to switch a tuya device from your phone using the same SSID as your tuya devices. It wont work properly anymore.
Tuya based devices are obviously “reporting home” their status at regular intervals. This happens also to report back to the Smart Life app on the phone whether their actual status is online or offline. If they are considered offline for whatever reason by the tuya control centre (i.e. you have successfully blocked all ingress/egress connections from/to the Tuya Cloud, or you have an internet blackout, or the tuya device has freezed) you’ll receive that “Device Offline”-message sent onto your phone.
Although I am quite careful about where “my” data is going I did not block tuya devices from communicating with the Tuya Cloud. The main reason for installing Tuya Local to HA on my side (replacing the original Tuya integration) is because internet blackouts are happening frequently here and during those cut-offs automations controlling tuya based devices were not working reliably anymore. Even worse, if the internet connection was down for an extended period of time I had to re-pair most of the devices thereafter with the Tuya Cloud. Very annoying.
The second reason why I have installed Tuya Local is the time for the status updates from tuya devices to the Tuya Cloud back to HA. These staus updates can take up to >20 minutes (take a look here and here for an explanation of the latter). If you have automations based on the staus of tuya devices they are getting pretty much useless.
In short: If you are not too concerned about the fact that your tuya devices are reporting their actual status to the tuya control centre within the Tuya Cloud just let them do so. As for realibility install Tuya Local onto HA replacing the Tuya intergation which comes with HA. This way you’ll get the best out of two worlds: Internet cut-offs doesn’t have any impact on your automations anymore, status updates of tuya devices are happening instantly and in the rare case your HA installation gets unresponsive you can still control your tuya devices through the Smart Life app.
Thank you for your reply and explanation. The reason I wanted to cut them off from the internet is the fear that in some firmware update in the near future, Tuya will make it impossible for them to work with Home Assistant (or other apps). Or is that too far fetched?