Wake on LAN: Add docs for using helper button & automation (#29586)

* Wake on LAN: Add docs for using helper button & automation

The current docs explain how to create a switch, A switch defined with the `wake_on_lan` platform will render in the UI with both 'on' and 'off' clickable actions. If the user doesn't intend to use the `turn_off` functionality then using a virtual button & automation will look cleaner and less confusing. This change updates the docs to explain how to do that.

* Update wake_on_lan.markdown

* Style tweak: convert into numbered procedure

* indent YAML to fit into step format

---------

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>
This commit is contained in:
Max R 2023-10-30 03:47:24 -04:00 committed by GitHub
parent 9bef4b43fe
commit b309b6b604
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -133,3 +133,36 @@ switch:
shell_command:
turn_off_TARGET: "ssh hass@TARGET sudo pm-suspend"
```
## Helper button with automation
A switch defined with the `wake_on_lan` platform will render in the UI with both 'on' and 'off' clickable actions. If you don't intend to use the `turn_off` functionality, then using a virtual button & automation will look cleaner and less confusing. It will only have one action.
1. First, define a new helper button.
- Go to **{% my helpers title="Settings > Devices & Services > Helpers" %}** and select the **+ Create helper** button. Choose **Button** and give it a name. A button named "Wake PC" will render like this:
![image](https://github.com/home-assistant/home-assistant.io/assets/252209/10e468a0-45c8-4ee7-b69d-596db3845b14)
2. Then, create a new automation. Go to **{% my automations title="Settings > Automations & scenes" %}** and select **+ Create Automation**.
- The trigger will be on `State` and the entity will be the button you created.
- Continuing your example, the trigger YAML will look like this:
```yaml
platform: state
entity_id:
- input_button.wake_pc
```
3. For the action, select **Call service** and choose **Wake on LAN: Send magic packet**.
4. Type in the target MAC address.
- Do not change the broadcast port unless you've configured your device to listen to a different port.
- Continuing our example, the action YAML looks like this:
```yaml
service: wake_on_lan.send_magic_packet
data:
broadcast_port: 9
mac: 00:11:22:33:44:55
```
5. Save the automation. Now, when you activate `PRESS` on the helper button in the UI, Home Assistant will send a wake packet to the configured MAC.