data:
- subject: You're now paying a higher rate - ways to save
received: 2024-01-04T23:36:05+0000
to:
- daniel@xxxxxx
cc: []
sender: [email protected]
has_attachments: false
importance: normal
is_read: false
body: >-
You've reached Step 2 ratesRead this email onlineDear Daniel,Account
number: XXXXXXXXXX92You've reached Step 2 pricing on January 04, 2024,
I want a true|false template based on a string in the subject:
{{ 'now paying a higher rate' in state_attr('sensor.bc_hydro_step_2','data') }}
{{ 'your bill is ready' in state_attr('sensor.bc_hydro_step_2','data') }}
{{ state_attr('sensor.bc_hydro_step_2','data') }}
Thanks! That looks like it’ll work.
I magaed to come up with the following based on an example from RogerSelwyn (Office 365 Integration).
He suggested I start with this:
- sensor:
- name: environment_heatloss
unique_id: environment_heatloss
unit_of_measurement: "%"
state: >-
{% for insight in state_attr('binary_sensor.homelink_environment', 'insights') if insight.type == "HEATLOSS" -%}
{{ insight.value }}
{% endfor %}
and I arrived at this which works:
{% for array in state_attr('sensor.bc_hydro_e_mail', 'data') if array.subject == "You're now paying a higher rate - ways to save"-%}
True
{% else %}
False
{% endfor %}