I have a miflora sensor setup and working via esphome and I’m wanting to reference the values captured (temperature, moisture etc) within esphome itself to output to a display which I have connected and working to the esp32 I’m using but I can’t work out how to reference the attributes within the printf command.
It’s an SSD1306 but I have the display working great it’s just referencing the miflora attributes I can’t work out.
Using the display component you use the formatted text where you can specify an id of the sensor you want to include but the miflora sensor only had 1 ID assigned to the sensor but 4 attributes (temperature, moisture, illuminance, conductivity).
Quite an important aspect of ESPHome are “IDs”. They are used to connect components from different domains. For example, you define an output component together with an ID and then later specify that same ID in the light component. IDs should always be unique within a configuration and ESPHome will warn you if you try to use the same ID twice.
Because ESPHome converts your configuration into C++ code and the IDs are in reality just C++ variable names, they must also adhere to C++’s naming conventions. C++ Variable names …
… must start with a letter and can end with numbers.
… must not have a space in the name.
… can not have special characters except the underscore (“_“).
… must not be a keyword.
…but the search on esphome.io is really everything else than great. First thing when searching id is CAN bus (but to be fair the second results leads to this quote )
Well, I never thought about that actually. But when something can have a name I always think it also can have an id (Actually now I think it needs at least nameorid )