Skip to content
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

WIP add python telnet client for Juicebox to avoid DNS requirements #20

Merged
merged 8 commits into from
Nov 14, 2023

Conversation

snicker
Copy link
Owner

@snicker snicker commented Nov 14, 2023

will be used to periodically set the UDPC stream on the juicebox.

example:

with JuiceboxTelnet('192.168.1.39',2000) as tn:
    ip_to_verify = "192.168.1.183"
    connections = tn.list()
    for connection in connections:
        logging.debug(f"checking {connection}")
        if connection['type'] == 'UDPC':
            if ip_to_verify not in connection.get('dest'):
                logging.info('IP not set!')
                tn.stream_close(connection['id'])
                tn.udpc(ip_to_verify, 8047)
                tn.save()
            else:
                logging.info('IP set correctly')

@snicker
Copy link
Owner Author

snicker commented Nov 14, 2023

since telnetlib is deprecated in 3.12 and will be removed in 3.13 (scheduled for release 10/2024), the future solution should be to use https://pypi.org/project/Exscript/

but since I'm not going to rewrite this yet, I'll implement using telnetlib for now

@snicker
Copy link
Owner Author

snicker commented Nov 14, 2023

2023-11-13 20:53:21,933 DEBUG      JuiceboxUDPCUpdater check...
2023-11-13 20:53:23,085 DEBUG      checking {'id': '0', 'type': 'FILE', 'dest': 'webapp/index.html-1.4.0.24'}
2023-11-13 20:53:23,085 DEBUG      checking {'id': '1', 'type': 'UDPC', 'dest': '192.168.1.162:8047'}
2023-11-13 20:53:23,085 DEBUG      UDPC IP correct
2023-11-13 20:53:53,089 DEBUG      JuiceboxUDPCUpdater check...
2023-11-13 20:53:54,057 DEBUG      checking {'id': '0', 'type': 'FILE', 'dest': 'webapp/index.html-1.4.0.24'}
2023-11-13 20:53:54,058 DEBUG      checking {'id': '1', 'type': 'UDPC', 'dest': 'juicenet-udp-prod3-usa.enelx.com:8047'}
2023-11-13 20:53:54,058 DEBUG      UDPC IP incorrect, updating...
2023-11-13 20:53:55,727 DEBUG      UDPC IP Saved

@snicker snicker marked this pull request as ready for review November 14, 2023 05:21
@snicker snicker merged commit 501c354 into master Nov 14, 2023
@snicker snicker deleted the 20231113_feat_update_udpc_on_device branch November 15, 2023 05:00
Snuffy2 added a commit that referenced this pull request May 31, 2024
dont try to telnet when ignoring enelx, set current to 0 when not charging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant