DSMR return tariff not in graph

Hi All,

I am using HA (docker 2022.6.1), and I am wondering if there is a misconfiguration or something else not right because I never see negative values for returned Kwh to the grid in the dashboard, while the sensor does show increasing values.

I am getting P1 values via a API, but these all seem to be OK on each own.
From the sensors I have ret_low and ret_high (these are from P1 measurement via rest):

- resource: http://192.168.1.9/ha/p1_file.json
  scan_interval: 60
  sensor:
    - name: low
      value_template: '{{ value_json.p1.low }}'
      device_class: energy
      state_class: total_increasing
      unit_of_measurement: "Wh"
    - name: high
      value_template: '{{ value_json.p1.high }}'
      device_class: energy
      state_class: total_increasing
      unit_of_measurement: "Wh"
    - name: ret_low
      value_template: '{{ value_json.p1.ret_low }}'
      device_class: energy
      state_class: total_increasing
      unit_of_measurement: "Wh"
    - name: ret_high
      value_template: '{{ value_json.p1.ret_high }}'
      device_class: energy
      state_class: total_increasing
      unit_of_measurement: "Wh"
    - name: gas
      value_template: '{{ value_json.p1.gas }}'
      device_class: gas
      state_class: total_increasing
      unit_of_measurement: "m³"

the http query for completeness returns:

$ curl http://192.168.1.9/ha/p1_file.json -s | jq
{
  "p1": {
    "gas": 5549.684,
    "low": 6681488,
    "high": 6324224,
    "ret_low": 917.399,
    "ret_high": 2379.53
  }
}

For example on the 28th of May, I did return energy to the grid, but it does not seem to be shown in the dashboard, see below screenshots:


My dashboard configuration for energy:

What could be wrong in my setup?
Could it be the decimal in the value?

It looks like the returned values are only about 5 Whs, whereas the rest is in the kWhs, that probably just gets rounded down by the dashboard stats. You can actually see in the ‘Self Consumed’ graph that it’s not 100%

Thanks for the answer.
I have just adjusted the generation of the data as there was a difference of kWh versus Wh between consumption/generation. I missed a *1000 in my script for the return tariff variable.

That all now returns the same Wh:

$ curl http://192.168.1.9/ha/p1_file.json -s | jq
{
  "p1": {
    "gas": 5549.684,
    "low": 6681568,
    "high": 6324224,
    "ret_low": 917399,
    "ret_high": 2379530
  }
}

Let’ see if that improves, as this was no accurate data.

It’s a bit hard to see in the graph, but it looks like it is now working correctly.
For the first time I do see a negative value in the graph. Unfortunately there’s not that much sun today :slight_smile:

1 Like