Why is the night power negative?

In the netherlands we have two power consumming day and night. WHy is the powerconsuming negative at night?

Your energy sensors are not set up correctly.

Could you explaine that?
I have the following configuration:

Must the second tarief under the first?

What do the history graphs look like for those sensors?

The look normaal and positive values

That’s one during the day time - what do both look like over 24 hours?

Both are. Positve values


Possibly one of the other energy sensors is going negative (discharging to grid) at night - check them all over 24hours

That is not the case


Can you show your full energy dashboard configuration.

The config is this

{
  "version": "2026.7.0",
  "info": {
    "cost_sensors": {},
    "solar_forecast_domains": []
  },
  "preferences": {
    "energy_sources": [
      {
        "type": "gas",
        "stat_energy_from": "sensor.gas_meter_gasverbruik",
        "stat_cost": null,
        "entity_energy_price": null,
        "number_energy_price": null
      },
      {
        "type": "solar",
        "stat_energy_from": "sensor.envoy_122328031166_lifetime_energy_production",
        "config_entry_solar_forecast": null,
        "stat_rate": "sensor.envoy_122328031166_current_power_production"
      },
      {
        "type": "grid",
        "stat_energy_from": "sensor.electricity_meter_energieproductie_tarief_1",
        "stat_energy_to": "sensor.electricity_meter_energieverbruik_tarief_1",
        "stat_cost": null,
        "stat_compensation": null,
        "entity_energy_price": null,
        "number_energy_price": null,
        "entity_energy_price_export": null,
        "number_energy_price_export": null,
        "cost_adjustment_day": 0
      },
      {
        "type": "grid",
        "stat_energy_from": "sensor.electricity_meter_energieproductie_tarief_2",
        "stat_energy_to": "sensor.electricity_meter_energieverbruik_tarief_2",
        "stat_cost": null,
        "stat_compensation": null,
        "entity_energy_price": null,
        "number_energy_price": null,
        "entity_energy_price_export": null,
        "number_energy_price_export": null,
        "cost_adjustment_day": 0
      }
    ],
    "device_consumption": [],
    "device_consumption_water": []
  },
  "metadata": {
    "sensor.electricity_meter_energieverbruik_tarief_1": {
      "statistic_id": "sensor.electricity_meter_energieverbruik_tarief_1",
      "display_unit_of_measurement": "kWh",
      "has_mean": false,
      "mean_type": 0,
      "has_sum": true,
      "name": null,
      "source": "recorder",
      "statistics_unit_of_measurement": "kWh",
      "unit_class": "energy"
    },
    "sensor.electricity_meter_energieproductie_tarief_1": {
      "statistic_id": "sensor.electricity_meter_energieproductie_tarief_1",
      "display_unit_of_measurement": "kWh",
      "has_mean": false,
      "mean_type": 0,
      "has_sum": true,
      "name": null,
      "source": "recorder",
      "statistics_unit_of_measurement": "kWh",
      "unit_class": "energy"
    },
    "sensor.electricity_meter_energieproductie_tarief_2": {
      "statistic_id": "sensor.electricity_meter_energieproductie_tarief_2",
      "display_unit_of_measurement": "kWh",
      "has_mean": false,
      "mean_type": 0,
      "has_sum": true,
      "name": null,
      "source": "recorder",
      "statistics_unit_of_measurement": "kWh",
      "unit_class": "energy"
    },
    "sensor.envoy_122328031166_lifetime_energy_production": {
      "statistic_id": "sensor.envoy_122328031166_lifetime_energy_production",
      "display_unit_of_measurement": "MWh",
      "has_mean": false,
      "mean_type": 0,
      "has_sum": true,
      "name": null,
      "source": "recorder",
      "statistics_unit_of_measurement": "MWh",
      "unit_class": "energy"
    },
    "sensor.gas_meter_gasverbruik": {
      "statistic_id": "sensor.gas_meter_gasverbruik",
      "display_unit_of_measurement": "m³",
      "has_mean": false,
      "mean_type": 0,
      "has_sum": true,
      "name": null,
      "source": "recorder",
      "statistics_unit_of_measurement": "m³",
      "unit_class": "volume"
    },
    "sensor.electricity_meter_energieverbruik_tarief_2": {
      "statistic_id": "sensor.electricity_meter_energieverbruik_tarief_2",
      "display_unit_of_measurement": "kWh",
      "has_mean": false,
      "mean_type": 0,
      "has_sum": true,
      "name": null,
      "source": "recorder",
      "statistics_unit_of_measurement": "kWh",
      "unit_class": "energy"
    }
  },
  "entities": {
    "sensor.electricity_meter_energieverbruik_tarief_1": {
      "entity_id": "sensor.electricity_meter_energieverbruik_tarief_1",
      "device_id": "e260db391e3f155a4f4fd14705268079",
      "labels": [],
      "translation_key": "electricity_used_tariff_1",
      "platform": "dsmr",
      "has_entity_name": true,
      "name": "Energieverbruik (tarief 1)",
      "display_precision": 2
    },
    "sensor.electricity_meter_energieproductie_tarief_1": {
      "entity_id": "sensor.electricity_meter_energieproductie_tarief_1",
      "device_id": "e260db391e3f155a4f4fd14705268079",
      "labels": [],
      "translation_key": "electricity_delivered_tariff_1",
      "platform": "dsmr",
      "has_entity_name": true,
      "name": "Energieproductie (tarief 1)",
      "display_precision": 2
    },
    "sensor.electricity_meter_energieproductie_tarief_2": {
      "entity_id": "sensor.electricity_meter_energieproductie_tarief_2",
      "device_id": "e260db391e3f155a4f4fd14705268079",
      "labels": [],
      "translation_key": "electricity_delivered_tariff_2",
      "platform": "dsmr",
      "has_entity_name": true,
      "name": "Energieproductie (tarief 2)",
      "display_precision": 2
    },
    "sensor.envoy_122328031166_lifetime_energy_production": {
      "entity_id": "sensor.envoy_122328031166_lifetime_energy_production",
      "device_id": "83d2284cd3614f86c739ab675ff7b889",
      "labels": [],
      "translation_key": "lifetime_production",
      "platform": "enphase_envoy",
      "has_entity_name": true,
      "name": "Lifetime energy production",
      "display_precision": 3
    },
    "sensor.gas_meter_gasverbruik": {
      "entity_id": "sensor.gas_meter_gasverbruik",
      "device_id": "57847a2bf1ee7b92c2d78dc5ea28fe2f",
      "labels": [],
      "translation_key": "gas_meter_reading",
      "platform": "dsmr",
      "has_entity_name": true,
      "name": "Gasverbruik",
      "display_precision": 2
    },
    "sensor.electricity_meter_energieverbruik_tarief_2": {
      "entity_id": "sensor.electricity_meter_energieverbruik_tarief_2",
      "device_id": "e260db391e3f155a4f4fd14705268079",
      "labels": [],
      "translation_key": "electricity_used_tariff_2",
      "platform": "dsmr",
      "has_entity_name": true,
      "name": "Energieverbruik (tarief 2)",
      "display_precision": 2
    }
  },
  "states": {
    "sensor.electricity_meter_energieverbruik_tarief_1": {
      "entity_id": "sensor.electricity_meter_energieverbruik_tarief_1",
      "state": "18963.54",
      "attributes": {
        "state_class": "total_increasing",
        "unit_of_measurement": "kWh",
        "device_class": "energy",
        "friendly_name": "Electricity Meter Energieverbruik (tarief 1)"
      },
      "context": {
        "id": "01KWP9VVP9FZDKSRW7ABFMQHQ0",
        "parent_id": null,
        "user_id": null
      },
      "last_changed": "2026-07-04T10:12:55.625Z",
      "last_updated": "2026-07-04T10:12:55.625Z"
    },
    "sensor.electricity_meter_energieproductie_tarief_1": {
      "entity_id": "sensor.electricity_meter_energieproductie_tarief_1",
      "state": "316.971",
      "attributes": {
        "state_class": "total_increasing",
        "unit_of_measurement": "kWh",
        "device_class": "energy",
        "friendly_name": "Electricity Meter Energieproductie (tarief 1)"
      },
      "context": {
        "id": "01KWPADRYKQZFBVJNZ09C4SZPE",
        "parent_id": null,
        "user_id": null
      },
      "last_changed": "2026-07-04T10:22:42.643Z",
      "last_updated": "2026-07-04T10:22:42.643Z"
    },
    "sensor.electricity_meter_energieproductie_tarief_2": {
      "entity_id": "sensor.electricity_meter_energieproductie_tarief_2",
      "state": "694.869",
      "attributes": {
        "state_class": "total_increasing",
        "unit_of_measurement": "kWh",
        "device_class": "energy",
        "friendly_name": "Electricity Meter Energieproductie (tarief 2)"
      },
      "context": {
        "id": "01KWMJKJ2NTN0CKFKRK2B06EXY",
        "parent_id": null,
        "user_id": null
      },
      "last_changed": "2026-07-03T18:07:11.957Z",
      "last_updated": "2026-07-03T18:07:11.957Z"
    },
    "sensor.envoy_122328031166_lifetime_energy_production": {
      "entity_id": "sensor.envoy_122328031166_lifetime_energy_production",
      "state": "1.186971",
      "attributes": {
        "state_class": "total_increasing",
        "unit_of_measurement": "MWh",
        "device_class": "energy",
        "friendly_name": "Envoy 122328031166 Lifetime energy production"
      },
      "context": {
        "id": "01KWPABWTBYFC65S567J5JSGYD",
        "parent_id": null,
        "user_id": null
      },
      "last_changed": "2026-07-04T10:21:41.067Z",
      "last_updated": "2026-07-04T10:21:41.067Z"
    },
    "sensor.gas_meter_gasverbruik": {
      "entity_id": "sensor.gas_meter_gasverbruik",
      "state": "8251.723",
      "attributes": {
        "state_class": "total_increasing",
        "unit_of_measurement": "m³",
        "device_class": "gas",
        "friendly_name": "Gas Meter Gasverbruik"
      },
      "context": {
        "id": "01KWP8STV26511W1JWEBQ8YJAM",
        "parent_id": null,
        "user_id": null
      },
      "last_changed": "2026-07-04T09:54:20.642Z",
      "last_updated": "2026-07-04T09:54:20.642Z"
    },
    "sensor.electricity_meter_energieverbruik_tarief_2": {
      "entity_id": "sensor.electricity_meter_energieverbruik_tarief_2",
      "state": "15933.714",
      "attributes": {
        "state_class": "total_increasing",
        "unit_of_measurement": "kWh",
        "device_class": "energy",
        "friendly_name": "Electricity Meter Energieverbruik (tarief 2)"
      },
      "context": {
        "id": "01KWMNJSV70B4AA103SAMA9EYV",
        "parent_id": null,
        "user_id": null
      },
      "last_changed": "2026-07-03T18:59:12.871Z",
      "last_updated": "2026-07-03T18:59:12.871Z"
    }
  },
  "issues": {
    "energy_sources": [
      [],
      [],
      [],
      []
    ],
    "device_consumption": [],
    "device_consumption_water": []
  }
}

Both of these:

        "type": "grid",
        "stat_energy_from": "sensor.electricity_meter_energieproductie_tarief_1",
        "stat_energy_to": "sensor.electricity_meter_energieverbruik_tarief_1",

Should be in the from_grid section.

The to_grid section is only for an export sensor.

Add the two sensors using this:

Make sure each one goes here:

Buth both have the same "imported from grid":