Lambda function in ESPHome for displays. What is this "it" object?

Is there any full documentation on Lambda functions for displays in ESPhome?
On this page on official site there are scattered little bits of useful things like:

it.line(0, 0, 50, 50);
it.rectangle(50, 60, 30, 42);
it.filled_circle(25, 25, 10);

But is there any full documentation on functions of this “it.” object? Like, can I rotate one line of text to 45°? Or any other object? Or scale image? Or anything else?

I totally understand that I can use C++ syntax for if/else, loops and other stuff… But what is this “it.” object?

it is the display object. See Display Component — ESPHome

1 Like

Ok, it understandable. But is it object from some library? Is there anywhere full list of methods/functions of this object?

I think that is what the API link at the bottom does.

1 Like

‘it’ is an object (display buffer, basically) defined within ESPHome and passed to the YAML-macro’s lambda on each callback.
If you let ESPHome manage the display (and you should), then all display actions should go through ‘it.’

1 Like

It’s an esphome::display::DisplayBuffer object, and you can find its definition in this header file:

And here’s the API documentation (linked as “API Reference” at the bottom of the page that @nickrout referred to):

1 Like

Thank you to everyone! Yes, I missed ESPHome API page entirely.
Now I can see everything. But, how I understand, there are no way to rotate text 45°, or do any other non-basic stuff.

Looks like only workaround would be, is to generate everything as image in other place (e.g. Home Assistant) and display this image on the ESP32 screen

If you are wanting graphics on an esp, openhasp is very good (although I don’t know if it does the 45 deg thing)

Sorry to be late to the party…

I think the main problem with the ESPHome docs is the search function. You have know everything before you can use it.

Nick, you said

it is the display object. See Display Component — ESPHome

But how did you know that?

I went to that page and found this:

Display lambdas are additionally passed a variable called it which represents the rendering engine object.

I then went to the search box and failed to find out anything about a variable called “it”.

If you learn (like me) by looking at source code, and you find the statement it.print(blah) , then you try to find the whereabouts of the it object. Only by googling did I find this article which led me to your link, referencing a variable, rather than an object.

It’s certainly a challenge.