My Energy Dashboard is showing something but the scale of numbers is all wrong. I haven’t checked exactly but they might be offset with a factor of 10 meaning that the bars should be around 2,5kWh each.
Source of data:
I have an Arduino which picks up the pulses from my power meter and counts them for a minute. Every minute the Arduino pushes them to MQTT.
In HA I pick up the pulses like this:
mqtt:
broker: mqtt
port: 1883
username: user
password: password
birth_message:
topic: 'hass/status'
payload: 'online'
will_message:
topic: 'hass/status'
payload: 'offline'
sensor:
- state_topic: "home-assistant/sensor/electricity"
name: pulses
# should I say device_class: power here???
From there I build a template sensor like this (also converting from Wh to kWh):
Thanks for the suggestion but it was more complicated than that.
I, think , I was able to get it working with the following.
First I need a sensor giving me Power. (unit = Watts):
template:
- sensor:
- name: Electricity current power live
state: >
{{ (states('sensor.pulses') | int ) *60*6 }}
device_class: power
unit_of_measurement: 'W'
This is then with a Helper, called Riemann Integration, made into an energy class statistic (unit = Wh). I didn’t take a screenshot of the UI when I configured it and can’t seem to access it anymore, but this is what I find from the config files:
"entry_id": "619eaab9cded0738a1e06253ee9c9d3b",
"version": 1,
"domain": "integration",
"title": "Riemann of current power live",
"data": {},
"options": {
"name": "Riemann of current power live",
"source": "sensor.electricity_current_power_live",
"method": "trapezoidal",
"round": 2.0,
"unit_prefix": "none",
"unit_time": "h"
},
This Riemann entity is then what I use in the Energy dashboard.
BONUS:
I could not find it mentioned in the documentation anywhere but apparently the energy dashboard cost entity needs to be in €/kWh. All my numbers were in c/kWh so costs were scary high for a moment