Turn on error led on error conditions from dallas, modbus etc

Hi
I’m looking for a solution to switch on a LED with ESPHOME in case of some error conditions:

  • dallas sensor is offline
  • MODBUS communication failed

Any idea how that can be done? I know the status_led, but this is limited to WLAN and API connection I guess.

Thanks,
Regards,
Mike

You can automate control of your LED in ESPHome. Have a read of this:

1 Like

I know this and I also know how to handle LED. But I do not know how I can catch specific errors like if I lost connection to modbus device or when dallas sensor is disnconnected. The only idea I have is to check if there is no value for a longer time.

For dallas sensor can create binary_sensor firing on receiving NAN.

sensor:
  - platform: <whatever>
    id: XXX
    ...

binary_sensor:
  - platform: template
    id: ZZZ
    lamdba: return !id(XXX).has_state() || (id(XXX).state == NAN);
    on_press:
      - <here can start script for LED blinking etc.>
    on_release:
      - <stop previously started script>

You can operate status_led as ordinary light - limitation is no brightness, only ON/OFF.

1 Like