Help With Utility Meter + Shelly 3EM and 1PM

Shelly 3EM, 1PM and Utility Meter.
Hi Guys I would need help from someone experienced. So I made some configuration and I made a mistake in calculation, and database was filled with wrong data. I was unable to delete data from Utility Meter because reset does not work when there is no tariffs, and I do not want tariffs at the moment. So i deleted whole database, lost all of my last few days but newermind.

Thing is simple, I want from 3EM, and 1PMs to monitor power consumption and save it to database and later on to compare that data with Shelly Cloud:
this is my code, that does not work. I deleted the whole database and 3m got some big data to month and year instantly as I have not deleted data:

sensor:
  - platform: template
    sensors:
        shelly_bojler_filip_total_consumption:
            friendly_name: Total Energy Bojler Filip
            entity_id: sensor.time
            unit_of_measurement: kWh
            value_template: >
                {% set ns = namespace(states=[]) %}
                {% for s in states.sensor %}
                    {% if s.object_id.startswith('shelly1pm_f4cfa2e3ac72') and s.object_id.endswith('energy') %}
                        {% set ns.states = ns.states + [ s.state | float ] %}
                    {% endif %}
                {% endfor %}
                {{ (ns.states | sum) | round(2) }}
        shelly_bojler_mater_total_consumption:
            friendly_name: Total Energy Bojler Mater
            entity_id: sensor.time
            unit_of_measurement: kWh
            value_template: >
                {% set ns = namespace(states=[]) %}
                {% for s in states.sensor %}
                    {% if s.object_id.startswith('shelly1pm_f4cfa2e382a6') and s.object_id.endswith('energy') %}
                        {% set ns.states = ns.states + [ s.state | float ] %}
                    {% endif %}
                {% endfor %}
                {{ (ns.states | sum) | round(2) }}
        shelly_3em_a_total_consumption:
            friendly_name: Total Energy 3EM A
            entity_id: sensor.time
            unit_of_measurement: kWh
            value_template: >
                {% set ns = namespace(states=[]) %}
                {% for s in states.sensor %}
                    {% if s.object_id.startswith('shellyem3_8caab56197c3_channel_a_') and s.object_id.endswith('energy') %}
                        {% set ns.states = ns.states + [ s.state | float ] %}
                    {% endif %}
                {% endfor %}
                {{ (ns.states | sum) | round(2) }}
              
utility_meter:
  daily_energy_bojler_filip:
    source: sensor.shelly_bojler_filip_total_consumption
    cycle: daily
  monthly_energy_bojler_filip:
    source: sensor.shelly_bojler_filip_total_consumption
    cycle: monthly
  yearly_energy_bojler_filip:
    source: sensor.shelly_bojler_filip_total_consumption
    cycle: yearly
  daily_energy_bojler_mater:
    source: sensor.shelly_bojler_mater_total_consumption
    cycle: daily
  monthly_energy_bojler_mater:
    source: sensor.shelly_bojler_mater_total_consumption
    cycle: monthly
  yearly_energy_bojler_mater:
    source: sensor.shelly_bojler_mater_total_consumption
    cycle: yearly
  daily_energy_3em_a:
    source: sensor.shelly_3em_a_total_consumption
    cycle: daily
  monthly_energy_3em_a:
    source: sensor.shelly_3em_a_total_consumption
    cycle: monthly
  yearly_energy_3em_a:
    source: sensor.shelly_3em_a_total_consumption
    cycle: yearly

Anyone using 3EM and has this functioning and would be able to share configuration?