Access ESPHome global variable without lambda

Hi guys,

is there a way to access the value of a global variable of ESPHome via YAML instead of using lambda?

I have two global variables

globals:
  - id: totalClick
    type: int
    restore_value: no
  - id: avrPulsePinHelper
    type: bool
    restore_value: no

I would like to get the values using YAML instead of using lambdas.

Thanks for the help!

For what reason?

Do you want access to the global in HA or just within ESPHome?

Only in ESPHome

Why not? :grinning_face_with_smiling_eyes: Now I’m realising this with lambda statements, but it’s just interesting for me to know.
It’s also not only access the value but also change it (with something like globals.totalClick.value: 3)?

No way. From docs:

In some cases you might require to share a global variable across multiple lambdas.

This is made for Lambdas only.

I want to access esphome globals from HA front end. Can this be done? thx

No they can’t. They are internal only.

Well, you could create a template sensor in your ESPhome YAML and expose the global as a value of that sensor.