We'd like to describe some solutions to measure the energy consumed and produced by the building using Domoticz home automation system and energy meters like DDS238 and SDM120, SDM230 (single phase), SDM630 (threephase).

Having information about the used/produced power is useful to correctly manage loads (or heating/cooling system, electric vehicle charging, ....) in the right way, maximizing the own-produced energy from photovoltaic plant.

Solution 1: interfacing any energy meter with pulsed output using a DomBus module

This solution works with any kind of energy meter with pulsed output.

Using a DomBus module to get import / export power/energy in Domoticz

Normally, energy meters have 1 or 2 pulsed opto-insulated outputs to send 1000, 1666 or 2000 pulsed every kWh imported and exported.

If DomBus modules are used in the home automation system, it's easy to configure one or two input ports as IN_COUNTER to measure the imported/exported power and energy.

The following schema shows a system using DomBus module, but what it's interested in this case is that it shows a Eastron SDM230 energy meter, with 2 pulsed outputs connected to the I/O ports IO8 and IO9 of module DomBus12 (but DomBus23, DomBus33 and DomBusTH can be used as well). This is a reliable solution: if Domoticz controller is stopped, DomBus module continues counting pulses up to 64k (equivalent to 32-64kWh) and when Domoticz resumes, the energy counter is restored correctly without loosing pulses.

powerMeters

Using DomBus12, DomBus23, DomBusTH, DomBus32 or DomBus37 it's very easy to read the pulses from energy meters, compute the instant power and get two devices in Domoticz that show the usage and return power, usage and return total energy and graphs. Below the instructions that refer to Eastron SDM230 energy meter: similar procedure for any other energy meter with pulse outputs, like DDS238 energy meter.

  1. connect the pulse outputs to any available I/O, for example IO8 and IO9 for DomBus12, IO1 and IO2 for DomBusTH or DomBus23 or DomBus32 or DomBus37.  The SDM230 common terminal block should be connected to GND (0V). Other energy meters may have output S0+ that should be connected to the DomBus I/O and S0- to GND.
  2. configure Pulse1 output, on SDM230, as EXP kWh (check the manual to know how to do that); Pulse2 is pre-configured as IMP kWh (measure the energy imported from grid)
  3. configure the Domoticz device connected to Pulse2: press Edit on that device, and replace in the Description field IN_DIGITAL or IN_TWINBUTTON (the default value) with IN_COUNTER,TYPENAME=kWh  and save. Please note that kWh is CASE SENSITIVE!
    Now the device will be automatically moved to the Utility panel and configured as energy meter. Edit it again, write a name (for example PowerMeter_Import), and select Usage type.Energy Power Meter Devices in Domoticz
  4. if produced energy should be measured, configure the Domoticz device connected to Pulse1 as before: press Edit on that device, and replace in the Description field IN_DIGITAL or IN_TWINBUTTON with IN_COUNTER,TYPENAME=kWh,DIVIDER=2000 (where divider number correspond to the pulses/kWh of your meter) and save.
    Now the device will be automatically moved to the Utility panel and configured as energy meter. Edit it again, write a name (for example PowerMeter_Export), and select Return type.
  5. In case of both import and export devices are created, it's needed to specify on Import device the Unit number of the Export device, and vice versa. So, select Setup -> Devices and write down the Unit number corresponding to Import (for example 98), and Export device (for example 99), then go to Utility panel, edit Import device and add to the description ,OPPOSITE=99 (Unit of the Export device) and save; edit Export device and add to the description ,OPPOSITE=98 (Unit of the Import device) and save. In this way, when a pulse is received on Import device, the power on Export device will be immediately set to 0, and vice versa, when a pulse is received on Export device, the power on Import device will be set to 0.

Domoticz needs up to 5 minutes before updating the energy counter correctly.

Domoticz import and export devices using DomBus modules

Check the youtube videoyoutube small that shows the instant power shown on the web browser (Domoticz panel) every 2 seconds.

Solution 2 - Using DDS238-2 ZN/S (single phase) or DTS238-7 ZN/S (three phases) Modbus energy meters with DomBus modules

It's possible to connect up to 4 DDS238-2 ZN/S energy meters to a single DomBusEVSE module. DDS238-2 ZN/S have 2 terminal blocks with A and B signals (RS485 Modbus), so it's possible to connect together up to 4 energy meters to the A/B terminal block of DomBusEVSE module: in this way it's possible to measure, for each meter, import/export power, energy, voltage, frequency and power factor.

Values are updated every 5 seconds.

DomBusEVSE is a module designed to control an electric vehicle charging (Mode-3 EV charging station / wallbox). It supports up to 4 energy meters, single and three phases, providing imported energy and power, exported energy and power, active power (negative if power is fed to the grid), voltage, frequency and power factor.

DomBus34 is a module. It supports up to 4 energy meters, single and three phases, providing imported energy and power, exported energy and power, active power (negative if power is fed to the grid), voltage, frequency and power factor.

TODO: connection schema

 

Solution 3 - Using ESP8266 module (NodeMCU, Wemos, ...) with Eastron energy meters with ModBus RS485 interface

AN energy meter domESP1

The energy meter is connected between the first circuit breaker and the circuit breakers used for each zone: in this way it measure the used/produced power globally.

Please choose the energy meter model that integrates the RS485/Modbus interface, so it's possible to connect to ESP8266 board through a RS485 to TLL converter so ESPEasy can read power (positive if used, negative if produced), voltage and other variables.

Lua scripts

Some LUA scripts for Domoticz are available, to manage the house power: in the Winter, they activates electric heaters automatically when exported power (from photovoltaic plant on the roof?) is greater than electric heater power. Similarly, any kind of device can be configured (e.g. dehymidifiers / dryers).

It also send an alert when power usage is above the max available power, to prevent disconnections from the electric grid (overcurrent protection).

Scripts are available in github, https://github.com/CreasolTech/domoticz_lua_scripts