Hey guys , just did the entire mqtt sensors and switches move to different files
and i noticed that the documentation is not so clear about it (or maybe it is my shallow understanding)
my previous configuration.yaml
#camera for Vacuum
camera: !include_dir_merge_list camera/
#custom sensors
sensor: !include_dir_merge_list sensors/
#custom shelly switches
switch: !include_dir_merge_list switches/
inside old switch.yaml
- platform: mqtt
name: "shelly1pm-boiler"
unique_id: "shelly1pm-boiler"
payload_on: "on"
payload_off: "off"
qos: 0
state_topic: "shellies/shelly1pm-x/relay/0"
command_topic: "shellies/shelly1pm-x/relay/0/command"
json_attributes_topic: "shellies/shelly1pm-x/info"
new configuration.yaml
mqtt:
sensor: !include_dir_merge_list sensors/mqtt/
switch: !include_dir_merge_list switches/mqtt/
and what i did in the new file
switch:
- unique_id: "shelly1pm-boiler"
name: "shelly1pm-boiler"
state_topic: "shellies/shelly1pm-x/relay/0"
command_topic: "shellies/shelly1pm-x/relay/0/command"
json_attributes_topic: "shellies/shelly1pm-x/info"
payload_on: "on"
payload_off: "off"
qos: 0
nothing worked !! had to google for several hours and after a while i stumbled upon the issue is that in the old file you had to declare
“- platform: mqtt”
BUT in the new file
you need to skip “switch:” declaration as it was already defined in the configuration.yaml
Looking back i think if i saw an example in the official docs for split yaml config (instead of keeping everything in configuration.yaml) it would save me lots of time.
working switch.yaml
- unique_id: "shelly1pm-boiler"
name: "shelly1pm-boiler"
state_topic: "shellies/shelly1pm-x/relay/0"
command_topic: "shellies/shelly1pm-x/relay/0/command"
json_attributes_topic: "shellies/shelly1pm-x/info"
payload_on: "on"
payload_off: "off"
qos: 0