Dumb question about updating device YAML

I am using the Sonoff S31 WiFi plug and works fine with ESPHome. I wanted to change one of the energy reporting parameters, do I need to “re-flash” or is there a simple way to change the device’s YAML?

Sorry if I’m using the wrong terminology, it’s late and I just finished getting ESPHome working on this device. Appreciate any clarity. :heart:

The yaml only tells esphome how to compile the firmware. So yes, you need to recompile and upload.

1 Like

If it’s a parameter that you will be needing to adjust more than just once you can change some things on the fly by using mqtt quickly and not have to flash the whole code every time you want to change value. You will have to flash the yaml once to get the code below into it first.

  - platform: mqtt_subscribe
    name: "Sleep time topic"
    id: custom_sleep_time
    unit_of_measurement: ms
    accuracy_decimals: 0
    topic: device1/sleep_mode_time
    on_value:
      then:
       - lambda: |-
          id(deep_sleep_1).set_sleep_duration(id(custom_sleep_time).state);

In this example I can publish a new value for deep sleep length.

1 Like