Template power sensor - to energy sensor not working

I have a problem getting template power sensors to the energy dashboard:

- platform: template
# FritzBox
        value_template: '16.8'
        unit_of_measurement: W
        friendly_name: 'Fritzbox Standby W'
        device_class: power
        unique_id: '3423sfsfas34adsadaeaffds'

and the sum as energy:

# FritzBox
  - platform: integration
    source: sensor.fritzbox_current_power
    name: fritzbox_energy
    unit_prefix: k
    round: 2
    unique_id: '3423sfsfas34fds'

The syntax is right, but the energy sensor does not work:

as well the energy dashboard:

The Riemann Sum integration only updates when the source sensor changes state. Your source sensor never changes state.

A triggered template sensor should work (goes in configuration.yaml, not sensors.yaml):

  - unique_id: '3423sfsfas34adsadaeaffds'
      - platform: time_pattern
        minutes: "/3" # every 3 minutes 
      - name: Fritzbox Current Power:
        state: "{{ 16.8 + range(-0.05,0.05)|random }}" 
        unit_of_measurement: W
        device_class: power
        state_class: measurement 

The small random value between 0.05 and -0.05 added every 3 minutes should average to 0 over time and be enough of a state change to allow your Riemann Sum sensor to function.

Ok, I did not know that.
Is threre any other possibility to get an energy sensor?

I solved this way:

value_template: >
        {% if now().minute % 2 == 0 -%}16.7{%- else -%}16.9{%- endif %}

I hope there is a better solution for this?

I just updated my post with a possible solution. Yours should work too.