Not used to looking at states in that format, but it looks like the results attribute actually contains a list. Also the values of electricity1 and electricity2 look like string representations of floats. So maybe:
value_template: >
{% set d = state_attr('sensor.lastday_consumption', 'results')[0] %}
{{ d.electricity1|float + d.electricity2|float }}
New feature in Home Assistant that makes YAML the consistent way to specify options throughout the product.
Ironically, it makes it more challenging (for me) to identify data structures for developing templates. In comparison to JSON, my eyes can’t (yet) quickly discern lists and dictionaries when expressed as YAML.