Seems so. Guess I’ll have to figure out a template sensor. I was hopeful the new utility sensor would allow adding multiple entities but alas it does not.
Well it does! Look at my config which is producing the results nicely:
utility_meter:
hourly_energy_boiler:
source: sensor.sensor_energy_boiler_integral
cycle: hourly
daily_energy_boiler:
source: sensor.sensor_energy_boiler_integral
cycle: daily
monthly_energy_boiler:
source: sensor.sensor_energy_boiler_integral
cycle: monthly
hourly_energy_dryer:
source: sensor.sensor_energy_dryer_integral
cycle: hourly
daily_energy_dryer:
source: sensor.sensor_energy_dryer_integral
cycle: daily
monthly_energy_dryer:
source: sensor.sensor_energy_dryer_integral
cycle: monthly
hourly_energy_tv:
source: sensor.sensor_energy_tv_integral
cycle: hourly
daily_energy_tv:
source: sensor.sensor_energy_tv_integral
cycle: daily
monthly_energy_tv:
source: sensor.sensor_energy_tv_integral
cycle: monthly
hourly_energy_washing_machine:
source: sensor.sensor_energy_washing_machine_integral
cycle: hourly
daily_energy_washing_machine:
source: sensor.sensor_energy_washing_machine_integral
cycle: daily
monthly_energy_washing_machine:
source: sensor.sensor_energy_washing_machine_integral
cycle: monthly
hourly_energy_espresso_machine:
source: sensor.sensor_espresso_machine_integral
cycle: hourly
daily_energy_espresso_machine:
source: sensor.sensor_espresso_machine_integral
cycle: daily
monthly_energy_espresso_machine:
source: sensor.sensor_espresso_machine_integral
cycle: monthly
hourly_energy_power_consumption:
source: sensor.sensor_power_consumption_integral
cycle: hourly
daily_energy_power_consumption:
source: sensor.sensor_power_consumption_integral
cycle: daily
monthly_energy_power_consumption:
source: sensor.sensor_power_consumption_integral
cycle: monthly
hourly_energy_power_neo_coolcam_power_plug_12a_power:
source: sensor.sensor_neo_coolcam_power_plug_12a_power_integral
cycle: hourly
daily_energy_power_neo_coolcam_power_plug_12a_power:
source: sensor.sensor_neo_coolcam_power_plug_12a_power_integral
cycle: daily
monthly_energy_power_neo_coolcam_power_plug_12a_power:
source: sensor.sensor_neo_coolcam_power_plug_12a_power_integral
cycle: monthly
Thanks. Is that producing only three sensors though?
No, it produces a sensor per appliance per timeframe. In my case with 7 power meters it produces 21 sensors
How can I add tasmota readings using this sensor? should I add the total kWh consumption?
Cheers for that. That’s undesirable so I’ll look into aggregating all my sensors that report watts and go from there. I only want two sensors total; daily and monthly.
Here you go. This works! Thanks to @phileep and @martikainen for their code.
I have this inside a package called power_monitoring.yaml
. More to come.
sensor:
- platform: template
sensors:
total_power_usage:
value_template: '{{ ((states.sensor.xiaomi_tv_power.state | float) +
(states.sensor.xiaomi_office_power.state | float) +
(states.sensor.cupboard_light_power.state | float) +
(states.sensor.stairs_shelly_power.state | float) +
(states.sensor.davids_light_power.state | float) +
(states.sensor.lounge_light_power.state | float) +
(states.sensor.washing_machine_power.state | float) +
(states.sensor.zwave_garage_light_south_power.state | float) +
(states.sensor.family_room_shelly_power.state | float)) | round(0) }}'
friendly_name: 'Total Power Use'
unit_of_measurement: 'W'
Use the ‘round’ at the end to adjust your decimal places.
You can then add the created sensor to the utility_meter thus:
utility_meter:
daily_energy_consumption:
source: sensor.total_power_usage
cycle: daily
monthly_energy_consumption:
source: sensor.total_power_usage
cycle: monthly
Nice one! Now that I see it, I realize that in an old config I had used something similar to add up two values… This sensor updates it value whenever one of the sensors in the value template change, I suppose?
Thanks for sharing!
the docs for the utility meter component have been updated to reflect DSMR specific setup: https://www.home-assistant.io/components/utility_meter/
I have products from Fibaro that reports power (usage?). But they also have attribute power_consumption. Which one should I take if I want to use the templating?
In my setup, the fibaro dimmer does not show any sensors with power_consumption, but there are two that show power: sensor._power and sensor._power_2, one for each channel the dimmer contains. They both have Watts as unit of measurement, so those I would add to such a sensor. But make sure you put only sensors in there that also report in Watts, or your result is messed up.
In other words: if you have a sensor reporting in kW and one in W, realize that kW is a factor 1000 more so you either need to multiply the value of the sensor in Watts by 1000 or divide the kW sensors by 1000 to get the same unit of measurement.
Thanks, they all report in W! I don’t have anything connected to S2 on any of them, but still the *_2-sensor reports power, often close to but not exactly the same as S1… Should I take them both?
I guess you should as they are two separate power readings… keep in mind that the fibaro device itself also consumes a bit of power (<1W I think), so it is unlikely you will see 0’s in both power readings. I just noticed the power_consumption you mentioned is not a sensor but an attribute of the sensor, so you can ignore that for the template I suppose
At last finally got this dsmr meter working.
Even the grafana template works.
Thanks for the work
Hi @aetjansen!
First: I’d like to thank your for sharing your experience and Grafana dashboard with us Awesome stuff, this really helped me a lot to get instant insight in our usage history with the DSMR component. I’m learning at the moment, started using Home Assistant since a week now. I received my P1-to-USB cable yesterday, hooked that up to my NAS (self built, running mostly docker) and got beautiful graphs after five minutes. Truly awesome .
I’ve also read this thread and your blog, again, great explanation . After reading it, I find myself in a gap in knowledge/experience . You’re contribution got me thinking and interested in including the tariff for normal and low hours. I can’t get my head around on how to combine the DSMR component, the utility_meter and the tariffs from my energy supplier. Will you help me a bit?
In configuration.yaml
I have:
# Sensors
sensor: !include include/sensors.yaml
utility_meter: !include include/utility_meters.yaml
In include/sensors.yaml
I have:
- platform: dsmr
port: /dev/ttyUSB0
dsmr_version: 5
in include/utility_meters.yaml
I have:
daily_power_offpeak:
source: sensor.power_consumption_low
cycle: daily
daily_power_peak:
source: sensor.power_consumption_normal
cycle: daily
daily_gas:
source: sensor.gas_consumption
cycle: daily
monthly_power_offpeak:
source: sensor.power_consumption_low
cycle: monthly
monthly_power_peak:
source: sensor.power_consumption_normal
cycle: monthly
monthly_gas:
source: sensor.gas_consumption
cycle: monthly
As you might’ve guessed: I’m feeding all of this also into InfluxDB. I would like to get insight in how much money this would cost me, but I can’t get it crunched in my head. I feel like I’m missing knowledge/experience if this is possible. Can I have Home Assistant to do that for me? Or is it a part that Grafana needs to visualize with cool queries from InfluxDB? I know the tariffs (normal, low and gas) and they’re all fixed for almost three years.
Ehm, help?
How would you sum the instant power, of multiple sensor?
this looks amazing … what graphs/templates are you using for this?
Hi Aetjansen,
I was wondering if you can share the code of “Gasverbruik afgelopen week” I can’t get the temperature and cubic meter separated in the same panel with bars and lines they will stack up together .
Thx in advance
Hi All, I just noticed there is still live in this thread. I have not looked at my setup for several months, other life aspects took priority. I hope to dig in soon and get an answer on the questions here…