From c755e92ddb11dc2cf314cae2964f036b23f1e402 Mon Sep 17 00:00:00 2001 From: Trip5 Date: Fri, 8 Mar 2024 03:57:44 +0900 Subject: [PATCH] Update weather-display.md Looks like I added to the old 2023.9 branch. Adding here, too! Also, recently discovered 'continue_on_error' which is pretty awesome! --- wiki/weather-display.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/wiki/weather-display.md b/wiki/weather-display.md index 90dc0e07..51ce8962 100644 --- a/wiki/weather-display.md +++ b/wiki/weather-display.md @@ -111,3 +111,27 @@ action: g: 192 b: 192 ``` + +### Add error-checking to sensors which may go offline (note the continue_on_error bit too!) + +``` + - service: esphome.pixelclock_icon_screen + data: + default_font: true + icon_name: >- + weather_{{ states('sensor.openweathermap_condition')|replace("-", + "_") }} + text: > + {% set state = states('sensor.openweathermap_temperature') %} {% if + is_number(state) %} + {{ state|round(1) }}° + {% else %} + {{ "error" }} + {% endif %} + lifetime: 5 + screen_time: 3 + r: 192 + g: 192 + b: 192 + continue_on_error: true +```