I’m not sure what you are trying to achieve… You can add the sensor name to the log output using lambda logging, but since you need to refer to the id of the component why bother? Just hard code the name using tag:.
ESP_LOGD(id(sensor_id).name , "formatted message of some kind using C++ syntax");
I’m hoping to get this automated, resolving the name of the current scope, without giving it by hand. So to get something like ‘id(this).name’.
Assume there are many of copies of initial example:
- platform: copy
name: "other"
So the log would print ‘name: something’ for the initial example and ‘name: other’ for this one.
Or do I expect too much from this? No questions then.