[Home](../README.md) | Switches | [Actions](Actions.md) | [Templates](Templates.md) | [Background Service](../BackgroundService.md) | [Trouble Shooting](../TroubleShooting.md) | [Version History](../HISTORY.md) # Switches This is the simplest form: ```json { "entity": "light.bedside_light_switch", "name": "Bedroom Light", "type": "toggle" }, ``` And with an optional confirmation: ```json { "entity": "light.exterior", "name": "Exterior Lights", "type": "toggle", "tap_action": { "confirm": true } } ``` or an optional PIN confirmation: ```json { "entity": "light.exterior", "name": "Exterior Lights", "type": "toggle", "tap_action": { "pin": true } } ``` To support a non-standard light, switch, or automation as a toggle menu item you may like to define a custom switch. In order to facilitate custom switches at this time, you must create a template switch in HomeAssistant. ```yaml switch: - platform: template switches: : friendly_name: value_template: turn_on: service: data: entity_id: : turn_off: service: data: entity_id: : ``` Then you can use the following in your config: ```json { "entity": "switch.", "name": "", "type": "toggle" } ``` And you can optionally include a template to reflect some status. See [Templates](Templates.md) for details on hwo to use this JSON field. ```json { "entity": "switch.", "name": "", "type": "toggle", "content": "..." } ``` ## Example - Covers ```yaml switch: - platform: template switches: cover: friendly_name: Cover value_template: "{{ is_state('cover.cover', 'open') }}" turn_on: service: cover.open_cover data: entity_id: cover.cover turn_off: service: cover.close_cover data: entity_id: cover.cover ``` Then you can use the following in your config: ```json { "entity": "switch.cover", "name": "Cover", "type": "toggle" } ```