Step 1: Create a Light Group (Helper)
The benefit is that you can group all your lights together, and from then on you only need to control this group to control all the lights at once.
- Open your Home Assistant interface.
- Click Settings in the left sidebar.
- Click Devices & Services.
- Select the Helpers tab in the top tab bar.
- Click + CREATE HELPER in the bottom right corner.
- In the list that pops up, select Group.
- Select Light group.
- Set the name: for example All Lights.
- Members: here select all the lights in your home that you want to turn off with one tap.
- Click Submit.
Now you have a virtual switch with the ID light.suo_you_deng (generated automatically from the Chinese name you gave it).
Step 2: Add a One-Tap Lights Off Button to the Dashboard
Now we will put this feature on the main screen of your phone or tablet.
- Go back to the Overview dashboard.
- Click the three dots in the top right corner (or the pencil icon) and select Edit Dashboard.
- Click ADD CARD in the bottom right corner.
- Search for and select the Button card.
- Configure it in the settings screen:
- Entity: select the light.suo_you_deng you just created.
- Name: enter One-Tap Lights Off.
- Icon: the default is a light bulb; you can change it to mdi:lightbulb-off.
- Tap Action: the key step!
- If you want a single tap to toggle (on becomes off and off becomes on), choose Toggle.
- If you only want it to perform the off action, choose Call Service as the action.
- Service name: enter light.turn_off.
- Target entity: select light.suo_you_deng.
Click Save, then click Done in the top right corner.
Advanced: If You Want It Cooler (the Scene Method)
If you want one-tap lights off to also turn off plugs or close the curtains, you can use a Scene.
- Click Settings -> Automations & Scenes -> Scenes.
- Click Add Scene.
- Name it Going to Sleep.
- Click Add Device and add all the lights and appliances you want to turn off.
- Key point: manually set all these devices to the Off state on the page.
- Click Save.
- Go back to the dashboard and add a Button card, then select the entity scene.shui_jue_qu.
This way, when you tap the button once, HA will force all the selected devices into the Off state you just saved.