What’s the easiest way to change the yaml config name and the device name of a device which already runs ESPhome ?
For example : i’ve got a LSC ( Tuya) lamp flash with ESPhome, and the first / initial flash is : action lamp , so the name within de yaml : action_lamp . But because i changed the location of this lamp and want to rename the yaml and the nam to action lamp hal .
When i renamed this device within the standaard / initial yaml everyhing starts okay but when the last step -> flashing it’s there … the name can’t be resolved so the last stap fails .
is there somehting like a work around to solve this ? ( or is the FTDI flash way the way to go? )
Found it!
Here ya go
Changing ESPHome Node Name
Trying to change the name of a node or its address in the network? You can do so with the use_address
option of the WiFi configuration.
Change the device name or address in your YAML to the new value and additionally set use_address
to point to the old address like so:
# Step 1. Changing name from test8266 to kitchen
esphome:
name: kitchen
# ...
wifi:
# ...
use_address: test8266.local
Now upload the updated config to the device. As a second step, you now need to remove the use_address
option from your configuration again so that subsequent uploads will work again (otherwise it will try to upload to the old address).
# Step 2
esphome:
name: kitchen
# ...
wifi:
# ...
# Remove or comment out use_address
# use_address: test8266.local
Cheers!
DeadEnd
This is working fine !
things are really complicated with ESPHome
I know ESPHome has a different approach, but with ESPEasy, you just change the name inside the device…
(At least in recent versions of ESPHome) you could use --device
option with for example the run
command to specify the old name.
So the steps I do to rename a device is:
- mv old-device.yaml new-device.yaml
- Update new-device.yaml with the new name/settings
- Flash the device with the new configuration:
esphome run new-device.yaml --device old-device
Home assistant will apply the new values, to finish the rename you can remove the device from the ESPHome integration old-device
, restart Home Assistant and new-device
should be discovered
A couple of clarifications to this useful bit of advice from @jpoppe . The last cli line did not work for me with SSH, but it does within a console inside the docker container. Secondly, the last bit, old-device
in the CLI command actually needs to be an IP address, if flashing OTA. Then, everything worked great. Details are in the docs.
I succeeded with name changing using this method (on RPi), but had to add the use_address
config under wifi with the actual IP address in step #2 before uploading would work - probably DNS not updating in time. Then # use_address
out and re-load as a new step#3.
After finishing this, ESPHome is still “discovering” the new board for adoption (with the original name allocated by ESPhome web) even after I’ve got the renamed board working within HA/ESPHome.
I’ve deleted associated directories under …/config/esphome and restarted several times, are there other tricks I should try to clear this?
use_address
works for me, but you have to rename twice - once with use_address
and then once without to remove it from the code.
much easier is going to esphome, finding the node → 3 dots → rename.