ESPhome problems

Below is the error when I attempt to validate my yaml file in ESPhome, please help

‘’‘INFO Reading configuration /config/esphome/light-mcu-1.yaml…
Failed config
sensor.mqtt: [source /config/esphome/light-mcu-1.yaml:32]
Platform not found: ‘sensor.mqtt’.
platform: mqtt
name: Current LED
state_topic: LightMCU/locator’’’

Check line 32 for error. Basically it say that sensor.mqtt is not available

I agree with that part I’m trying to figure out how to resolve it. I have MQTT installed have I failed to fully set it up? If so what part did I fail? I completed the test in MQTT and the configuration reads as follows:

‘’’
INFO Reading configuration /config/esphome/light-mcu-1.yaml…
Failed config

sensor.mqtt: [source /config/esphome/light-mcu-1.yaml:32]

Platform not found: ‘sensor.mqtt’.
platform: mqtt
name: Current LED
state_topic: LightMCU/locator

I also have the following in the log:
1633063596: Socket error on client , disconnecting.
1633063716: New connection from XXX.XX.XX.X on port 1883.
(the X’s remove the actual IP)

How do you expect to get correct help if you don’t share your esphome sketch ? :wink:

I’m a noob I thought the error would be a better place to start, the yaml file is below:

sensor:

  • platform: mqtt
    name: “Current LED”
    state_topic: “LightMCU/locator”

the ‘’’- platform: mqtt’’’ is where the error starts, the rest of the code is fine

A .yaml with 4 lines won’t compile. You need to add a lot more.

As stated by @francisp if your sketch has only that it can’t work, you should first read in details ESPHome documentation and understand how it works :wink:

I failed to attach all of the code

esphome:
  name: backyard-light
  platform: ESP8266
  board: nodemcuv2

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: ""

wifi:
  ssid: ""
  password: ""

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Backyard-Light Fallback Hotspot"
    password: "I3W8U5yZc4P4"

captive_portal:

sensor:
  - platform: mqtt
    name: "Current LED"
    state_topic: "LightMCU/locator"

light:
  - platform: mqtt
    name: "Holiday Lights"
    command_topic: "LightMCU/power"
    state_topic: "LightMCU/powerState"
    brightness_command_topic: "LightMCU/brightness"
    brightness_state_topic: "LightMCU/brightnessState"
    brightness_scale: 255
    white_value_command_topic: "LightMCU/modifier"
    white_value_state_topic: "LightMCU/modifierState"
    white_value_scale: 500
    effect_command_topic: "LightMCU/effect"
    effect_state_topic: "LightMCU/effectState"
    effect_list:
      - Color_Chase
      - Color_Glitter
      - Single_Race
      - Double_Crash
      - Rainbow
      - Blocked_Colors
      - BPM
      - Twinkle
      - Fire
      - Fill_Solid
      - Spooky_Eyes
      - LED_Locator
    retain: true
  - platform: mqtt
    name: "Color 1"
    command_topic: "LightMCU/ColorPower"
    state_topic: "LightMCU/powerState"
    rgb_command_topic: "LightMCU/color1"
    rgb_state_topic: "LightMCU/color1State"
    retain: true
  - platform: mqtt
    name: "Color 2"
    command_topic: "LightMCU/ColorPower"
    state_topic: "LightMCU/powerState"
    rgb_command_topic: "LightMCU/color2"
    rgb_state_topic: "LightMCU/color2State"
    retain: true
  - platform: mqtt
    name: "Color 3"
    command_topic: "LightMCU/ColorPower"
    state_topic: "LightMCU/powerState"
    rgb_command_topic: "LightMCU/color3"
    rgb_state_topic: "LightMCU/color3State"
    retain: true
  - platform: mqtt
    name: "Glitter"
    state_topic: "LightMCU/glitter/state"
    command_topic: "LightMCU/addEffects"
    payload_on: "Glitter On"
    payload_off: "Glitter Off"
    rgb_command_topic: "LightMCU/glitterColor"
    rgb_state_topic: "LightMCU/glitterColorState"
    white_value_command_topic: "LightMCU/glitterChance"
    white_value_state_topic: "LightMCU/glitterChanceState"
    white_value_scale: 255
    retain: true
  - platform: mqtt
    name: "Lightning"
    state_topic: "LightMCU/lightning/state"
    command_topic: "LightMCU/addEffects"
    payload_on: "Lightning On"
    payload_off: "Lightning Off"
    white_value_command_topic: "LightMCU/lightningChance"
    white_value_state_topic: "LightMCU/lightningChanceState"
    white_value_scale: 500
    retain: true
  
##Example Group

