Hello,
what would be your ideas to create dummy/virtual power meters? I don’t have installed power meters for my lights, but I’m pretty sure that they consume i.e. 10W if they are on.
How would be your thoughts to collect their consumption?
Thanks, Thomas
tom_l
May 12, 2020, 3:43pm
2
I got It to work!
For the fake power meter I use:
- platform: template
sensors:
bedroom_heater_power:
friendly_name: "Bedroom Heater Power"
unit_of_measurement: 'kW'
value_template: >
{% if is_state('switch.your_power_plug', 'on') %}
1.50 # <- replace with the kW of your device
{% else %}
0
{% endif %}
And this for the integration sensor:
- platform: integration
source: sensor.bedro…
It is important to select the correct method of integration though. See this post: Power consumed per day
Oh! That means my setup is wrong with just:
power_consumption_total:
entity_id: sensor.time
unit_of_measurement: W
value_template: >
{% set ns = namespace(states=[]) %}
{% for s in states.sensor %}
{% if s.object_id.endswith('_power_consumption') %}
{% set ns.states = ns.states + [ s.state | float ] %}
{% endif %}
{% endfor %}
{{ ns.states | sum | round(2) }}
utility_meter:
power_consumption_hourly:
source: sensor.power_consumption_total
cycle: hourly
power_consumption_daily:
source: sensor.power_consumption_total
cycle: daily
power_consumption_monthly:
source: sensor.power_consumption_total
cycle: monthly
power_consumption_yearly:
source: sensor.power_consumption_total
cycle: yearly
I need to pass the wattmeter into an into an https://www.home-assistant.io/integrations/integration and then pass it to utilitymeter right?
Thanks again for your help. Really appreciated!
1 Like
If you use Node Red, that’s how I do it right now:
It seems that I’ve managed to find a very simple solution - only “downside” is that it works with Node Red.
Basically Node Red calculates the kWh by looking at the duration of the last state (on or off) of a switch, sends this value via MQTT to a sensor in Home Assistant, which gets read by the Utility Meter and added up.
First you need to make a flow like that :
[image]
Here’s the flow to copy:
[
{
"id": "82770b78.c61bb8",
"type": "server-state-changed",
"z": "…
Only takes one flow, one mqtt sensor and the utility meter (and two input numbers, if you want to quickly change Wattages)
1 Like