I have an entity with a state “off” and current attributes:
The attribute I’m interested in shows:
If I enter
{{ state_attr('binary_sensor.octopus_energy_target_intermittent_best_rates_total_4_hours','next_time') }}
in the template editor I get
null
If I enter exactly the same a second time, so:
{{state_attr('binary_sensor.octopus_energy_target_intermittent_best_rates_total_4_hours','next_time') }}
{{state_attr('binary_sensor.octopus_energy_target_intermittent_best_rates_total_4_hours','next_time') }}
I get
None
None
Why does the state_attr change from “null” to “None” when I enter the same thing twice?
Also, if I enter:
{{ is_state_attr('binary_sensor.octopus_energy_target_intermittent_best_rates_total_4_hours','next_time','null') }}
or
{{ is_state_attr('binary_sensor.octopus_energy_target_intermittent_best_rates_total_4_hours','next_time','None') }}
I get “false”
Trying to figure out how to bypass this line:
{{as_timestamp(state_attr('binary_sensor.octopus_energy_target_intermittent_best_rates_total_4_hours','next_time'))|timestamp_custom ('%H:%M %p') }}
in a template when the result renders “None” due to the “null” state of the attribute.