markusb
(Markus Baertschi)
December 26, 2017, 11:56am
1
I’m attempting to set up my first device. It is a relay with mqtt control. From the examples and documentation I assembled a configuration and added to configuration.yaml:
mqtt:
broker: 192.168.15.1
port: 1883
client_id: home-assistant
relay01:
platform: mqtt
name: Relay01
command_topic: 'BdR14/Relay01/control'
payload_on: 1
payload_off: 0
state_topic: 'BdR14/Relay01/state'
When starting up hass, I get this wondefully explicit error message:
The following components and platforms could not be set up:
- relay01
Please check your config.
How to I figure out what is wrong ?
You’re missing the component type ‘switch’
mqtt:
broker: 192.168.15.1
port: 1883
client_id: home-assistant
switch:
- platform: mqtt
name: "Relay01"
command_topic: 'BdR14/Relay01/control'
payload_on: 1
payload_off: 0
state_topic: 'BdR14/Relay01/state'
More info and examples at https://home-assistant.io/components/switch.mqtt/
markusb
(Markus Baertschi)
December 26, 2017, 3:19pm
3
How do I add a second or third switch ?
Repeat the full ‘switch:’ block with different parameters ‘name’ and ‘topic’ ?
Name seems to be optional, so it names things automatically if I add multiple items without naming them ?
switch:
- platform: mqtt
name: "Relay01"
command_topic: 'BdR14/Relay01/control'
payload_on: 1
payload_off: 0
state_topic: 'BdR14/Relay01/state'
- platform: mqtt
name: "Relay02"
command_topic: 'BdR14/Relay02/control'
payload_on: 1
payload_off: 0
state_topic: 'BdR14/Relay02 /state'
- [etc]
markusb
(Markus Baertschi)
December 26, 2017, 11:34pm
5
Good, thanks ! This seems to work.
1 Like