Skip to content

Commit

Permalink
Update weather-display.md
Browse files Browse the repository at this point in the history
I had some real trouble today when some sensors went offline... here's how to error-check in Home Assistant!
  • Loading branch information
trip5 authored Feb 25, 2024
1 parent 16b4fe0 commit 96a02cc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions wiki/weather-display.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,15 @@ action:
g: 192
b: 192
```
### How to add error-checking to sensors which may go offline (and cause the script to abort)
```
text: >
{% set state = states('sensor.openweathermap_temperature') %} {% if
is_number(state) %}
{{ state|round(1) }}°
{% else %}
{{ "error" }}
{% endif %}
```

0 comments on commit 96a02cc

Please sign in to comment.