I have a created a template sensor to compute "end user electricity price"... but the logic must be applied to
- the "value" of the sensor
- and all entries in "data" attributes.
So i created a macro :
{%- macro macro_get_net_price_eur_per_kwh(timestamp_ref, market_price_eur_per_kwh) -%}
and the first thing i would like to do is check input values . ( timestamp_ref between 2021 and < 2099..... price between 0 and 1 )
It is done, .... but the qquestion is what should the macro return in case of invalid input?
Let's say input price = 18.
Should i return the string "Nan", or "unknown" or .... ?
Thx