question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Socket had a problem and will reconnect" after RGBTW lamp is turned off, then back on

See original GitHub issue

Hey, I have a problem with my RGBTW lamp after I turn it off using the power switch (like you would with a normal lamp). I’m using 1.5.0-rc.12. When I turn the lamp off, obviously tuya-lan loses connection and tries to reconnect and therefor spams the homebridge.log with [TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (Error: ERR_CONNECTION_TIMED_OUT) First question: is there a way to disable the retries after a certain time or number of tries and wait for the next UDP packet from the lamp instead?

Now my second problem is that if I turn the lamp back on using the power switch, it seems like tuya-lan tries to reconnect to the lamp, but fails for some reason. The lamp is powered on and homebridge just started, so all is working normally:

[TuyaAccessory] Sending Küche Deckenlampe {"22":1000}
[TuyaAccessory] Sending Küche Deckenlampe {"20":true}
[TuyaAccessory] Heard back from Küche Deckenlampe with command 8
[TuyaAccessory] Heard back from Küche Deckenlampe with command 8

Now I turn the lamp off using the switch.

[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (Error: ERR_PING_TIMED_OUT)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (EHOSTUNREACH)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (EHOSTUNREACH)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (EHOSTUNREACH)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (EHOSTUNREACH)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (Error: ERR_CONNECTION_TIMED_OUT)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (EHOSTUNREACH)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (Error: ERR_CONNECTION_TIMED_OUT)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (EHOSTUNREACH)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (Error: ERR_CONNECTION_TIMED_OUT)

Again, this seems normal to me, but this would soon turn into these error messages filling up the log file. Now I turn the lamp back on and would expect it to become available again, but various errors occur:

[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (ECONNREFUSED)
[TuyaAccessory] Sending first query to Küche Deckenlampe (3.3)
[TuyaAccessory] Heard back from Küche Deckenlampe with command 10
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (Error: ERR_CONNECTION_TIMED_OUT)
[TuyaAccessory] Sending first query to Küche Deckenlampe (3.3)
[TuyaAccessory] Heard back from Küche Deckenlampe with command 10
[TuyaAccessory] Sending first query to Küche Deckenlampe (3.3)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (EPIPE)
[TuyaAccessory] Sending first query to Küche Deckenlampe (3.3)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (EPIPE)
...
[TuyaAccessory] Sending first query to Küche Deckenlampe (3.3)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (ECONNRESET)
...
[TuyaAccessory] Sending first query to Küche Deckenlampe (3.3)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (EPIPE)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (Error: ERR_CONNECTION_TIMED_OUT)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (Error: ERR_CONNECTION_TIMED_OUT)
...
[TuyaAccessory] Sending first query to Küche Deckenlampe (3.3)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (EPIPE)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (ECONNRESET)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (EALREADY)
[TuyaDiscovery] UDP from 192.168.178.30:6667 0x000055aa...0x0000aa55
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (Error: ERR_CONNECTION_TIMED_OUT)
[TuyaAccessory] Sending first query to Küche Deckenlampe (3.3)
[TuyaAccessory] Heard back from Küche Deckenlampe with command 10
[TuyaAccessory] Sending first query to Küche Deckenlampe (3.3)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (EPIPE)
[TuyaAccessory] Sending first query to Küche Deckenlampe (3.3)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (EPIPE)
[TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (ECONNRESET)

and so on… If needed, I can provide the whole log file. If I restart homebridge, everything is working fine again and the lamp is working properly.

[TuyaDiscovery] Discovery started on port 6666.
[TuyaDiscovery] Discovery started on port 6667.
[TuyaDiscovery] UDP from 192.168.178.30:6667 0x000055aa...0x0000aa55
[2020-2-29 10:10:09 PM] [TuyaLan] Discovered Küche Deckenlampe (<id>) identified as RGBTWLight (3.3)
[TuyaAccessory] Changing ping gap for Küche Deckenlampe to 9s
[2020-2-29 10:10:09 PM] [TuyaLan] Connected to Küche Deckenlampe
[TuyaAccessory] Sending first query to Küche Deckenlampe (3.3)
[TuyaAccessory] Heard back from Küche Deckenlampe with command 10
[2020-2-29 10:10:10 PM] [TuyaLan] Ready to handle Küche Deckenlampe (RGBTWLight:3.3) with signature {"20":true,"21":"colour","22":1000,"23":579,"24":"0000000003e8","25":"000e0d0000000000000000c80000","26":0}

My homebridge config.json looks like this:

{
    "platform": "TuyaLan",
    "devices": [
        {
            "name": "Küche Deckenlampe",
            "type": "RGBTWLight",
            "manufacturer": "Oeegoo",
            "model": "YY-CL16-220S-WF(RGB+)",
            "id": "<id>",
            "key": "<key>",
            "dpPower": 20,
            "dpMode": 21,
            "dpBrightness": 22,
            "dpColorTemperature": 23,
            "dpColor": 24,
            "minWhiteColor": 140,
            "maxWhiteColor": 400,
            "colorFunction": "HSB"
        }
    ]
}

Thanks for your help!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
Faisalthe01commented, Aug 31, 2020

I was able to somewhat solve this issue by adding

"pingTimeout": 2147483,
"connectTimeout": 2147483,

to the device config. Now when I turn the lamp off, I still get [TuyaAccessory] Socket had a problem and will reconnect to Küche Deckenlampe (EHOSTUNREACH) every few seconds, but it recovers fine when I turn the power back on. 2147483000 ms should last me approx. 25 days, which should be plenty, so I‘m closing this issue for now.

Thank you. You solved one of my big problem

0reactions
jnukcommented, Oct 1, 2020

If I remember correctly, I googled the light’s name and found the settings in one of the issues on this repo. I don’t think there is a guide and as long as you don’t have access to the schematics of your lamp or someone else has found out the correct pins, you might have to find it out yourself by trial and error…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Smart Plug Turns Off then Back On : r/smartlife - Reddit
Recently I've had an issue where the plug will turn off and then back on a moment later. It seems to happen once...
Read more >
Untitled
Following instructions of silk print on the housing of bridge, then plug the output wires into LED light strip input connectors.
Read more >
Causes of Lost Power After Changing a Light Fixture
If the circuit breaker trips off then there is still a problem with the light fixture wiring which will need to be inspected...
Read more >
OREiN Smart Flood Light Bulbs, Music Sync RGBTW LED ...
DO NOT use the switch to turn off the bulb, which will make the bulb to be offline. It is recommended to use...
Read more >
Tuya Lan - HOOBS
4. Device Types ; Smart Plug, Outlet · Smart plugs that just turn on and off (instructions) ; Smart Light Bulb Socket, SimpleLight,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found