I have an emporia vue2 in my panel and one of the things I would like to do is log the time my HVAC compressor spends in each power range. It is a variable speed compressor so it can run at different speeds and not just on/off like a single stage unit.
I have seen many threads on logging the on time, but I’m looking to log the time it spends in certain ranges - eg <50 watts or off, 200-400 watts, 401-800 watts, 801-1200 watts. I know I need to use a template sensor and use an if clause. I probably need to create several template sensors for each watt range once I work out what ranges of power draw I will be seeing.
Would you do this with utility meter or just a stand alone template sensor for each?
You’d use a combination of a template sensor, integration sensor and utility meter.
Here is an example that I use to capture how many hours my generator has been running for. In your example you’d change the template to determine if it’s in one of your ranges. Then duplicate all three entries for each of your ranges. You can also add additional utility meters if you want daily, weekly and monthly stats.
sensor:
- platform: template
sensors:
sagegen_running_acc:
value_template: >-
{%- if is_state('binary_sensor.gen_running','on') %} 1 {%- else %} 0 {%- endif %}
- platform: integration
source: sensor.gen_running_acc
name: Gen_power_runtime_hours
unit_time: h
method: left
round: 3
utility_meter:
sagegen_total_hours:
source: sensor.gen_power_runtime_hours