Help my Yaml file

I cannot get my MQTT-Switch file to work.:

/# Example configuration.yaml entry
mqtt:
broker: 192.168.1.51
port: 1883
username: XXXXXXX
password: XXXXXXX
client_id: homeassistant

-switch:
unique_id: bedroom_switch
name: Bedroom Switch
state_topic: home/bedroom/switch1
command_topic: home/bedroom/switch1/set
availability:
- topic: home/bedroom/switch1/available
payload_on: ‘ON’
payload_off: ‘OFF’
state_on: ‘ON’
state_off: ‘OFF’
optimistic: false
qos: 0
retain: true

It give me warning signs:

/Configuratiewaarschuwingen
Invalid config for ‘mqtt’ at configuration.yaml, line 18: ‘broker’ is an invalid option for ‘mqtt’, check: mqtt->0->broker
Invalid config for ‘mqtt’ at configuration.yaml, line 18: ‘client_id’ is an invalid option for ‘mqtt’, check: mqtt->0->client_id
Invalid config for ‘mqtt’ at configuration.yaml, line 18: ‘password’ is an invalid option for ‘mqtt’, check: mqtt->0->password
Invalid config for ‘mqtt’ at configuration.yaml, line 18: ‘port’ is an invalid option for ‘mqtt’, check: mqtt->0->port
Invalid config for ‘mqtt’ at configuration.yaml, line 18: ‘username’ is an invalid option for ‘mqtt’, check: mqtt->0->username
Integration error: -switch - Integration ‘-switch’ not found.

Can someone get me directions please?

Thanks.

Check out this link to format your code. #11

It helps expedite resolutions.

At first sight, you’re using the YAML way to configure your broker, which is deprecated since awhile.

Use the UI to add the integration, as described in the documentation