From b309b6b6046f1baa7199af9f2eef35d29e2cb645 Mon Sep 17 00:00:00 2001 From: Max R Date: Mon, 30 Oct 2023 03:47:24 -0400 Subject: [PATCH] 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> --- source/_integrations/wake_on_lan.markdown | 33 +++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/source/_integrations/wake_on_lan.markdown b/source/_integrations/wake_on_lan.markdown index b1b87bc3c39..b3165b4bef5 100644 --- a/source/_integrations/wake_on_lan.markdown +++ b/source/_integrations/wake_on_lan.markdown @@ -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.