diff --git a/include/automations/opvaskemaskine.yaml b/include/automations/opvaskemaskine.yaml index 36879ba..c3bc2d7 100644 --- a/include/automations/opvaskemaskine.yaml +++ b/include/automations/opvaskemaskine.yaml @@ -39,9 +39,9 @@ {% set total = namespace(value=0, missing=false) %} {% for offset in range(4) %} {% set target = base + (offset * 3600) %} - {% set match = ns.prices | selectattr('ts', 'eq', target) | list | first %} - {% if match %} - {% set total.value = total.value + (match.price | float(999)) %} + {% set matches = ns.prices | selectattr('ts', 'eq', target) | list %} + {% if matches | count > 0 %} + {% set total.value = total.value + (matches[0].price | float(999)) %} {% else %} {% set total.missing = true %} {% endif %}