esphome-docs/components/sensor/cse7766.rst
2024-01-15 09:05:50 +09:00

72 lines
2.5 KiB
ReStructuredText

CSE7766 Power Sensor
====================
.. seo::
:description: Instructions for setting up CSE7766 power sensors for the Sonoff Pow R2
:image: cse7766.svg
:keywords: cse7766, cse7759b, Sonoff Pow R2
The ``cse7766`` sensor platform allows you to use your CSE7766 voltage/current and power sensors
(`datasheet <https://itead.cc/wp-content/uploads/2022/05/CSE7766.pdf>`__) sensors with
ESPHome. This sensor is commonly found in Sonoff POW R2. CSE7759B is similar to CSE7766
and works with this integration.
.. note::
SAFETY HAZARD: Some devices such as Sonoff POWs/Shelly/etc, have the digital GND connected directly to mains voltage so **the GPIOs become LIVE during normal operation**. Our advice is to mark these boards to prevent any use of the dangerous digital pins.
As the communication with the CSE7766 done using UART, you need
to have an :ref:`UART bus <uart>` in your configuration with the ``rx_pin`` connected to the CSE7766.
Additionally, you need to set the baud rate to 4800. The device sends multiple updates per second, so you
will probably want some sort of averaging or throttle filter on the sensors.
.. code-block:: yaml
# Example configuration entry
# Disable logging over USB
logger:
baud_rate: 0
uart:
rx_pin: RX
baud_rate: 4800
sensor:
- platform: cse7766
current:
name: "Sonoff Pow R2 Current"
filters:
- throttle_average: 60s
voltage:
name: "Sonoff Pow R2 Voltage"
filters:
- throttle: 60s
power:
name: "Sonoff Pow R2 Power"
energy:
name: "Sonoff Pow R2 Energy"
.. note::
The configuration above should work for Sonoff POWs (R2).
Configuration variables:
------------------------
- **current** (*Optional*): Use the current value of the sensor in amperes. All options from
:ref:`Sensor <config-sensor>`.
- **power** (*Optional*): Use the (active) power value of the sensor in watts. All options from
:ref:`Sensor <config-sensor>`.
- **voltage** (*Optional*): Use the voltage value of the sensor in V (RMS).
All options from :ref:`Sensor <config-sensor>`.
- **energy** (*Optional*): Use the total energy value of the sensor in Wh.
All options from :ref:`Sensor <config-sensor>`.
- **uart_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the :ref:`UART Component <uart>` if you want
to use multiple UART buses.
See Also
--------
- :ref:`sensor-filters`
- :apiref:`cse7766/cse7766.h`
- :ghedit:`Edit`