group:
  houseLights:
    name: Holiday Lights
    control: hidden
    entities:    
      - light.holiday_lights
      - light.color_1
      - light.color_2
      - light.color_3
      - light.glitter
      - light.lightning
      - sensor.current_led

##Example Lovelace

    cards:
      - type: entities
        title: Holiday Lights
        show_header_toggle: false
        entities:    
          - light.holiday_lights
          - light.color_1
          - light.color_2
          - light.color_3
          - light.glitter
          - light.lightning
          - sensor.current_led

Here is all of it

I failed to attach all of the code

esphome:
  name: backyard-light
  platform: ESP8266
  board: nodemcuv2

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: ""

wifi:
  ssid: ""
  password: ""

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Backyard-Light Fallback Hotspot"
    password: "I3W8U5yZc4P4"

captive_portal:

sensor:
  - platform: mqtt
    name: "Current LED"
    state_topic: "LightMCU/locator"

light:
  - platform: mqtt
    name: "Holiday Lights"
    command_topic: "LightMCU/power"
    state_topic: "LightMCU/powerState"
    brightness_command_topic: "LightMCU/brightness"
    brightness_state_topic: "LightMCU/brightnessState"
    brightness_scale: 255
    white_value_command_topic: "LightMCU/modifier"
    white_value_state_topic: "LightMCU/modifierState"
    white_value_scale: 500
    effect_command_topic: "LightMCU/effect"
    effect_state_topic: "LightMCU/effectState"
    effect_list:
      - Color_Chase
      - Color_Glitter
      - Single_Race
      - Double_Crash
      - Rainbow
      - Blocked_Colors
      - BPM
      - Twinkle
      - Fire
      - Fill_Solid
      - Spooky_Eyes
      - LED_Locator
    retain: true
  - platform: mqtt
    name: "Color 1"
    command_topic: "LightMCU/ColorPower"
    state_topic: "LightMCU/powerState"
    rgb_command_topic: "LightMCU/color1"
    rgb_state_topic: "LightMCU/color1State"
    retain: true
  - platform: mqtt
    name: "Color 2"
    command_topic: "LightMCU/ColorPower"
    state_topic: "LightMCU/powerState"
    rgb_command_topic: "LightMCU/color2"
    rgb_state_topic: "LightMCU/color2State"
    retain: true
  - platform: mqtt
    name: "Color 3"
    command_topic: "LightMCU/ColorPower"
    state_topic: "LightMCU/powerState"
    rgb_command_topic: "LightMCU/color3"
    rgb_state_topic: "LightMCU/color3State"
    retain: true
  - platform: mqtt
    name: "Glitter"
    state_topic: "LightMCU/glitter/state"
    command_topic: "LightMCU/addEffects"
    payload_on: "Glitter On"
    payload_off: "Glitter Off"
    rgb_command_topic: "LightMCU/glitterColor"
    rgb_state_topic: "LightMCU/glitterColorState"
    white_value_command_topic: "LightMCU/glitterChance"
    white_value_state_topic: "LightMCU/glitterChanceState"
    white_value_scale: 255
    retain: true
  - platform: mqtt
    name: "Lightning"
    state_topic: "LightMCU/lightning/state"
    command_topic: "LightMCU/addEffects"
    payload_on: "Lightning On"
    payload_off: "Lightning Off"
    white_value_command_topic: "LightMCU/lightningChance"
    white_value_state_topic: "LightMCU/lightningChanceState"
    white_value_scale: 500
    retain: true
  
##Example Group

group:
  houseLights:
    name: Holiday Lights
    control: hidden
    entities:    
      - light.holiday_lights
      - light.color_1
      - light.color_2
      - light.color_3
      - light.glitter
      - light.lightning
      - sensor.current_led

##Example Lovelace

    cards:
      - type: entities
        title: Holiday Lights
        show_header_toggle: false
        entities:    
          - light.holiday_lights
          - light.color_1
          - light.color_2
          - light.color_3
          - light.glitter
          - light.lightning
          - sensor.current_led

I removed the wifi info as I know that is correct and the OTA password

Instead of editing your code before sharing it here, put all credentials in secrets file :wink:

How do you expect to subscribe at MQTT topics without first declaring how to connect at MQTT Server ? I would strongly advise you to read ESPHome documentation about MQTT here MQTT Client Component — ESPHome to properly setup it and also perhaps read a little of documentation about MQTT to understand properly how it works (Documentation | Eclipse Mosquitto)

Excellent point, I just read up on that last night and I’m reconfiguring all of my code to operate that way

:+1: and feel free to share your sketch again if you still have some issues after having updated it :wink: