bvlaicu / home-assistant-addons

MIT License
17 stars 16 forks source link

What is the current way to integrate the oru addon with the home assistant energy panel. #23

Open brandon-dacrib opened 2 years ago

brandon-dacrib commented 2 years ago

I am running the following on a raspberry pi 4b. Home Assistant Core 2022.6.7 Home Assistant Supervisor 2022.05.3 Home Assistant OS 8.2

Current as of 06/2022 The instructions in the readme are at least partially outdated as the

sensor:
  ...
  - platform: mqtt

syntax has been deprecated in favor of:

mqtt:
  sensor:
    - state_topic: "home/bedroom/temperature"`

I have two problems:

  1. The data is being populated into mqtt but the data that shows up in the energy panel does not match at all what is in the con-ed site. I think that only like the last message of the 4 updates per hour on the site is actually making it to the energy pane in home assistant

  2. I get a lot of errors that the sqlite db couldn't be written to because it is read-only (I suspect this is because only one thing can have an sqlite db open at a time and I need to move to mysql)

This is my related config

# electric meter via oru integration
mqtt:
  sensor:
    name: "ConEd Energy Usage"
    unique_id: "coned_energy_usage"
    state_topic: "electric_meter/value"
    unit_of_measurement: "kWh"
    device_class: energy
    state_class: total_increasing

Attached are images of the graph being produced in my overview panel which shows me I am getting at least some data points + The view in the energy panel which gives me wildly low numbers once every hour vs adding up the 4x an hour numbers in the coned site.

Screen Shot 2022-06-25 at 5 57 34 PM Screen Shot 2022-06-25 at 6 00 39 PM

This can potentially save my household money so I am willing to pay for dev time and fixes.

jgoulah commented 1 year ago

I am also getting incorrect data as compared to the con ed site. I am having some trouble debugging this, I think its due to the fact that con ed delivers in 15 minute increments (as opposed to the full hour) and its only counting the last of four, but that was just a hypothesis...

note: I find the subject a bit misleading given the actual issue

jgoulah commented 1 year ago

Here is proof that is what is happening

sqlite> select id, created, state, sum  from statistics where metadata_id = 1 order by created desc limit 10;
16564|2023-01-08 22:00:10.478828|0.4365|187.2225
16535|2023-01-08 21:00:10.467556|0.5895|186.786
16506|2023-01-08 20:00:10.058034|0.4185|185.7825
16477|2023-01-08 19:00:10.034372|0.504|185.364
16448|2023-01-08 18:00:10.026386|0.5085|185.3685
16419|2023-01-08 17:00:10.027182|0.4725|185.3325
16390|2023-01-08 16:00:10.026817|0.4905|185.3505
16361|2023-01-08 15:00:10.026893|0.4005|185.2605
16332|2023-01-08 14:00:10.055718|0.522|184.86
16303|2023-01-08 13:00:10.031712|0.45|184.788
astavitsky commented 1 year ago

I could not make the energy dashboard show any data using any suggested configurations on the Readme or in this thread. This is what worked for me:

mqtt:
  sensor:
    - name: "ConEd Energy Usage"
      unique_id: "coned_energy"
      state_topic: "electric_meter/message"
      value_template: "{{ value_json.value }}"
      last_reset_value_template: "{{ value_json.startTime }}"
      unit_of_measurement: "kWh"
      device_class: energy
      state_class: total

On another note, quite often there is a delay in an update on the website and some intervals are skipped. The website eventually recovers, but the data is lost as this sensor only looks at the last update.