Adjusted Energy Meter

Hello guys,
I am sorry in case this has been discussed here already, but I have not a suitable solution anywhere here or elsewhere.

I have Shelly 3EM monitoring my 3 phases in Ground Floor Flat.
Then I have couple of Fibaro Smartplugs, Shelly PMs etc…

When I configure my energy dashboard to add individual devices I would like to add all independent devices, such as PM minis, smarplugs… and then for the “untracked energy” use the diff between 3EM and the individual items, as if I would just add everything, the individually monitored devices will be counted twice, once on its own and then as a part of 3EM measurements.

therefore I thought I would create custom sensor as below

# Totals adjusted
    energy_ground_floor_total_adjusted:
      unique_id: energy_ground_floor_total_adjusted
      friendly_name: Energy Ground Floor Total Adjusted
      icon_template: mdi:flash
      value_template: >-
        {% set ground_floor = states('sensor.shellypro3em_2cbcbba5bc6c_total_active_energy')|float %}
        {% set living_room_lamp = states('sensor.living_room_living_room_lamp_174_energy')|float %}
        {% set office_lamp = states('sensor.office_office_lamp_172_energy')|float %}
        {{ (ground_floor - living_room_lamp - office_lamp) }}
      unit_of_measurement: "kWh"

I have also created custom sensor for 3EM only - purely for compartment

 energy_ground_floor_total:
      unique_id: energy_ground_floor_total
      friendly_name: Energy Ground Floor Total
      icon_template: mdi:flash
      value_template: >-
        {{ (states('sensor.shellypro3em_2cbcbba5bc6c_total_active_energy')|float) }}
      unit_of_measurement: "kWh"

and 2 utility meters

energy_daily_ground_floor_total:
  source: sensor.energy_ground_floor_total
  cycle: daily
  unique_id: energy_daily_ground_floor_total
  name: Energy Daily Ground Floor Total

energy_daily_ground_floor_total_template_adjusted:
  source: sensor.energy_ground_floor_total_adjusted
  cycle: daily
  unique_id: energy_daily_ground_floor_total_template_adjusted
  name: Energy Daily Ground Floor Total Adjusted

when I look at the individual sensors
sensor.energy_ground_floor_total
and
sensor.energy_ground_floor_total_adjusted

the adjusted correctly showing the total value lowered by the sum value of individual devices

however, both utility meters showing the same value, and that is the value of the non-adjusted sensor.

any chance you could help me out, or point me the right direction what I might be doing wrong here?

Thanks in advance.
J