Migrate to new config

Ill be honest its stuff like this that makes ESPhome super annoying and why im phasing it out… going through a dozen or so devices and updating code… for… because they didnt like how it was structured before? lol

I swear not a couple months ago I had to go in and do something similar with the platform lines…

2 Likes

Man, this is a sloppy rollout. The fact that so many people are having issue gives me pause.

I had the same issue and its due to the screek code including the old esp32 component. I fixed it by removing esp32 from the following:

external_components:
  - source:
      type: git
      url: https://github.com/screekworkshop/custom_components_support_for_screek_2a
      ref: main
    components: [uart]

And where there was reference to GPIO12 or GPIO13, I added ‘ignore_pin_validation_error: true’

output:
  - platform: gpio
    id: board_info_ed
    pin:
      number: GPIO12
      ignore_pin_validation_error: true

try this:

esphome:
  name: ${device_name}
  comment: "${device_description}"
  name_add_mac_suffix: false
  project:
    name: zuidwijk.slimmelezer
    version: "1.0"
  on_boot:
    then:
      - if:
          condition:
            lambda: return id(has_key);
          then:
            - lambda: |-
                std::string key(id(stored_decryption_key), 32);
                id(dsmr_instance).set_decryption_key(key);
          else:
            - logger.log:
                level: info
                format: "Not using decryption key. If you need to set a key use Home Assistant service 'ESPHome:  ${device_name}_set_dsmr_key'"
esp8266:
  board: d1_mini
  restore_from_flash: true

hi all… any idea why i am getting red line on the first line?

mapping values are not allowed here
in “/config/esphome/l2-mbr-aircon.yaml”, line 9, column 8

if i remove the entire line… the red line moves to esphome…

TIA

because the names have been changed (to protect the innocent?)

You need to use the new style. It is required since the Feb update.

I always wonder why to break working integrations, with more nitpicking rule changes, making things more complicated then needed, now I have to adapt 50 plus nodes throughout my house, thank you, or not upgrade at all!!! Why always do this? Always needing to dive into the forum to find that there had been a major not needed change! And how to solve it.

history shows this started about 3-1/2 years ago with this commit: ESP-IDF support and generic target platforms (#2303) · esphome/esphome@ac0d921 · GitHub

This appears to have been done to move esphome beyond just supporting esp MCU based devices.

Change is always hard. Change always happens or the thing dies. The change might not be necessary for your usage. When you depend on code from others you HAVE to pay attention to the changes and the reasons, especially the Breaking Changes notifications.

Speaker

🎉 Happy New Year! 🎉

We’re kicking off 2025 with a number of updates,
several of which are focused on removing old code.
Unfortunately, this means we have a few breaking changes,
but this work helps keep ESPHome more maintainable in the long-run.

Also look here for how some people handle this:
https://www.reddit.com/r/homeassistant/comments/1d2lxpv/esphome_updates_never_ending_what_do_you_guys_do/

Your choices are relatively simple:

  1. Don’t update if things are working and you are not concerned about security.
  2. Do update and get the goodness of the update, but you have to deal with the breaking changes that came in to support some goodness that might or might not be important to you.

Each choice comes with its own set of consequences, decide which set you like better.

1 Like

Can I have your help please:
I had this message:
Please remove the platform key from the [esphome] block and use the correct platform component. This style of configuration has now been removed.
platform: ESP8266
board: esp01_1m

I’m not sure about what I have to change!

This is my code, Could you kindly tell me what should I change?

esphome:
name: sonoff4chpror3
platform: ESP8266
board: esp01_1m

wifi:
ssid: “myssid”
password: “mypassword”

Enable fallback hotspot (captive portal) in case wifi connection fails

ap:
ssid: “Sonoff4Chpror3 Fallback Hotspot”
password: “p6mLcTazMYmM”

captive_portal:

Enable logging

logger:

Enable Home Assistant API

api:

ota:
platform: esphome

binary_sensor:

  • platform: gpio
    pin:
    number: GPIO0
    mode: INPUT_PULLUP
    inverted: True
    name: “Sonoff 4CH Button 1”
  • platform: gpio
    pin:
    number: GPIO9
    mode: INPUT_PULLUP
    inverted: True
    name: “Sonoff 4CH Button 2”
  • platform: gpio
    pin:
    number: GPIO10
    mode: INPUT_PULLUP
    inverted: True
    name: “Sonoff 4CH Button 3”
  • platform: gpio
    pin:
    number: GPIO14
    mode: INPUT_PULLUP
    inverted: True
    name: “Sonoff 4CH Button 4”
  • platform: status
    name: “Sonoff 4CH Status”

switch:

  • platform: gpio
    name: “Sonoff 4CH Relay 1”
    pin: GPIO12
  • platform: gpio
    name: “Sonoff 4CH Relay 2”
    pin: GPIO5
  • platform: gpio
    name: “Sonoff 4CH Relay 3”
    pin: GPIO4
  • platform: gpio
    name: “Sonoff 4CH Relay 4”
    pin: GPIO15

output:

Register the blue LED as a dimmable output …

  • platform: esp8266_pwm
    id: blue_led
    pin: GPIO13
    inverted: True

light:

… and then make a light out of it.

  • platform: monochromatic
    name: “Sonoff 4CH Blue LED”
    output: blue_led

The message literally says “remove the ‘platform’ key from the esphome block”. Was that part not clear?

It also appears to say that both the platform: and board: lines need to be removed (which is true, but perhaps less clear, until you read the documentation for platform).

There is a link I posted above to the ESP8266 Platform that shows you what you need to do.

# Example configuration entry
esp8266:
  board: nodemcuv2
  framework:
    version: recommended

The example uses a different board. So, change this:

esphome:
  name: sonoff4chpror3
  platform: ESP8266
  board: esp01_1m

to:

esphome:
  name: sonoff4chpror3

esp8266:
  board: esp01_1m

That should be the minimal change required.

Hi,
Solved.
First I removed “plataform” but didn’t ident correctly setence.
I got an error.
But right now I finally put thinks in right order and it’s working.
Thanks for your support.

How to get this to work?

Esphome:
name: wifi-switch-1
platform: ESP8266
board: esp12e
on_boot:
- priority: 300.0 # after sensor setup, before WIFI initialization
then:
- light.turn_on: # indication that the controller has power
id: strip
brightness: 70%
red: 100%
green: 0%
blue: 0%
- priority: 200.0 # after WIFI initialization
then:
- light.turn_on: # indication that the controller is looking for a wifi connection
id: strip
brightness: 70%
red: 0%
green: 0%
blue: 100%
- delay: ‘00:00:05’
- priority: -100.0 # everything is initialized, system is online - if condition waits for connection
then:
if:
condition:
wifi.connected:
then:
- light.turn_on: # indication of wifi connection confirmation
id: strip
brightness: 70%
red: 0%
green: 100%
blue: 0%
- delay: ‘00:00:05’
- light.turn_off: # turns off light waiting on automation to start
id: strip