-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error using screenlogicpy across VLANs #18
Comments
Just to follow up, the problem happens after sending the login message here:
I actually tested it on the old pre async library so I'll try it again on the current library a little later. I looked at the other SL libraries and the protocol documentation at https://github.com/ceisenach/screenlogic_over_ip and everyone seems to use the same login message. Maybe the adapter just doesn't like logins from outside the subnet, and not sure if there is a login message tweak that will fix that. |
Thank you for the detailed info! Unfortunately, it doesn't look like good news. That fact that Based on your information of the sequence of events, it appears to be the response to the Looking around online, it seems that this may not be unique to this API and may even happen with the oficial ScreenLogic app: That said, I want to keep this open as I'd like to spin up a vlan and run some tests, maybe trying different logon methods. If nothing else, I'll fix the silent failure in ...And you just came to the same conclusion as I was writing this. 🥇 |
Providing an update to this, the I've finally set up a vlan/separate subnet with the Pentair protocol adapter and the following firewall rules:
Obviously, discovery doesn't work as that is a subnet broadcast, but direct connection to the protocol adapter via its IP address is working fine for me. I was also able to confirm that Home Assistant tracked the IP change of the protocol adapter after a reload of the integration and is communicating fine across vlans/subnets. I did add an new method to the At this point, it doesn't seem like there is an issue with the library itself. If you have more information, I'll be happy to take a look. Otherwise, I can close this in a few days. |
Thanks for the update. It's curious that you are unable to reproduce this - in addition to me it seems like a few others have experienced the same issue (@strouja has a thumbs up here, and @burntoc was the one who first reported the issue on HA core). I have the same general firewall rules, but perhaps there are some minor details which are different which end up causing the issue. |
I'm running into a similar situation. If my client is on a different subnet/VLAN, then I actually get a "Request explicity rejected 1". If I move the client to the same subnet, then no errors are produced. I don't have any restrictions on the pool net or the main net, but I am bothered by the amount of Internet chatter the protocol adapter makes to the outside, so I may block that. I digress and that's for another day, so here's details on my env and error: I'm running v0.5.4, but I was on 0.4.3 prior to today. Before the upgrade, the client would just return noting, but I'm definitely getting more info now.
I can provide packet captures on the switch if that would be helpful. |
I have a Layer3 switch that segments my pool and main networks. To temporarily solve this problem (which is causing HomeAssistant from communicating with my Pentair protocol adapter), I configured the router/switch SNAT the HTTP traffic destined to the protocol adapter changing the source IP of the traffic to that of the VLAN interface on the router/switch. This way, the protocol adapter will see the traffic from a device on the same network. When doing this, it works like charm. @dieselrabbit I'm assuming this is some sort of lame security ACL on the protocol adapter itself and not a problem with the library, but would love hear your thoughts. |
Oh man, thank you for sharing this - it never crossed my mind! I was doing all sorts of multicast forwarding and stuff and it just didn't work. Your fix took me like 60 seconds and - bang - I'm in business! |
@uvjustin Yes, I was actually surprised that I was unable to reproduce the issue. I had to double-check my settings, and that the firewall was working as intended. @rsumner Your error with v0.5.4 is as expected, and as others have reported where the protocol adapter is responding, but with a message code that is the same as if you sent it a junk request (invalid message code or improper data in the message.) Very little of the protocol is documented so I'm making assumptions that the response is an "Explicit rejection". Since other online posts for other connection methods/APIs make mention of trouble connecting to a protocol adapter from a different subnet, it stands to reason that it is some sort of ACL. My next course of action was to try the As for why I don't get the issue, it's possible my Unifi system is by default automatically handling the traffic in a way that is acceptable to the protocol adapter, and my firewall rules to allow the desired traffic do nothing to disrupt that. That the only thought I am left with at the moment. |
@dieselrabbit thanks for the feedback. I'm completely happy with using NAT to overcome the ACLs in the protocol adapter when operating across subnets. Thanks for the great work on this library. IMO, I would suggest the only followup to this issue is making a documentation update to this indicating NAT is required for cross-subnet communication when using unicast. |
I ended up just doing the same as the others, using SNAT to get around the ACL issue. I would agree with the post above in just noting the behavior in the docs and suggesting SNAT as a potential workaround. |
This has been brought back up as I am currently implementing retrying of requests and better error handling for unexpected responses. I would still like to understand this better, either to develop a workaround within During the previous testing, I had a Layer 2 switch and believed I was seperating my main and pool networks via a VLAN for the pool network. They had separate Networks, separate IP ranges/subnets, and the pool network was tagged with a VLAN id. I recently upgraded to a Layer 3 switch, keeping and applying all the same network settings from before and I still am not having any problems connecting to the ScreenLogic protocol adapter. This is making me wonder if I am actually segmenting my networks properly. If anyone is able and willing to assist me with investigating, I'd be very appreciative. |
@dieselrabbit My protocol adapter is dead now, but when it was active it DID NOT have a access password set. I'm using https://github.com/tagyoureit/nodejs-poolController with a cheap RS485 USB adapter now. |
@rsumner Doh. Sorry to hear it died, but glad you have a solution to maintain control. Thanks for the info. To this day I've only ever been able to reproduce the login rejection when on a different subnet/vlan by setting a password on the protocol adapter. |
@dieselrabbit |
Setting no password (blank) should unset it. |
Interestingly enough I was able to unset it, but it didn't help with the error. I just set up snat to get around it. Thanks |
Coming over from home-assistant/core#55398
The API and HA integration work fine when HA and the ScreenLogic device are on the same VLAN/subnet.
When on different VLANs, the discovery still works fine, but the connection seems to fail after that.
Running
python -m screenlogicpy.cli -i xxx.xxx.xxx.xxx -p 80 get json
exits silently with no output.It looks like the TCP socket is opening up and the initial connection gets made, and the first takeMessage() seems correct (it comes back with a
(sndCode, msgCode, msgLen, message)
of(0,15,24,some data)
.However the second takeMessage comes back with
(0,13,0,b'')
so it ends up failing here:screenlogicpy/screenlogicpy/requests/utility.py
Line 23 in c155455
The text was updated successfully, but these errors were encountered: