Closed digitalec closed 4 years ago
I was able to narrow it down to this block of code:
@AMoo-Miki - is this essentially waiting endlessly for a ping response (cmd 9)?
After playing around with this for a few days, I was able to (somewhat) get around my “cmd 9” problem by adding an “intro”: false
entry to each of my devices (couldn’t find any reference in the code to a context.intro except when it’s checked prior to the code above). I now see “Sending first query” and “Ready to handle” messages but the plugin seems to get ping timeouts on everything soon after. I’m able to ping all devices from the server when this happens so I’m curious if the timeout is too short or if it “forgets” where they are (I have set static IPs on all the Tuya stuff to keep the troubleshooting consistent).
Couple of questions...
I'm still curious what some of these status messages mean but I'm going to close this issue.
For anyone else looking to use this on a VLAN, it can be done and it's quite easy once you've got the VLANs setup. Put all your IoT devices and your Homebridge server on one dedicated VLAN (I have a dedicated Homebridge server running as a headless VM). I also enabled the avahi-reflector on my router to allow HomeKit to see the bridge.
My problems stemmed from the fact that I had the server on two VLANs which worked briefly after toggling devices from the Tuya app but would inevitably disconnect. This plugin couldn't find it automatically and would fallback to my static IP in the config even with routing setup on the server.
I managed to get homebridge + homebridge-tuya-lan working across two vlans but for some reason I no longer see "Sending first query..." and "Ready to handle..." after it connects to one of the devices. In the Home app, all devices show "No response". If I open the Tuya app and toggle a light, I then see the "Read to handle..." message and the device in the Home app comes to life instantly. I can use all the devices inside the Home app without issue from this point on so long as I don't have to restart homebridge.
My question is, what happens between "Connected to..." and "Sending first query..." that would prevent it from ever sending the first query? I know it's related to my setup but I'm just not sure where to start. Does it wait after it connects for a ping or some other response before it continues to send the first query and ready the device?
$ journalctl -f -u homebridge
$ journalctl -f -u homebridge (after toggling a few lights in Tuya)
Network setup: vlan10 - 10.0.10.0 - wireless router vlan20 - 10.0.20.0 - homebridge server, Apple TV, iPhone vlan40 - 10.0.40.0 - homebridge server, Tuya IoT devices
The homebridge server has two interfaces, one connecting to vlan20 and another to vlan40. I have my router (rt-ac68u) setup with an avahi-reflector which I'm not sure is necessary since the server is available on the same vlan as the ATV.