krikk/Hiking-DDS238-2-WIFI-Din-Rail-Energy-Meter-flashing-Tasmota

data points and how to add them for -kWh

Closed this issue · 5 comments

Hi,
In one of the issues it was pointed out that esphome can display reverse energy on the DDS238-2, and that the settings are:

  - platform: "tuya"
    name: "${friendly_name} kWh +"
    sensor_datapoint: 101
    unit_of_measurement: "kWh"
    accuracy_decimals: 3
    icon: "mdi:flash"
    filters:
      - multiply: 0.01

  - platform: "tuya"
    name: "${friendly_name} kWh -"
    sensor_datapoint: 9
    unit_of_measurement: "kWh"
    accuracy_decimals: 3
    icon: "mdi:flash"
    filters:
      - multiply: 0.01

sensor_datapoint: 101 is what tasmota and esphome uses for positive energy, and sensor_datapoint: 9 is what esphome uses for reverse energy.

I have been looking at this as I want to monitor the export of solar energy to grid.

I have installed the tuyaMCU helper bookmarklet:
https://github.com/sillyfrog/Tasmota-Tuya-Helper

And it shows datapoint 9, which is used in esphome for reverse energy as shown in below screen shot
Capture

The curious thing is that it doesnt show dpID 101. So I am wondering where that came from for the backlog setting TuyaMCU 37,101; ?
Can functionID be used for more than one datapoint, eg TuyaMCU 37,101; TuyaMCU 37,9;

EDIT:
I just checked another DDS-238 that is connected to my hotwater cylinder, and is shows both dpID 101 and 9, they both have tasmota 11 on and have exactly same config.
Capture2

krikk commented

the esphome docu is simply wrong in my case, because dpID 9 some sort of countdown-timer (just remember this, from another thread)
...and dpID 101 is total Power in kwh (this maps to the value on the LCD display)

and about dpID 9:
image
...this is my pv panel producing power...so no reverse energy

Hi, how did you get the dpID 101 in the first place.. as in where did the number come from as it doesnt show up on TuyaReceived messages when looking in console with weblog set to 4 until TuyaMUC 37,101; command is issued, or at least that is the case with my DDS-238. Actually even when set it shows up on one but not another. in console.

Is there a way to access the registers ?

Below is the info on registers that was sent to someone from the factory that makes the DDS-238.

12 registers
24 bytes

  //           0     1     2     3     4     5     6     7     8     9     A     B     C     D     E     F    10    11           = ModBus register
  //  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40  = Buffer index
  // 01 03 24 00 00 1C 7B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 F3 00 00 17 88 09 77 01 A6 03 F8 00 70 03 E1 13 8A 63 ED
  // 01 03 24 00 00 1C AD 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 F3 00 00 17 BA 09 77 01 F1 04 AF 00 6C 03 E3 13 86 41 A2
  // SA FC BC                                           EnergyTotal ExportActiv ImportActiv Volta Curre APowe PFact Frequ Crc--  = DDS238-2 WIFI     
  // SA FC BC EnergyTotal             ExportActiv ImportActiv                         Volta Curre APowe RPowe PFact Frequ Crc--  = DDS238-2 ZN/S version 1 (#6384)
  // SA FC BC EnergyTotal                                     ExportActiv ImportActiv Volta Curre APowe RPowe PFact Frequ Crc--  = DDS238-2 ZN/S version 2 (#6531)

So that would mean that the following registers hold the info for export/import:

Energy.export_active = (float)((buffer[21] << 24) + (buffer[22] << 16) + (buffer[23] << 8) + buffer[24]) / 100.0;  // 429496729.0 W
float import_active = (float)((buffer[25] << 24) + (buffer[26] << 16) + (buffer[27] << 8) + buffer[28]) / 100.0;  // 429496729.0 W

Or who I have to edit and recompile the source code for tasmota to make the work ?

krikk commented

the "tuya interface" is no modbus interface, the tuyamcu only exposes the data we can see with the tuyaMCU helper bookmarklet... nothing more, perhaps there could be diffenrent revisions of the hardware where more is exposes, but not on my hardware, and forget about the modbus stuff... to access that you have to use the modbus interface, which needs additional hardware i think... i do not even know if the Hiking DDS238-2 WIFI does have the required modbus interface...

krikk commented

btw: even the aliexpress item description says:

APP can read kWh , R.M.S current , voltage , active power
LCD display, Real-time display of Voltage, Current, Active Power, reactive Power, power factory ,frequence, total Energy kWh

Thanks for the info.
I have been asking about this on the tasmota forum too. I was told this:

If you read [TuyaMCU fnId list](https://tasmota.github.io/docs/TuyaMCU/#fnid) you may have noticed that Frequency and
 Reverse power are not part of the standard fnId codes. Which doesn't mean they are not transmitted but the device 
 developper are generaly free to implement the Tuya protocol in a "flexible" manner.

So it seems it doesnt mean the reverse energy and frequency data isn't available, just that the driver doesn't support it, and may never do so.

The manual for the meter doesnt mention modbus, and the 2 green terminals on the front are for impulse (current reading) which match the red flashing LED - higher the current draw faster it flashes.

The manual also mentions that "measures positive and negative active energy. with negative energy accumulated into positive energy". So I am wondering if the energy reading seen by tuyaMCU is just positive or both positive and negative combined ?

I have a shelly EM, so may hook both up and see what the difference is as the shelly read both import and export.