GEM + Grafana + Home Assistant

Discuss anything which doesn't fall into the other categories here.
scyto
Posts: 258
Joined: Sun Apr 06, 2014 7:24 pm

Re: GEM + Grafana + Home Assistant

Post by scyto » Tue Dec 14, 2021 2:57 pm

also seems the integration isn't compatible with the new energy tracking feature....
Attachments
Screenshot 2021-12-14 115719.png
Screenshot 2021-12-14 115719.png (87.29 KiB) Viewed 8189 times
scyto
Posts: 258
Joined: Sun Apr 06, 2014 7:24 pm

Re: GEM + Grafana + Home Assistant

Post by scyto » Tue Dec 14, 2021 3:01 pm

ooh i think this pull from yesterday will fix it? https://github.com/home-assistant/core/pull/61653 just need to wait?
heimdm
Posts: 10
Joined: Mon Sep 12, 2016 9:09 am

Re: GEM + Grafana + Home Assistant

Post by heimdm » Wed Dec 22, 2021 10:47 am

With home assistant (HA), the first thing is that GEM reports via watts. The statistics for energy monitoring look for kwh used very much like your electric meter from the utility company.

The first thing that needs to be done is setup your configuration.yaml file to support customizations if that hasn't already been done:

Code: Select all

homeassistant:
    customize: !include customize.yaml
The customize.yaml will contain any customizations... this may already been going on if you have customized other things. For each GEM entity/sensor you will add something similar to the following:

Code: Select all

sensor.mechanical_room_outlet:
  unit_of_measurement: W
  device_class: power
  state_class: measurement
If you look up that sensor via developer tools you should see something similar to this. The state shows the data is being received from the GEM integration. Which in the blow screenshot is showing 6 watts of use.
dev-opt1.png
dev-opt1.png (43.11 KiB) Viewed 8134 times
Next, we need to convert our watts into kwh to track cummulative usage. To do that you will create a custom sensor to track the kwh. This will also go in your customize.yaml file.

Code: Select all

sensor.mechanical_room_outlet_kwh:
  state_class: measurement
  device_class: energy
  last_reset: '2021-12-22T00:00:00-05:00'
  unit_of_measurement: kWh
Update the last_reset to be a time from today. I am not sure why home-assistant requires this field, but it does. If you give it some time, when you go back to developer tools and pull up that sensor it should being tracking the kwh. This is what all the energy sensors/statistics want to see in HA.
dev-opt2.png
dev-opt2.png (60.56 KiB) Viewed 8134 times
In the above screenshot you can see that the "kwh" entity has used 2.2 kwh. Give it about 5-10 minutes and then you should be able to add that sensor to the energy configuration. If you add a "friendly_name" attribute to the "kwh" sensor, that is what will appear on the HA dashboard.

Hope this helps.
Post Reply