Struggling with YAML

Finally got FTDI to work and flashed two of my Sonoffs. I can control them with their web interface. Now trying to get them to appear in Hass.io.

My configuration.yaml looks like this.

switch:
  - platform: mqtt
    name: "Socket"
    state_topic: "socket_1/state"
    command_topic: "socket_1/cmnd"
    availability_topic: "socket_1/available"
  - platform: mqtt
    name: "TH10(Switch)"
    state_topic: "th10_1/state"
    command_topic: "th10_1/cmnd"
    availability_topic: "th10_1/available"

# Sensors
sensor:
  # Weather prediction
  - platform: yr

  - platform: mqtt
    name: "TH10(Temp)"
    state_topic: "tele/th10_1/SENSOR"
    value_template: "{{ value_json.BME280.Temperature }}"
    unit_of_measurement: "°C"

  - platform: mqtt
    name: "TH10(Hum)"
    state_topic: "tele/th10_1/SENSOR"
    value_template: "{{ value_json.BME280.Humidity }}"
    unit_of_measurement: "%"

socket_1 and th10_1 are the correct names. If I go onto the device console, I can do socket_1/power 1 and it switches on OK.

The devices don’t seem to “appear” in Home Assistant. That said, if they did, I’m not sure where I would expect to see them. Should I see them on the “Overview” page?

Is it correct to have multiple “-platform” entries under one “switch:” entry?

What is the “switch:” entry called? (I’m a software engineer. I mean what is it an example of?) Is it a “topic”?

Same question for “-platform”. What is this YAML entry called?

Other than “switch:” or “sensor:” Where can I find a list of the devices which can be added?

If ever there was a steep learning curve, I’m on it!

In the old UI they would automatically appear in the default view main page but in the new lovelace UI I’m not sure if they still do that or not. Since you don’t see them on any views I assume that the latter is true so the only place you will see them until you manually put them into a view is in the dev-states page. That you can access by clicking the hamburger menu on the top left then at the bottom is a “<>” icon. Click it and you will see all of your entities sorted by domain.

Yes, that’s the only way you are supposed to do it.

It is a “component” and usually it’s also referred to as a “domain”. There are other entries in the configuration.yaml that don’t correspond with a component/domain tho and I’m not really sure if there is an “official” name for those entries aside from simply “configuration” entries.

Umm…“platform”…:slightly_smiling_face:

In your case your device falls under the MQTT platform in the SWITCH component. When you reference it in further configurations it will be by the “domain.device_id” which is collectively called the “entity_id”.

2 Likes