Fallback values on error?

Hi all, I’ve got two scenarios where fallback or placeholder values would come in handy:

  • a surveillance camera (platform: ffmpeg) that is only turned on manually from time to time;
  • an external (public) REST API that sometimes returns empty payloads.

If the camera is off, HA obviously returns an error and displays a broken image. This is expected behaviour, of course, but it would be so much nicer to display a placeholder image (PNG that says “camera is off” or sth.) instead. Is this possible somehow (maybe using AppDaemon)?

Also, the REST API on some requests returns a payload without the expected value (it’s a public API, I cannot change it). I parse the JSON response in a value_template and extract my value from a bigger object - yet if it’s not there, HA displays an empty value (or whatever I return). I would rather HA displays the former/current value instead. Is the current value available in a value_template or in AppDaemon?

I admit these are edge cases, but the GUI looks broken if one of those errors occurs. Any ideas or hints?

Best regards
Mattsches

Did you find a solution to this?

Sorry, I don’t remember if I found a solution - probably not. I’m not using the camera and the API anymore, my setup has changed.

Thanks for getting back to me :slight_smile: