Page 3 of 5

Re: DDS238-4 W wifi Energy-meter S0-interface RS485-Interface ON/OFF control

Posted: Wednesday 25 September 2019 15:04
by Gaudi
Hi to everybody.

Has anyone got a workaround to be able to monitor and record historical data?
I have once been able to see past information on Wisen App, but never got the chance to see it again.

The provided Wisen App is not useful at all in this regard.


Many thanks!

Re: DDS238-4 W wifi Energy-meter S0-interface RS485-Interface ON/OFF control

Posted: Monday 07 October 2019 4:21
by mohitcosine
I have also got the device but I am not able to connect to the device and read data . Can anyone suggest how to connect to device and read data other than app

Re: DDS238-4 W wifi Energy-meter S0-interface RS485-Interface ON/OFF control

Posted: Monday 07 October 2019 4:23
by mohitcosine
Does Domoticz support integration with this device or if device has LPT230 how can we achieve and read data.

Re: DDS238-4 W wifi Energy-meter S0-interface RS485-Interface ON/OFF control

Posted: Tuesday 15 October 2019 4:37
by alryaz
Hello! I'm kinda new here, and I'm coming from a different background (Hass.io), and I bought a single phase one for myself just to play around and do some automatic submissions on the side.

I have a ESP8266 version, and I think I managed to break the protocol of this small thingy.

I'll set up a GitHub repository very soon, with an addon for HASS and a separate descriptive explanation of the API (I'm currently reverse-engineering their app, which appeared to be an embedded webview with almost readable JavaScript with all the fields available through the 10000 UDP port).

I might be in need of someone who has dual- or triple-phase DDS238-4. Please, PM me (or e-mail) if you're the one!

Re: DDS238-4 W wifi Energy-meter S0-interface RS485-Interface ON/OFF control

Posted: Tuesday 15 October 2019 13:29
by Gaudi
alryaz wrote:Hello! I'm kinda new here, and I'm coming from a different background (Hass.io), and I bought a single phase one for myself just to play around and do some automatic submissions on the side.

I have a ESP8266 version, and I think I managed to break the protocol of this small thingy.

I'll set up a GitHub repository very soon, with an addon for HASS and a separate descriptive explanation of the API (I'm currently reverse-engineering their app, which appeared to be an embedded webview with almost readable JavaScript with all the fields available through the 10000 UDP port).

I might be in need of someone who has dual- or triple-phase DDS238-4. Please, PM me (or e-mail) if you're the one!
Thank you very much for your report.
Unfortunately I have the single phase meter, but can help you in doing some tests with my units if needed.

Regards

Re: DDS238-4 W wifi Energy-meter S0-interface RS485-Interface ON/OFF control

Posted: Thursday 17 October 2019 15:24
by alryaz
Gaudi wrote: Tuesday 15 October 2019 13:29
alryaz wrote:Hello! I'm kinda new here, and I'm coming from a different background (Hass.io), and I bought a single phase one for myself just to play around and do some automatic submissions on the side.

I have a ESP8266 version, and I think I managed to break the protocol of this small thingy.

I'll set up a GitHub repository very soon, with an addon for HASS and a separate descriptive explanation of the API (I'm currently reverse-engineering their app, which appeared to be an embedded webview with almost readable JavaScript with all the fields available through the 10000 UDP port).

I might be in need of someone who has dual- or triple-phase DDS238-4. Please, PM me (or e-mail) if you're the one!
Thank you very much for your report.
Unfortunately I have the single phase meter, but can help you in doing some tests with my units if needed.

Regards
So, as I promised, here comes the GitHub repository: https://github.com/alryaz/python-hekr
The initial commit is as barebones as it gets, however it does seem to work with local devices.
My primary goals now will be to establish the following:
  1. Cloud connection to devices
  2. Better understanding of Hekr's send-receive datagram
  3. Find more devices with different APIs
I currently test with the following code (async is not necessary, however I will aim to make the library async-compatible):

Code: Select all

import asyncio
from time import sleep

from api import API
from device import Device
from helpers import load_protocol_definition

async def main():
    application_id = "<REDACTED>"
    power_meter_device = Device(
        device_id="<REDACTED>",
        control_key="<REDACTED>",
        address="<REDACTED>",
        device_protocol=load_protocol_definition('power_meter'),
        application_id=application_id
    )
    power_meter_device.authenticate()
    print(power_meter_device.command('queryDev'))
    # There's still some timeout happening at this stage. The following sleep ensures no problems occur.
    sleep(5)
    print(power_meter_device.command('queryData'))

if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())
There are number of attributes that have to be retrieved before running this code (the "<REDACTED>" ones).
These can be obtained via (for instance) installing a packet sniffer application such as HttpCanary Free Trial.
Once it's installed:
  1. Force close "Wisen" application
  2. Run packet sniffing on "Wisen" application
  3. Open Wisen application
  4. Swipe open the sidebar menu and open "Settings"
  5. Select "LAN settings" option and flick the switch to "on" position
  6. Go back and open your device !!!ENSURE IT LOADS PROPERLY FOR MAXIMUM COMPATIBILITY!!! (in some cases, however, loading won't occur; just check sniffer's output for anything on port 10000 for your meter's IP address; if there's data sent and received, you're good to go)
  7. Open sniffer application and search for entries resembling "<meter's IP address>:10000" using UDP
  8. There should be json-encoded datagrams which contain a "params" dictionary with "ctrlKey" ("control_key"), "appTid" ("application_id") and "devTid" ("device_id") keys. These are the ones you need. "address" is the IP address of your meter, obtaining it should be self-explanatory.
  9. Fill those in, run the example above.
Current protocol definitions are incomplete (some specific features are currently missing, such as firmware version checking, connectivity status, diagnostics, etc.), and socket connectivity is far from being robust (I might need assistance with that as I'm not really familiar with python's sockets at this stage). However, I made myself an auto-generator based on archives available on Hekr's hosting which extracts fields necessary for DDS238-4W operation and puts them as "power_meter.json" file in the "protocols folder". I took the liberty of converting some of the fields' names into more human-readable format (such as "total_energy_consumption"). Original field defiitions are also provided, albeit in a formatted variation.

Re: DDS238-4 W wifi Energy-meter S0-interface RS485-Interface ON/OFF control

Posted: Tuesday 22 October 2019 6:02
by Gaudi
Thnk you for the information.
I am following the steps listed in your post, but am unable to capture the packets to extract the information.
Upon opening Wisen, I get an Unknown Error. I can go ahead and enable LAN, and see the meter information, but returning to HTTPCanary app there are no entries with local IP.
Is there any other way to grab such packets?

Regards

Re: DDS238-4 W wifi Energy-meter S0-interface RS485-Interface ON/OFF control

Posted: Thursday 14 November 2019 23:10
by Josteyver
Good, I have followed all the thread and reviewed the repository but I have not been successful, has anyone already achieved it?

Re: DDS238-4 W wifi Energy-meter S0-interface RS485-Interface ON/OFF control

Posted: Saturday 16 November 2019 4:12
by Gaudi
alryaz wrote:
Gaudi wrote: Tuesday 15 October 2019 13:29
alryaz wrote:Hello! I'm kinda new here, and I'm coming from a different background (Hass.io), and I bought a single phase one for myself just to play around and do some automatic submissions on the side.

I have a ESP8266 version, and I think I managed to break the protocol of this small thingy.

I'll set up a GitHub repository very soon, with an addon for HASS and a separate descriptive explanation of the API (I'm currently reverse-engineering their app, which appeared to be an embedded webview with almost readable JavaScript with all the fields available through the 10000 UDP port).

I might be in need of someone who has dual- or triple-phase DDS238-4. Please, PM me (or e-mail) if you're the one!
Thank you very much for your report.
Unfortunately I have the single phase meter, but can help you in doing some tests with my units if needed.

Regards
So, as I promised, here comes the GitHub repository: https://github.com/alryaz/python-hekr
The initial commit is as barebones as it gets, however it does seem to work with local devices.
My primary goals now will be to establish the following:
  1. Cloud connection to devices
  2. Better understanding of Hekr's send-receive datagram
  3. Find more devices with different APIs
I currently test with the following code (async is not necessary, however I will aim to make the library async-compatible):

Code: Select all

import asyncio
from time import sleep

from api import API
from device import Device
from helpers import load_protocol_definition

async def main():
    application_id = "<REDACTED>"
    power_meter_device = Device(
        device_id="<REDACTED>",
        control_key="<REDACTED>",
        address="<REDACTED>",
        device_protocol=load_protocol_definition('power_meter'),
        application_id=application_id
    )
    power_meter_device.authenticate()
    print(power_meter_device.command('queryDev'))
    # There's still some timeout happening at this stage. The following sleep ensures no problems occur.
    sleep(5)
    print(power_meter_device.command('queryData'))

if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())
There are number of attributes that have to be retrieved before running this code (the "<REDACTED>" ones).
These can be obtained via (for instance) installing a packet sniffer application such as HttpCanary Free Trial.
Once it's installed:
  1. Force close "Wisen" application
  2. Run packet sniffing on "Wisen" application
  3. Open Wisen application
  4. Swipe open the sidebar menu and open "Settings"
  5. Select "LAN settings" option and flick the switch to "on" position
  6. Go back and open your device !!!ENSURE IT LOADS PROPERLY FOR MAXIMUM COMPATIBILITY!!! (in some cases, however, loading won't occur; just check sniffer's output for anything on port 10000 for your meter's IP address; if there's data sent and received, you're good to go)
  7. Open sniffer application and search for entries resembling "<meter's IP address>:10000" using UDP
  8. There should be json-encoded datagrams which contain a "params" dictionary with "ctrlKey" ("control_key"), "appTid" ("application_id") and "devTid" ("device_id") keys. These are the ones you need. "address" is the IP address of your meter, obtaining it should be self-explanatory.
  9. Fill those in, run the example above.
Current protocol definitions are incomplete (some specific features are currently missing, such as firmware version checking, connectivity status, diagnostics, etc.), and socket connectivity is far from being robust (I might need assistance with that as I'm not really familiar with python's sockets at this stage). However, I made myself an auto-generator based on archives available on Hekr's hosting which extracts fields necessary for DDS238-4W operation and puts them as "power_meter.json" file in the "protocols folder". I took the liberty of converting some of the fields' names into more human-readable format (such as "total_energy_consumption"). Original field defiitions are also provided, albeit in a formatted variation.
Ok, got it. I managed to get the packets and extract the information.
Can you please comment how to run your code and set up the python functions?
Or point me to a wiki to better understand how to set up this meter.
As i mentioned, I am unfamiliar with Domoticz.


Thank you very much.



Regards
Gaudi wrote:Thnk you for the information.
I am following the steps listed in your post, but am unable to capture the packets to extract the information.
Upon opening Wisen, I get an Unknown Error. I can go ahead and enable LAN, and see the meter information, but returning to HTTPCanary app there are no entries with local IP.
Is there any other way to grab such packets?

Regards

Re: DDS238-4 W wifi Energy-meter S0-interface RS485-Interface ON/OFF control

Posted: Saturday 16 November 2019 19:53
by ittchmh
Just received my meter with WiFi
Not tested/opened yet.
I will try to use COM sniffer - https://www.compuphase.com/electronics/rs232split.htm
Then custom firmware could be build to integrate this meter with other smart home software
I use HASS, not Domoticz.

Also I will try to use WireShark to capture traffic
I'm using Mikrotik AP, so traffic capture not an issue.

Also if internal ESP8266 communicates via RS485 this https://community.openhab.org/t/dds238- ... face/81463 would be good starting point for custom firmware

Re: DDS238-4 W wifi Energy-meter S0-interface RS485-Interface ON/OFF control

Posted: Sunday 17 November 2019 1:23
by Gaudi
ittchmh wrote:Just received my meter with WiFi
Not tested/opened yet.
I will try to use COM sniffer - https://www.compuphase.com/electronics/rs232split.htm
Then custom firmware could be build to integrate this meter with other smart home software
I use HASS, not Domoticz.

Also I will try to use WireShark to capture traffic
I'm using Mikrotik AP, so traffic capture not an issue.

Also if internal ESP8266 communicates via RS485 this https://community.openhab.org/t/dds238- ... face/81463 would be good starting point for custom firmware
Please keep us posted on your findings.
If you manage to build/flash a generic firmware it would be great.
Please note that some other users tried to read the program to no avail, so no backup in case of failure.

Regards

Re: DDS238-4 W wifi Energy-meter S0-interface RS485-Interface ON/OFF control

Posted: Monday 18 November 2019 12:42
by ittchmh
Just opened my meter
As I understand they use:
  • custom ESP8266 module
  • ESP8266 communicates via COM
I will try to sniff COM data

WiFi can be replaced with ESP8266-01 for custom firmware tests

Re: DDS238-4 W wifi Energy-meter S0-interface RS485-Interface ON/OFF control

Posted: Monday 02 December 2019 14:30
by Gaudi
ittchmh wrote: Monday 18 November 2019 12:42 Just opened my meter
As I understand they use:
  • custom ESP8266 module
  • ESP8266 communicates via COM
I will try to sniff COM data

WiFi can be replaced with ESP8266-01 for custom firmware tests
Hi, any updates on updating the firmware/making it work with Domoticz?


Thank you!

Re: DDS238-4 W wifi Energy-meter S0-interface RS485-Interface ON/OFF control

Posted: Wednesday 04 December 2019 20:02
by ittchmh
Gaudi wrote: Monday 02 December 2019 14:30
Hi, any updates on updating the firmware/making it work with Domoticz?

Thank you!
As I said I'm using other home automation system

You can use RS485 interface for integration - https://www.domoticz.com/wiki/Python_-_ ... o_PVOutput

alryaz have done a lot of work, check on github!

Re: DDS238-4 W wifi Energy-meter S0-interface RS485-Interface ON/OFF control

Posted: Wednesday 04 March 2020 0:39
by rodgon81
Hello, for all those who have this meter. I share some libraries that I develop through reverse engineering to this module.

With these libraries you can fully control the module. To program the module unfortunately it is necessary to disassemble it and flash the esp8266 inside.

For now, i share with you the librarys for those who have knowledge programming and some electronics, maybe you can make a plugin in ESPeasy or Tasmota or other.

I currently have a full firmware that connects with home assistant in my case, through MQTT, that saves history through nodered in an influexdb database with grafana. But that, still works well, but has work to do.

My English is not good, so use Google translator.

https://github.com/rodgon81/SmartMeter238
https://github.com/rodgon81/JSmartMeter238

I hope these libraries serve someone as they have served me.

Re: DDS238-4 W wifi Energy-meter S0-interface RS485-Interface ON/OFF control

Posted: Wednesday 04 March 2020 1:56
by Gaudi
rodgon81 wrote:Hello, for all those who have this meter. I share some libraries that I develop through reverse engineering to this module.

With these libraries you can fully control the module. To program the module unfortunately it is necessary to disassemble it and flash the esp8266 inside.

For now, i share with you the librarys for those who have knowledge programming and some electronics, maybe you can make a plugin in ESPeasy or Tasmota or other.

I currently have a full firmware that connects with home assistant in my case, through MQTT, that saves history through nodered in an influexdb database with grafana. But that, still works well, but has work to do.

My English is not good, so use Google translator.

https://github.com/rodgon81/SmartMeter238
https://github.com/rodgon81/JSmartMeter238

I hope these libraries serve someone as they have served me.
Hi Rodrigo, great work.
!
I do speak Spanish and am willing to test your code and collaborate.
Please feel free to contact me so we can further discuss and post findings here.

Regards

Re: DDS238-4 W wifi Energy-meter S0-interface RS485-Interface ON/OFF control

Posted: Wednesday 04 March 2020 17:31
by rodgon81
Gaudi wrote: Wednesday 04 March 2020 1:56
rodgon81 wrote:Hello, for all those who have this meter. I share some libraries that I develop through reverse engineering to this module.

With these libraries you can fully control the module. To program the module unfortunately it is necessary to disassemble it and flash the esp8266 inside.

For now, i share with you the librarys for those who have knowledge programming and some electronics, maybe you can make a plugin in ESPeasy or Tasmota or other.

I currently have a full firmware that connects with home assistant in my case, through MQTT, that saves history through nodered in an influexdb database with grafana. But that, still works well, but has work to do.

My English is not good, so use Google translator.

https://github.com/rodgon81/SmartMeter238
https://github.com/rodgon81/JSmartMeter238

I hope these libraries serve someone as they have served me.
Hi Rodrigo, great work.
!
I do speak Spanish and am willing to test your code and collaborate.
Please feel free to contact me so we can further discuss and post findings here.

Regards
Hola Gaudi, que bien entendernos en español. por alguna razon no te pude contestar el privado... te contesto por aca...

Comparto las librerías para que cada cual de acuerdo a sus necesidades desarrolle un firmware y extraiga los datos de su interés a donde les convenga.

Si tienes conocimientos de programación puedes intentar con ESPEasy, se que se puede, pero no tengo tiempo de desarrollar un plugin. Con ESPEasy puedes publicar por Wifi a MQTT los datos obtenidos.

La idea es simple.... necesitas publicar los datos a un servidor MQTT (24*7), que puedes montar en tu Raspberry. Al publicar en MQTT, puedes armar una interfaz con Domoticz, HomeAssistant u otro software de manejo de demótica, y ver los datos del momento en el móvil. Si das acceso a tu red desde internet, podrás ver los datos desde cualquier parte del mundo.

Ahora, si quieres datos históricos del medidor, en la Raspberry también debes instalar NodeRed, este es el encargado de escuchar los datos que quieras de los publicados en MQTT y guardarlos en InfluxDb. El esp8266 no tiene el almacenamiento suficiente como para mantener datos históricos, es necesario almacenarlos en una base de datos corriendo en la Raspberry en tu caso.

InfluxDB también debe estar corriendo en la Raspberry 24*7. Para acceder a los datos historicos debes usar Grafana quien te mostrará de forma gráfica los datos almacenados en InfluxDB. Ten en cuenta que también podrías publicar directamente a influxDb desde el Esp8266, todo va en la programación del firmware. Quizas tambien esos datos los puedes usar como input para metern.org, creo que usa JSON como formato.

En mi caso uso HomeAssistant con el cual escucho los datos publicados en MQTT y para generar gráficos de históricos uso NodeRed, InfluxDB y Grafana.

Si puedes flashear el esp8266 con los ejemplos que incluyo en las librerías, me cuentas como te fue.

Estudie la opción de RS485, o de sniffiar la comunicacion web del medidor, pero todas eran limitadas, y nunca podrías sacar el potencial completo del medidor.

Saludos quedo atento a tus pruebas...

Re: DDS238-4 W wifi Energy-meter S0-interface RS485-Interface ON/OFF control

Posted: Wednesday 11 March 2020 13:53
by telectroboy
Inside the metal case of the wifi module, there is a ESP8266EX and a FM25Q16 16Mb serial Flash Memory. Why so much flash inside??
Could we store historic datas in this flash?

I think YES!

What do you think about this?

EDIT :
I made a mistake it's a 16Mbits so only 2Mbytes... :/

Re: DDS238-4 W wifi Energy-meter S0-interface RS485-Interface ON/OFF control

Posted: Wednesday 11 March 2020 16:47
by rodgon81
Hi, in my case esp8266 also has 2 megabytes. Looking at the photos you uploaded a while ago, your meter has slight differences with mine, but the main chip is the same. and the wifi module too.

Saving historical data directly in esp8266, even if I had 16 megabytes, I don't think it's advisable, in my opinion, external systems have many more functions than could be programmed directly in esp8266. I mean graphics, filters, statistics and visual style.

Regards.

Re: DDS238-4 W wifi Energy-meter S0-interface RS485-Interface ON/OFF control

Posted: Thursday 12 March 2020 11:52
by telectroboy
I'm looking to fit an ESP32 instead of this ESP8266 in order to store those datas and host a small web page.
For the moment I just need a stand alone energy meter.

In the future, I will mix everything together with a node-red server in order to adjust water heating and car charging according to solar electricity production and grid consumption.

Thanks to your informations and your previous work I think I'll be able to do it.

Have you made a sheet about serial informations going in and out ?
I could extract this from your files but...