How to use a mqtt switch in automation

I created a mqtt switch in the yaml file

mqtt:
switch:      
   - command_topic: "garten/channel/cmnd/power1" 
   - state_topic: "garten/channel/stat/POWER1"
     payload_on: "ON"
     payload_off: "OFF"
     name: "Pumpe" 

if i now want to make an automation for it i can not find a device ‘Pumpe’
How can i create/define a device regarding to the entity ‘Pumpe’??

    action:
      - service: switch.turn_on
        target:
          entity_id: switch.pumpe

in this way? i got an error

mqtt:
  switch:      
   - command_topic: "garten/channel/cmnd/power1" 
     payload_on: "ON"
     payload_off: "OFF"
     name: "Pumpe" 
   - action:
      - service: switch.turn_on
        target:
          entity_id: switch.pumpe

No. Use the action in an automation. Like you asked for. Not in the switch configuration.

You’ll need to reload the configuration. Either restart HA or go to Developer Tools / YAML and click this one:
image

You should then have switch.pumpe available, assuming you have fixed the indentation (switch: should be a level below mqtt:, not on the same level).

hmmmm…is there no way integrate the device Pumpe in the Frontend except with yaml entry?

Yes: choose Call Service instead of Device, then select switch.turn_on or switch.turn_off and choose your switch.pumpe.

thx, that is what i looked for:)

That is what I told you in the first reply to your question.

I think the automation UI is a bit unhelpful in this regard. Logical first step for a beginner is to select Device, and then you’re stuck.