I’ll PM you to see if I can help you debug this
Hey guys (and gals?), did you see the new utility_meter component that @dgomes created, released with v0.87 yesterday? It is the easiest way to get immediate feedback on how much energy you used today (or last hour, week, month, year).
I set it up immediately, and found that for my situation it was not necessary to have the example automation setup to switch tariffs, as with the DSMR component I have separate sensors for peak and off-peak meter readings.
So, I did a quick write-up how I set it up. I think it is pretty much copy-paste if you are using two tariffs for electricity and use the DSMR component. Maybe it helps others as well. It is a great way to increase awareness on your current usage.
HI,
nice read.
please let me ask, since this is connected to the DSMR sensors for consumption, I take it that is the netto consumption? Meaning total consumption minus solar production?
Or can one also set the solar production in this component.
HI @Mariusthvdb,
There are separate sensors in the DSMR component for power production and power consumption. So the consumption sensor is what you consume. The production is what a PV installation is generating, netto is subtracting one from the other.
More detail in the DSMR docs
That was fast! Thanks. I don’t have the DSMR component so was wondering if you new how I could get all of my devices that measure power into one sensor I could add to the utility meter? I thought I could add them directly to the utility meter to combine but that is not the case.
I guess that sounds like a job for a template sensor. Maybe these threads can help you create a template sensor that is the cumulative value of several other sensors? Keep in mind that you need to add values of the same unit (i.e. all sensors report in watts) to the new template sensor.
Please share your solution if you have one! HTH
I’ve tried a min_max sensor.
sensor:
- platform: min_max
name: Total Power
entity_ids:
- sensor.xiaomi_office_power
- sensor.xiaomi_tv_power
- sensor.cupboard_light_power
- sensor.davids_light_power
- sensor.lounge_light_power
- sensor.washing_machine_power
- sensor.zwave_garage_light_south_power
- sensor.family_room_shelly_power
- sensor.stairs_shelly_power
Started out OK but but when I turned on my Shelly devices, it came up with ERR
then transitioned to Unknown
.
But your configuration isn’t getting just the maximum value (not the sum) of the sensors listed?
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?