Can ESPHome send a notification to HA?

Hiii

In this example lambda:

on_value:
  - lambda: |-
      if (temperature >= 30) {
            send notify to HA or Companion App
      } 

Can ESPHome send a notification DIRECTLY to home assistant or on the App?

If yes… how do I do it?

P.S. I consider creating a sensor in ESPHome to be managed via trigger in HA as a last resort…

# In some trigger
on_...:
  # Simple
  - homeassistant.action:
      action: notify.html5
      data:
        message: Button was pressed

If you actually mean “send a notification through HA”, see above.

If you measn “send an event to HA”, see

Thanks for your interest.
I had already seen the page you suggested but I didn’t understand much…

# In some trigger
on_...:
  # Simple
  - homeassistant.action:
      action: notify.html5
      data:
        message: Button was pressed

in particular… which button was pressed?
What is the relationship between the pressed button and the proposed code?

None, it’s just the message you send when the action is triggered, could also be:

# In some trigger
on_...:
  # Simple
  - homeassistant.action:
      action: notify.html5
      data:
        message: Some horse shit fell from the sky
1 Like

OK… since it communicated that a button was pressed…
The question then changes: which action in ESPHome is triggered?
In my lambda, the temperature is over 30°. How can notify me?

Luckily I had an umbrella!!

      on_value_range:
        - above: 30.0
          then:

Maybe I’m starting to understand…
I have to confess that maybe my very simplified example is not suitable for the cause.
The message must be sent when the variable (which has nothing to do with the measured sensor)
error = 5
But I understand that you can’t send a notification from inside a lambda…

It’s esphome so sure you can do that. For example you could pack the action (notify) into a script and start/execute this from lambda :hammer_and_wrench:

Thanks for the tip!!

2 Likes

LGTM :+1:

Post must be at least 10 characters