Lambda yaml


I am trying to understand this YAML language .. I am trained in C ++ .... it is explained very badly in esphome

how can i run a script use this lambda?

.state: Retrieve the current state of the binary sensor.

// Within lambda, get the binary sensor state and conditionally do something

if (id(my_binary_sensor).state) {
  // Binary sensor is ON, do something here
} else {
  // Binary sensor is OFF, do something else here
}

You don’t need lambda for that.

There is plenty of documentation, and many examples.

thanks for your help but I don’t find many examples, and if there are examples of user projects with personal reasoning.

the esphome documentation is explained as if any user already knew that language.

It’s a nice project but very badly explained.

If I have to predict a condition in a file if a variable is incremented, I don’t necessarily have to expect a sensor that changes state by inserting on_press etc. functions that are not needed, I want to change the state of the sensor based on other logics but this is not possible or I can’t understand

How about you provide an actual example of what you are trying to?

PS the lambda code is c++