I changed machines and did a fresh install. And all all my MQTT lights have disappeared after I copied my yaml files to the new computer … The lights no long show up as entities.
They work if I define them directly in the config file. However, moving them in separate include file breaks it. Right now I’m assuming that they’ve changed something and I need rework the include but I’m not sure how.
No that wasn’t it. It gives this error when I change the platfrom to light -
Configuration invalid!
Invalid config for [mqtt]: expected dictionary for dictionary value @ data['mqtt']. Got [{'platform': 'light', 'name': 'Office Light RGB', 'command_topic': 'office/rgb1/light/switch', 'payload_on': 'ON', 'payload_off': 'OFF'}]. (See /config/configuration.yaml, line 13).
I’ve also noticed that when I define MQTT lights in the Config file they’re not exposed to the Emulated Hue. My other lights YEE and WiZ work fine with it.
Follow the instructions for Default Schema as explained in the documentation for the MQTT Light integration. Initially, follow the instructions to configure a single light in configuration.yaml. Only after you have succeeded, proceed to move the light’s configuration to a separate file. After you have confirmed it (still) works, proceed to add all of your other lights to it.
That helps to identify the step causing the failure.
I believe your second try (“Try 2”) came very close except for the format of the contents in light.yaml (entities under the light key word must be formatted as a list).
Anyway, you fix that (i.e. add a hyphen before name: to indicate it’s a list item) or use Troon’s suggestion to employ a separate file for each MQTT-based entity platform.
Neither the documentation or Troon’s example includes a reference to platform. Post exactly what you entered under the mqtt: key in configuration.yaml and within the x_x/light.yaml file.