Here is the naming strategy I developed over the years of using various smart switches. There are others but this one ended up being the more stable and future-proof.
Each of the plugs or strip I have gets a serial number. I write it directly on the plug with a sharpie. Why? Because there is no eye-readable serial number on the plugs, something that could identify a plug when having it in hand.
I then flash the plug and retrieve the ID. Both of these information go to the configuration file:
meross:
- name: meross01
id: 2006176333738751801348e1e91fb91a
channels: 1
- name: meross02
id: 2005281078830290814148e1e91d807b
channels: 6
(...)
With this, when I see a plug in a box, or if I want to move it from one place to another one, I know how it i addressed in HA. At some point I used a name related to the place it was (such as room_michael_on_the_right_next_to_the_blue_table :)) but then I moved it somewhere else and it was a mess.
Now back to HA, Configuration → Devices
shows meross01
and meross02
:
Ah, meross01
is not visible? This is normal: it means that the plug physically exists (it is in the configuration), but is not plugged in (if you look at the diagram in my README you will see that there is a function that periodically checks if a configured plug is actually live, and removes it from HA when it is not. Once it is plugged back it reappears with the same name).
This is the device. Each device has entities. The entities, in practical terms for a plug , correspond to the device the plug manages (a lamp, …). I will take the example of meross02
(which is a strip, with multiple sockets):
Here the socket 3 and 4 are used, and I renamed the entity to give it a relevant name. I did that by clicking on the entity and changing the name, and the switch name. This way I can use them in the lovelace configuration by a name I can make sense of. The other advantage is that HA will not allow for a duplicate name.
So what happens when I move a plug?
- unplug it
- plug it back in the new place
- make sure it is back online (the check is every minute)
- in the UI go to the name of the plug (
meross02
)
- change the name of the entity that has a plug plugged in (
meross02_3 → arbre
and switch.meross02_3 → switch.arbre
- as an example)
- modify lovelace if needed (though if you changed the name of the entity, it is logical that you want to change it in lovelace as well)
You could of course skip the renaming of the entity, and then use in your configuration names such as meross02_1
(or sp1_0
in your case) but I found it bothersome to glance everywhere all the time to remember what is actually plugged to switch.meross02_1
(as opposed to switch.livingroom_lamp_white_right
)
Let me know if this is not clear.