esphome-docs/cookbook/power_meter.rst

81 lines
2.9 KiB
ReStructuredText
Raw Normal View History

2018-06-07 14:54:11 +02:00
Non-Invasive Power Meter
========================
2018-11-14 22:12:27 +01:00
.. seo::
:description: Instructions for hacking your power meter at home to measure your power usage.
:image: power_meter.jpg
2018-06-07 14:54:11 +02:00
So an essential part of making your home smart is knowing how much power it uses over
the day. Tracking this can be difficult, often you need to install a completely new
power meter which can often cost a bunch of money. However, quite a few power meters
have a red LED on the front that blinks every time that one Wh has been used.
The simple idea therefore is: Why don't we just abuse that functionality to make the power-meter
IoT enabled? We just have to hook up a simple photoresistor in front of that aforementioned
2019-02-16 23:25:23 +01:00
LED and track the amount of pulses we receive. Then using ESPHome we can instantly have
2018-06-07 14:54:11 +02:00
the power meter show up in Home Assistant 🎉
Hooking it all up is quite easy: Just buy a suitable photoresistor (make sure the wave length
approximately matches the one from your power meter). Then connect it using a simple variable
resistor divider (see `this article <https://blog.udemy.com/arduino-ldr/>`__ for inspiration).
And... that should already be it :)
.. figure:: images/power_meter-header.jpg
:align: center
:width: 80.0%
.. note::
Some energy meters have an exposed S0 port (which essentially just is a switch that closes), if
that is the case the photodiode can be replaced with the following connection.
.. code-block::
S0 ------------ VCC
S0 --+-- 10k -- GND
. |
. +--------- GPIO12
2019-02-16 23:25:23 +01:00
For ESPHome, you can then use the
:doc:`pulse counter sensor </components/sensor/pulse_counter>` using below configuration:
2018-06-07 14:54:11 +02:00
.. code-block:: yaml
2018-06-07 14:54:11 +02:00
sensor:
- platform: pulse_counter
pin: GPIO12
unit_of_measurement: 'kW'
name: 'Power Meter'
filters:
- multiply: 0.06 # (60s/1000 pulses per kWh)
2018-06-07 14:54:11 +02:00
Adjust ``GPIO12`` to match your set up of course. The output from the pulse counter sensor is in
``pulses/min`` and we also know that 1000 pulses from the LED should equal 1kWh of power usage.
Thus, rearranging the expression yields a proportional factor of ``0.06`` from ``pulses/min`` to
``kW``.
And if a technician shows up and he looks confused about what the heck you have done to your
2019-02-16 23:25:23 +01:00
power meter, tell them about ESPHome 😉
2018-10-12 16:33:22 +02:00
2018-10-30 16:49:33 +01:00
.. note::
Photoresistors often have a bit of noise during their switching phases. So in certain situations,
a single power meter tick can result in many pulses being counted. This effect is especially big on
ESP8266s. If you're experiencing this, try enabling the ``internal_filter:`` filter option:
.. code-block:: yaml
2018-10-30 16:49:33 +01:00
sensor:
- platform: pulse_counter
# ...
internal_filter: 10us
See :doc:`/components/sensor/total_daily_energy` for counting up the total daily energy usage
2019-01-15 21:49:57 +01:00
with these ``pulse_counter`` power meters.
2018-10-12 16:33:22 +02:00
See Also
--------
- :doc:`/components/sensor/pulse_counter`
- :ghedit:`Edit`