psvanstrom / esphome-p1reader

ESPHome custom component for reading P1 data from electricity meters.
MIT License
267 stars 116 forks source link

Sensor does not appear in new (2021.8) Energy dashboard? #12

Closed fredrikbaberg closed 3 years ago

fredrikbaberg commented 3 years ago

I'm unable to find the sensor in the Energy tab.

I'm referred to: https://www.home-assistant.io/more-info/statistics/.

Another implementation is referenced in the release notes, https://github.com/zuidwijk/dsmr, but I have not tried that as I haven't verified if the pin mapping is the same.

fredrikbaberg commented 3 years ago

I've done some experimentation based on ESPHome documentation and the dsmr repository. I'm still waiting for data to be visible in the Energy panel (can take up to 2 hours), but adding the following to Cumulative Active Import at least allows it to be added:

state_class: "measurement"
device_class: "energy"
last_reset_type: "never"
Emlben commented 3 years ago

I have the same issue. Was told to add, in addition to device class and state, this : last_reset; "1970-01-01T00:00:00+00:00"

Same state, can add the cumulative active import but no data is showing.

fredrikbaberg commented 3 years ago

I have the same issue. Was told to add, in addition to device class and state, this : last_reset; "1970-01-01T00:00:00+00:00"

Same state, can add the cumulative active import but no data is showing.

I read that last_reset_type: "never" should set last_reset to epoch, so it should lead to the same result. There is now a pull request that allows the sensor to be added.

grobius commented 3 years ago

I must be doing something wrong. Keep getting this error regardless of how I format the yaml

  [state_class] is an invalid option for [0]. Did you mean [state_topic], [device_class]?
  state_class: measurement [source p1reader.yaml:74]
  device_class: energy

  [last_reset_type] is an invalid option for [0]. Please check the indentation.
  last_reset_type: never [source p1reader.yaml:76]
fredrikbaberg commented 3 years ago

@grobius have you formatted the lines in the same way as the pull request I've linked to this issue? It seems to complain about indentation.

grobius commented 3 years ago

Yes, I did copy it from the pullrequest. I can't see that there is something wrong with it (but it's probably me):

  sensors:
  - name: "Cumulative Active Import"
    unit_of_measurement: kWh
    accuracy_decimals: 3
    state_class: "measurement"
    device_class: "energy"
    last_reset_type: "never"
grobius commented 3 years ago

Solved it. Update of esphome was required (I was running v1.18, upgrade to v1.20.4 solved it)

Emlben commented 3 years ago

Yes, I did copy it from the pullrequest. I can't see that there is something wrong with it (but it's probably me):

Same error message here when pasting in ESPhome.

Emlben commented 3 years ago

Solved it. Update of esphome was required (I was running v1.18, upgrade to v1.20.4 solved it)

Dooh, same issue here ;)

Thanks mates!

psvanstrom commented 3 years ago

Fixed by @fredrikbaberg in PR https://github.com/psvanstrom/esphome-p1reader/pull/13 👍