-
-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
Turn on samsungtv with wakeonlan #50964
Conversation
If we have the mac address from discovery, we can use it to wake the TV. Currently the TV goes unavailable when you turn it off as the only way to turn it back on is wake on lan or via the remote. Users who are not using host networking can use a script instead.
Hey there @escoand, @chemelli74, mind taking a look at this pull request as its been labeled with an integration ( |
Side note, not all TV are able to wake on lan: prepare for many user issues. We had this situation already some time ago. Thats why we removed it in favor of the "official" wol integration. |
... or was it just on the intergation's doc? Not sure. |
I added a 'TV does not turn on' section to the docs so the users can figure out what to do in that case. Yes, there will always be users who don't bother to read the docs but that's already a large chunk of the issues and it doesn't seem likely (sans the usual initial amount from any change in behavior) its going to stop many users from opening an issue if the tv is not turning on vs going unavailable (current behavior). |
send_magic_packet(self._mac, ip_address=self._host) | ||
# If the ip address changed since we last saw the device | ||
# broadcast a packet as well | ||
send_magic_packet(self._mac) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would assume to broadcast based on mac should be enough to perform WoL 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If they have a bifurcated network directly sending to the ip address may be needed since 255.255.255.255 will go to the default interface and the tv may be connected to another interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does "bifurcated" include "vpn" ? (this is the day to learn new words 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
magic packets can only be send inside the same/own broadcast domain, so no to vpn, nor other only routed reachable targets ;)
But yes to add also ip in the first, to be able to handle multi NIC setups 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does "bifurcated" include "vpn" ? (this is the day to learn new words 😄
It could any network interface vpn or otherwise. In this case its likely a second network physical interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
send_magic_packet(self._mac, ip_address=self._host) | ||
# If the ip address changed since we last saw the device | ||
# broadcast a packet as well | ||
send_magic_packet(self._mac) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does "bifurcated" include "vpn" ? (this is the day to learn new words 😄
async def async_turn_on(self): | ||
"""Turn the media player on.""" | ||
if self._on_script: | ||
await self._on_script.async_run(context=self._context) | ||
elif self._mac: | ||
await self.hass.async_add_executor_job(self._wake_on_lan) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that we should not allow adding any options for this wake on lan usage. If users need options they will need to use the script.
Proposed change
If we have the mac address from discovery, we can use it to wake
the TV. Currently the TV goes unavailable when you turn it off
as the only way to turn it back on is wake on lan or via the remote
which makes the integration far less useful out of box.
This is the recommended way to turn the tv on
https://pypi.org/project/samsungtvws/
Users that have the TV on a smart switch or other system can use a
turn_on_action
as this continuesto take precedence of the built-in wake on lan functionality.
Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: