Update imap_email_content template sensor examples (#20054)

This commit is contained in:
SNoof85 2021-10-30 16:52:41 +02:00 committed by GitHub
parent 91460bf92c
commit 6a4497cfb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -121,27 +121,23 @@ Below is the template sensor which extracts the information from the body of the
{% raw %} {% raw %}
```yaml ```yaml
sensor: template:
- platform: template - sensor:
sensors: - name: "Previous Day Energy Use"
previous_day_energy_use: unit_of_measurement: "kWh"
friendly_name: Previous Day Energy Use state: >
unit_of_measurement: kWh
value_template: >
{{ state_attr('sensor.energy_email','body') {{ state_attr('sensor.energy_email','body')
|regex_findall_index("\*Yesterday's Energy Use:\* ([0-9]+) kWh") }} | regex_findall_index("\*Yesterday's Energy Use:\* ([0-9]+) kWh") }}
previous_day_cost: - name: "Previous Day Cost"
friendly_name: Previous Day Cost unit_of_measurement: "$"
unit_of_measurement: $ state: >
value_template: >
{{ state_attr('sensor.energy_email', 'body') {{ state_attr('sensor.energy_email', 'body')
|regex_findall_index("\*Yesterday's estimated energy cost:\* \$([0-9.]+)") }} | regex_findall_index("\*Yesterday's estimated energy cost:\* \$([0-9.]+)") }}
billing_cycle_total: - name: "Billing Cycle Total"
friendly_name: Billing Cycle Total unit_of_measurement: "$"
unit_of_measurement: $ state: >
value_template: >
{{ state_attr('sensor.energy_email', 'body') {{ state_attr('sensor.energy_email', 'body')
|regex_findall_index("\ days:\* \$([0-9.]+)") }} | regex_findall_index("\ days:\* \$([0-9.]+)") }}
``` ```
{% endraw %} {% endraw %}