Energy (AC) - CSE7766

This plugin is specifically made for Sonoff devices Sonoff S31, Sonoff Pow R2 and Sonoff POW/Dual R3 models.

Plugin details

Type: Energy (AC)

Name: CSE7766

Status: ENERGY

GitHub: P077_CSE7766.ino

Maintainer: TD-er

Used libraries: ESPEasySerial

Warning

This device is intended to be connected to mains power (110V/220V). Safety is of utmost importance, so the unit should not be connected to a computer if it also connected to the mains power, and it should be sufficiently isolated to prevent touching parts that can be connected to mains power!

See Safety

Supported hardware

Sonoff S31, Sonoff Pow R2, Sonoff POW R3xx(D), Sonoff Dual R3

Sonoff POWR3xx

Introduction

To measure the power used by an electric device, the Sonoff POW units, running either on an ESP8266 or ESP32, can be used. The installed power-sensor is the CSE7766, that makes the measured data available via a serial output at 4800 baud.

This plugin can read the measured data, and apply a correction value to show calibrated values for Voltage, Power and Current, and it will also make available a pulse count.

Configuration

../_images/P077_DeviceConfiguration.png
  • Name A unique name should be entered here.

  • Enabled The device can be disabled or enabled. When not enabled the device should not use any resources.

Sensor

See: Serial Helper configuration

Device Settings

  • U Ref: The calibration value for the Voltage measurement. When set to 0, a default value of 1950 will be used, see Calibration, below.

  • I Ref: The calibration value for the Current measurement. When set to 0, a default value of 3500 will be used, see Calibration, below.

  • P Ref: The calibration value for the Power measurement. When set to 0, a default value of 12530 will be used, see Calibration, below.

Data Acquisition

Single event with all values, Send to Controller and Interval settings are standard available configuration items. Send to Controller only when one or more Controllers are configured.

  • Interval By default, Interval will be set to 0 sec. as this is optional for this plugin.

Values

The measured values are available in Voltage, Power, Current and Pulses. A formula can be set to recalculate. The number of decimals is by default set to 2, and can be set to 0 for Pulses, as no decimals are provided from the measurement. When enabling the Stats checkbox for a value, statistics will be gathered and a graph of the last 16 (ESP8266) or 64 (ESP32) measurements will be shown.

Calibration

Easiest way to calibrate the plugin is to connect a known (resistive) load to the unit, measure the actual voltage, calculate the current from the power and voltage (current = power/voltage) and use the csecalibrate,<voltage>,<current>,<power> command (the Command input on the Tools page in the web UI will doen fine for that) to set the calibration values.

Commands available

Command

Extra information

csecalibrate,[<Voltage>],[<Current>][,<Power>]

Examples:

csecalibrate,229 to set the current reported voltage to 229V AC

csecalibrate,,0.1 To set the calibration to report 100 mA as actual current.

Will set the used calibration reference factors to some known current value. For example, if the device using this sensor is plugged into mains power, it may report 200 Volt AC, while it actually is 229V. So the value given to this command should then be 229, since that’s what is supposed to be read.

The last two parameters are optional, but their position determines what unit it represents. If the setting for current has to be updated, at least 2 parameters must be given of which the first must then be set to 0.

csereset

Will reset the calibration values to the default values, causing auto-calibration.

cseclearpulses

(Added: 2024-01-16) Will reset the CF-pulse counter. N.B. this also clears the kWh counter as it is derived from the CF-pulse counter.

Change log

Changed in version 2.0:

changed 2023-02-11 Use ESPEasySerial to allow more flexible Serial/GPIO configuration and support new Sonoff POW models (ESP32)

added Major overhaul for 2.0 release.

Added in version 1.0:

added Initial release version.