Influxdb component and total daily energy

Hello, I have a solar installation with several acs712 sensors to monitor the energy.
I get W and KWh, I use hassio so I have installed the influxdb addon and everything is correct.

My problem comes when I try to add the data in the HA component, to make the sensors 24h, weekly, monthly, yearly.

Data is added but the results are not correct, my configuration is this:

  • platform: influxdb
    host: localhost
    username: homeassistant
    password: homeassistant
    queries:

    • name: Produccion Mes
      value_template: ‘{{ value | round(3) }}’
      where: ‘“entity_id” = ‘‘potencia_placa’’ and time > now() - 30d’
      group_function: integral
      measurement: ‘“W”’
      database: homeassistant
      field: value
  • platform: influxdb
    host: localhost
    username: homeassistant
    password: homeassistant
    queries:

    • name: Produccion 24h
      value_template: ‘{{ value | round(3) }}’
      where: ‘“entity_id” = ‘‘potencia_placa’’ and time > now() - 1d’
      group_function: integral
      measurement: ‘“W”’
      database: homeassistant
      field: value
  • platform: influxdb
    host: localhost
    username: homeassistant
    password: homeassistant
    queries:

    • name: Produccion 7d
      value_template: ‘{{ value | round(3) }}’
      where: ‘“entity_id” = ‘‘potencia_placa’’ and time > now() - 7d’
      group_function: integral
      measurement: ‘“W”’
      database: homeassistant
      field: value

I would appreciate any help. Thanks