I’m new to the use of ESPHome, but I really like the simplicity.
But is there a way to setup a kind of error-state when connection has been lost?
For example: I’m using a esp-relay to enable/disable some devices when I have a lot of excess solar energy. But if for some reason the connection fails, I would like to switch off these devices…
Hope you are enjoying ESPHome! Maybe this will point you in the right direction.
I like to use substitutions to make this consistent. Friendly name is what we’ll use below.
substitutions:
system_name: mbr-lamp
friendly_name: MBR Lamp Plug
device_description: "Used for lamp, and power management for Bryan's Side of Bed."
# add 'status' under binary sensor section. You likely already have similar section
binary_sensor:
- platform: status
name: "${friendly_name} Status"
This will produce a binary sensory: binary_sensor.mbr_lamp_plug converting the MBR Lamp Plug friendly name.
Then build an automation similar to:
alias: Monitor Lamp
trigger:
- platform: state
entity_id:
- binary_sensor.mbr_lamp_plug
from: 'on'
to: 'off'
# Maybe a for: number of minutes so that it is truly not connected.
action:
- service: notify.<your mobile app>
data:
message: "Warning! Lost connection"
I hope this gets you pointed in the right direction.
You can use conditional card - then you look for state of one entitiy from your module, say wifi signal strength, or relay status… If it will be offline it will report “unavailable” in HA (or unknown, see in developer tools), then you can execute automation, or show some card in this case.