Switch to toggle states

Hi everyone,

I’m a bit stuck.
I want to control the motion and person sensors (two different sensors) with a regular switch on my Lovelace. They obviously have different values, but I just need to be able to switch between “off” and “normal”. I need a toggle switch for these states.
I’ve found various approaches, from using a switch template to triggering a scene, but I don’t quite understand them.

Both sensors hae these options: high, normal, low, off (normal and off are enough). Both are “select.”.

Could someone please explain it to me? Thanks! :slight_smile:

Create an automation with 2 triggers based on the state of your switch.

Use a choose or if/else as an action, then add the following action to tell it what option to select (adjust based on your entity ID).

action: select.select_option
target:
  entity_id: select.your_motion_sensor
data:
  option: normal
1 Like

Thank you very much for the solution! For someone searching in the future:

alias: Motion
description: Schaltet Motion- und personensensor scharf.
triggers:
  - trigger: state
    entity_id: input_boolean.anwesenheit
    to: "on"
  - trigger: state
    entity_id: input_boolean.anwesenheit
    to: "off"
conditions: []
actions:
  - choose:
      - conditions:
          - condition: state
            entity_id: input_boolean.anwesenheit
            state:
              - "on"
        sequence:
          - sequence:
              - action: select.select_option
                metadata: {}
                target:
                  entity_id: select.garten_wohnzimmer_motion_detection
                data:
                  option: normal
              - action: select.select_option
                metadata: {}
                target:
                  entity_id: select.garten_wohnzimmer_person_detection
                data:
                  option: normal
      - conditions:
          - condition: state
            entity_id: input_boolean.anwesenheit
            state:
              - "off"
        sequence:
          - action: select.select_option
            metadata: {}
            target:
              entity_id: select.garten_wohnzimmer_motion_detection
            data:
              option: "off"
          - action: select.select_option
            metadata: {}
            target:
              entity_id: select.garten_wohnzimmer_person_detection
            data:
              option: "off"
mode: single

Lovelace-Button:

    cards:
      - type: custom:button-card
        entity: input_boolean.anwesenheit
        show_state: false
        styles:
          card:
            - width: 110px