I recently embarked on a project to optimize my home’s energy consumption, and I wanted to share my experience and some tips with the community. The goal was to create a system that could adapt to different devices plugged into a single metered outlet, such as a mobile AC unit in summer and a heater in winter.
Initially, I faced a challenge in splitting the energy data into separate sensors based on the device in use. After some research and experimentation, I decided to use an input_select entity to manually switch between devices. This allowed me to create separate energy sensors for each device, which I named sensor.plug6_AC_energy, sensor.plug6_heater_energy, and sensor.plug6_default_energy.
Here’s how I set it up:
yaml
input_select:
device_selector:
name: Device Selector
options:
- default
- AC
- heater
icon: mdi:power-plug
sensor:
- platform: template
sensors:
plug6_AC_energy:
value_template: >
{% if states(‘input_select.device_selector’) == ‘AC’ %}
{{ states(‘sensor.plug6_energy’).state }}
{% else %}
0
{% endif %}
plug6_heater_energy:
value_template: >
{% if states(‘input_select.device_selector’) == ‘heater’ %}
{{ states(‘sensor.plug6_energy’).state }}
{% else %}
0
{% endif %}
plug6_default_energy:
value_template: >
{% if states(‘input_select.device_selector’) == ‘default’ %}
{{ states(‘sensor.plug6_energy’).state }}
{% else %}
0
{% endif %}
This setup has been working beautifully! It allows me to track energy usage for each device separately, which has been incredibly helpful for optimizing my energy consumption habits.
I’d love to hear if anyone has implemented a similar solution or has suggestions for improvement. Happy tinkering! ![]()