dominicusmento / CSharpTradFriLibrary

This is a .NET Standard (2.0) library to communicate with the IKEA Home (Tradfri) ZigBee-based Gateway.
GNU General Public License v3.0
37 stars 20 forks source link

Timeout connecting to Tradfri gateway #34

Closed mthompson2 closed 4 years ago

mthompson2 commented 4 years ago

Environment Visual Studio 2019 on Windows 10 Tradfri Gateway version 1.9.27 with DHCP IP 10.1.5.7

Code that fails tradfriController = new TradfriController("GW", "10.1.5.7"); TradfriAuth appSecret = tradfriController.GenerateAppSecret("XXXXXXXXX", "Tradfri");

Where XXXXXXXXX is the gateway secret from the back of the gateway.

On execution the code hangs for about 30 seconds. When it returns appSecret is null.

I can ping 10.1.5.7. The Idea Tradfri App works fine.

Any suggestions of what im doing wrong if this isnt a bug would be hugely appreciated.

Thanks.

BjornPoppe commented 4 years ago

I got the same problem when I tried the library the other day but haven't got around to report yet. It was due to miss-spelled PSK (mixed up small cap L with large cap I).

mthompson2 commented 4 years ago

Hi, Thanks for the reply.

I presume the gateway key printed on the botttom of the Tradfri hub? Ive checked it and rechecked the code and think i have it right... Still doesn't work though.

mthompson2 commented 4 years ago

Was wondering if it was something to do with my Unifi network - But it doesnt seem to be. Have connected directly between PC and Trdfri via a generic, dumb switch (Third port to Unifi network) and still no joy. The Idea / Tradfri App works fine though from my android phone.

Tearing my hair out on this one.

dominicusmento commented 4 years ago

The problem you described seems to be that your app (code) doesn't get the response from the gateway. Yet it can be the request itself that doesn't reach the gateway at all, or it can be that you don't get a response. Any way I think it is something in the networking, either specific PC network/firewall settings, or network internally or the gateway maybe has stuck in some mode. Most probable cause would be the PC as you already said that Android app works fine. Can you try on another PC with compiled app.

mthompson2 commented 4 years ago

Apologies for the delay responding. Was needed to be away from home for several days. I will get this tested in the next couple of days and report back.

dominicusmento commented 4 years ago

Closing due to inactivity..