Display the current French Toast Alert in your Home Assistant instance.
Merge the contents of configuration.yaml
into your config. These shouldn't require a full home assistant restart, just a quick reload.
Display the current French Toast Alert in your Home Assistant instance.
Merge the contents of configuration.yaml
into your config. These shouldn't require a full home assistant restart, just a quick reload.
sensor: | |
# REST sensor for the raw french toast data. processed by a template sensor below. | |
- platform: rest | |
value_template: "OK" | |
resource: "https://www.universalhub.com/toast.xml" | |
name: "french toast raw status" | |
json_attributes_path: "$.frenchtoast" | |
json_attributes: | |
- status | |
template: | |
# the actual sensor that you want to use in your dashboards, automations, etc. | |
# `icon_color` is an undocumented hack to have the state color set correctly in lovelace. | |
# I'm using CSS vars here so if you want to use that attribute for light colors, | |
# discord webhook color, etc, then you'll want to make those raw values. | |
- sensor: | |
- name: "French Toast Alert" | |
state: "{{ state_attr('sensor.french_toast_raw_status', 'status') | regex_findall(find='^\\d') | first }}" | |
attributes: | |
state_text: "{{ state_attr('sensor.french_toast_raw_status', 'status') | regex_findall(find='- (\\w+)$') | first }}" | |
icon_color: > | |
{% if this.state == "1" %} | |
var(--green-color) | |
{% elif this.state == "2" %} | |
var(--blue-color) | |
{% elif this.state == "3" %} | |
var(--yellow-color) | |
{% elif this.state == "4" %} | |
var(--orange-color) | |
{% elif this.state == "5" %} | |
var(--red-color) | |
{% else %} | |
magenta | |
{% endif %} | |
state_class: "measurement" | |
unit_of_measurement: "slices" | |
icon: mdi:bread-slice |