Migrate to new config

Hi,

With the release of ESPHome builder 2025.2 I’m confronted with out dated config file. Since I’m not that good at developing, I’m seeking guidance.

I think it has to do with the use of an old style code I have at the moment:


esphome:
  name: ${device_name}
  comment: "${device_description}"
  platform: ESP8266
  esp8266_restore_from_flash: true
  board: d1_mini
  name_add_mac_suffix: false
  project:
    name: zuidwijk.slimmelezer
    version: "1.0"
  on_boot:
    then:
      - if:
      etc etc etc

The error message I get is:

INFO ESPHome 2025.2.0
INFO Reading configuration /config/esphome/slimmelezer.yaml...
Failed config

esphome: [source /config/esphome/slimmelezer.yaml:7]
  name: slimmelezer
  comment: DIY P1 module to read your smart meter
  
  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
  esp8266_restore_from_flash: True
  board: d1_mini
  name_add_mac_suffix: False
  project: 
    name: zuidwijk.slimmelezer
    version: 1.0
  on_boot: 
    then: 
      - if: 

How can I convert this to the current style?

Any help is appreciated.

best regards,

Hi

First post the code properly quoted so it can be read and also post the error messages you get when you try to compile it :wink:
Also it’s not because there is a new version of ESPHome that you need to update your ESPs :wink:

Thanks

Vincèn

1 Like

You are right. Sorry about that.

I have updated the post with both your remarks

1 Like

just separate the platform to independent component

esp8266:
  board: d1_mini
  esp8266_restore_from_flash: true
1 Like

Thank you! It worked!

made a small adjustment from your example after I received an error message

esp8266:
  board: d1_mini
  restore_from_flash: true
1 Like

Hi,
I need some help with the exact same problem. When I alter the config with the config shown here I get these new errors

INFO ESPHome 2025.2.0
INFO Reading configuration /config/esphome/slimmelezer.yaml...
Failed config
````Preformatted text`
esp8266: [source /config/esphome/slimmelezer.yaml:8]
  board: d1_mini
  restore_from_flash: True
  
  [name_add_mac_suffix] is an invalid option for [esp8266]. Please check the indentation.
  name_add_mac_suffix: False
  
  [project] is an invalid option for [esp8266]. Please check the indentation.
  project: 
    name: zuidwijk.slimmelezer
    version: 1.2
  
  [on_boot] is an invalid option for [esp8266]. Please check the indentation.
  on_boot: 
    then: 
      - if: 
      -

My config

substitutions:
  device_name: slimmelezer
    
esphome:
  name: ${device_name}
esp8266:
  board: d1_mini
  restore_from_flash: true
  name_add_mac_suffix: false
  project:
    name: zuidwijk.slimmelezer
    version: "1.2"
  on_boot:
    then:
      - if:
          condition:

Thanks

Change it to:

substitutions:
  device_name: slimmelezer
    
esphome:
  name: ${device_name}
  name_add_mac_suffix: false
  project:
    name: zuidwijk.slimmelezer
    version: "1.2"
  on_boot:
    then:
      - if:
          condition:

esp8266:
  board: d1_mini
  restore_from_flash: true
3 Likes

Thank you Raymond

It looks like that was the answer :slight_smile:

1 Like

Does not work for me following these steps:

I use following code:

Any idea ? Thanks.

Dominic, those two screen images don’t match. The bottom one (of yaml code) looks as though it is after you have fixed the error shown in the top image.

Also, posting images of code is generally not as helpful as posting the code itself. Use the </> button then paste the code between the backticks to keep it formatted correctly (because indentation is so often the problem).

What is your current yaml code and error message ?

Hi,

Mine looks like this and works.

---
substitutions:
  device_name: slimmelezer
    
esphome:
  name: ${device_name}
  name_add_mac_suffix: false
  project:
    name: zuidwijk.slimmelezer
    version: "1.2"
  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

wifi:
  # remove leading '#' and fill in your wifi details

There is a new slimmelezer.yaml on his github

dsmr/slimmelezer.yaml at main · zuidwijk/dsmr

2 Likes

Hi guys, I’m getting the same issue for esphome converted aoycocr/athom plugs. wondering what board it should be for these plugs? don’t wanna try d1_mini and break it. I don’t think they have d1_mini TBH.

Cheers

Hello depends which Athom gen you have. For Gen.3 I use

esp32:
board: esp32-c3-devkitm-1
flash_size: 4MB
variant: ESP32C3

Edit: sorry indentation is not correct as on mobile. Athom GitHub has latest yaml which I copy

Hi all, i need some help also, trying to convert from old to new style but still getting error:

esphome:
  name: mmwave-woonkamer
  friendly_name: mmwave-woonkamer
  name_add_mac_suffix: true
  project:
    name: custom.mmwave_woonkamer
    version: "2A"
  on_boot:
    priority: 100
    then:
      lambda: id(cpu_speed) = ESP.getCpuFreqMHz();

esp32:
  board: esp32dev
  framework:
    type: arduino

preferences:
    flash_write_interval: 5s

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

globals:
  - id: cpu_speed
    type: int
    restore_value: no
    initial_value: '0'
  - id: last_update_ld2450
    type: unsigned long
    restore_value: no
    initial_value: '0'
  - id: init_zone_publish
    type: bool
    restore_value: no
    initial_value: "false"
  - id: last_illuminance
    type: float
    restore_value: no
    initial_value: "-1"
  - id: last_illuminance_timestamp
    type: int
    restore_value: no
    initial_value: "-1"

Platform missing. You must include one of the available platform keys: rp2040, bk72xx, libretiny, rtl87xx, host, esp8266.
name: mmwave-woonkamer
friendly_name: mmwave-woonkamer
name_add_mac_suffix: True
project:
name: custom.mmwave_woonkamer
version: 2A
on_boot:
priority: 100
then:
lambda: id(cpu_speed) = ESP.getCpuFreqMHz();

My apologizes. Yes you are right, sorry about that. I will take care of this on future posts.
I have now used your updated Github YAML code and it fixed my issue, thank you.

Hello guys I have a similar issue, error code when i click update:

INFO ESPHome 2025.2.0
INFO Reading configuration /config/esphome/nibe.yaml…
Failed config

esphome: [source /config/esphome/nibe.yaml:2]
name: nibegw
comment: Nibegw

Please remove the platform key from the [esphome] block and use the correct platform component. This style of configuration has now been removed.
platform: ESP32
board: esp32dev

My config looks like in the picture, am i supposed to remove parts or replace parts with something else? Thanks

Problem solved.
I followed this guide: [core] Remove old style platform configuration by jesserockz · Pull Request #8118 · esphome/esphome · GitHub

1 Like

Thanks for posting this, it resolved my issues after upgrading to 2025.2.0!

Hey! Can someone help me?
My previous code was:

esphome:
  name: slimmelezer
  platform: ESP8266
  board: d1_mini
  includes:
    - p1reader.h

What should the new be? This:?
esphome:
  name: slimmelezer

esp8266:
  board: d1_mini
  
includes:
  - p1reader.h

It still gives me error upon installing!