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

Short circuit the "on" command #141

Merged
merged 1 commit into from
Dec 5, 2023
Merged

Short circuit the "on" command #141

merged 1 commit into from
Dec 5, 2023

Conversation

Tenzer
Copy link
Collaborator

@Tenzer Tenzer commented Dec 5, 2023

The "on" command is special since it doesn't make use of the websocket connection. It instead sends a wake-on-lan package. This means ws.connect() isn't needed for this and actually just slows down the command because it causes ws4py to try to establish a connection to a TV that is most likely off, considering the command being executed.

I did contemplate moving the "on" command out of the LGTVRemote class, but I thought this would be a smaller change. Another alternative would be to make LGTVRemote.on into a static method so it can be called without initialising LGTVRemote, but then we loose out on the config parsing done in LGTVRemote.__init__.

The "on" command is special since it doesn't make use of the websocket
connection. It instead sends a wake-on-lan package. This means `ws.connect()`
isn't needed for this and actually just slows down the command because it
causes ws4py to try to establish a connection to a TV that is most likely off,
considering the command being executed.
@klattimer klattimer merged commit 63e0e50 into klattimer:master Dec 5, 2023
3 checks passed
@Tenzer Tenzer deleted the short-circuit-on-command branch December 5, 2023 11:16
@Tenzer
Copy link
Collaborator Author

Tenzer commented Dec 5, 2023

Wow, that was quick!

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.

2 participants