npope / home-assistant-crestron-component

Integration for Home Assistant for the Crestron XSIG symbol
Apache License 2.0
59 stars 19 forks source link

from_joins: sometimes works sometimes not #7

Open smallbitt opened 2 years ago

smallbitt commented 2 years ago

I can't still figure out why but the from_joins is not always working. to_join is always ok instead.

anyone knows why this happen?

SebastiaanVBH commented 1 year ago

I'm having the same issue.

I can recreate the issue when restarting HA. From this point, the from_joins stop working. When I restart the Simpl program when HA is running stable again, the issue goes away and from_joins is communicating again.

anouk commented 7 months ago

because the client is open and attached to the server, when the server reboots it crashes the connection. Some retry/reconnect logic on the crestron side needs to be implemented.

SebastiaanVBH commented 6 months ago

At the moment it has gotten worse.

When I start Crestron AND HA, it connects when HA is done loading. I see some RX coming from HA and then it stops. No disconnections at all. TX from Crestron to HA is still working.

Is there any way to debug this on the HA side?

anouk commented 6 months ago

Not sure if it helps but I built a dotnet sig server that can take the place of HA for testing https://github.com/anouk/TCPServr

SebastiaanVBH commented 6 months ago

Hi Anouk, When I clicked on your link, I got a 404 error.

As I'm learning every day, I now know how to set the logger level in HA for the crestron component.

I saw something which was happening: Connection from Crestron RMC4 was made on a certain IP-Address Then the connection was disconnected from HA side (although Crestron RMC4 could still send XSIG data!!!) A new connection was made from another IP-Address

This particular behaviour happened after I replaced my Unifi USG-3P gateway for a Unifi Dream Machine Pro.

Apparently the Dream Machine Pro had set something on the network (multicast?). The new IP-Address was a Crestron DIN-CEN-CN-2-PoE which had been on the network for quite some time already. By default, this unit has something in its ip-table for pyng. Not set with an ip-address, but by hostname.

An extra fault introduced by myself: I used the original CIP-port 41794 as port on the HA side.

My assumption: The DIN-CEN-CN-2-PoE would do a broadcast/multicast/whatever on the network, which is identified by HA-Crestron as a new connection. HA disconnects (not really, because the RMC4 could still send data) and thinks there is a new connection to the DIN-THING. HA was probably sending data to the DIN-THING from that moment on, while on the other hand receiving data from the RMC4...

Would it be feasible to listen to multiple TCP-Clients in the custom-components? Then the above behaviour would not have occured as the connection to the RMC4 would still be alive.

anouk commented 6 months ago

Sorry... forgot to make that public. I also have a Unifi Dream Machine Pro! My crestron project is in Simpl# so I built in some reconnect logic for when I reboot the HA Pi 4.

You could try wireshark to see what is going on on the network. I am still new with the python but ill let you know if I see a way to limit the server connections to one IP