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

Moderator: leecollings

Gaudi
Posts: 35
Joined: Monday 12 November 2018 14:47
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

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

Post by Gaudi »

Thank you all for your contributions.
I an an advanced user with knowledge and tools for flashing eeproms and soldering skills, but not enough for program my own chip.

I will keep monitoring the thread.

I will appreciate instructions or directions on how to make this work.


Regards
rodgon81
Posts: 7
Joined: Sunday 11 August 2019 16:14
Target OS: Linux
Domoticz version:
Contact:

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

Post by rodgon81 »

telectroboy wrote: Thursday 12 March 2020 11:52 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...
If you necessarily want to save the data in the same module, you can use esp32 or any other microcontroller that has serial communication and enough storage to keep the data for the necessary time. This library was only tested with an esp8266, but without major problems it should work in any module that is programmed in c ++, it would only have to keep in the waiting times, since not all microcontrollers work at the same speed.

If you modify the library please share the modifications, someone else can help you.

The only problem with changing the WiFi module is that it affects the physical layout of the module, internally there is not much physical space to locate another larger module. Obviously, it can be left out of the module, each one has its own needs.

As for serial communication, there is not much to say, the microcontroller asks and the meter responds, the library implements all the functions that this meter has.
telectroboy
Posts: 12
Joined: Tuesday 12 February 2019 14:57
Target OS: OS X
Domoticz version:
Contact:

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

Post by telectroboy »

Yep, I've read your program and everything seems to be understandable.
You've made a fantastic work!!

I'll share my software on github, I've already forked yours.

I've checked the power supply of the system and it's not isolated. So this idea to add an ESP32 with SD Card is a bad idea because ground is physically connected to the Line voltage!!!

SO FOR EVERYBODY NEVER PLUG TTL232-3V3 WHILE METER IS PLUGGED TO LIVE VOLTAGE!!!!!!!!!!

Your idea to store datas outside this chip seems to be the best!
rodgon81
Posts: 7
Joined: Sunday 11 August 2019 16:14
Target OS: Linux
Domoticz version:
Contact:

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

Post by rodgon81 »

Gaudi wrote: Thursday 12 March 2020 13:39 Thank you all for your contributions.
I an an advanced user with knowledge and tools for flashing eeproms and soldering skills, but not enough for program my own chip.

I will keep monitoring the thread.

I will appreciate instructions or directions on how to make this work.


Regards
Sorry, for now with my little time, it is all I can help, I will update the library to support other microcontrollers and if someone confirms it I will support the DTS238-7 W.

Maybe telectroboy can share the source code of a complete firmware, with which you will only have to flash and use.

Regards.
rodgon81
Posts: 7
Joined: Sunday 11 August 2019 16:14
Target OS: Linux
Domoticz version:
Contact:

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

Post by rodgon81 »

telectroboy wrote: Thursday 12 March 2020 15:20 Yep, I've read your program and everything seems to be understandable.
You've made a fantastic work!!

I'll share my software on github, I've already forked yours.

I've checked the power supply of the system and it's not isolated. So this idea to add an ESP32 with SD Card is a bad idea because ground is physically connected to the Line voltage!!!

SO FOR EVERYBODY NEVER PLUG TTL232-3V3 WHILE METER IS PLUGGED TO LIVE VOLTAGE!!!!!!!!!!

Your idea to store datas outside this chip seems to be the best!
That's right, the WiFi module is not isolated. As long as the module is isolated you should have no problems, esp32 has Bluetooth, with which you could get historical data without manipulating the module, or you may work with WiFi acces point mode.

In addition, the library supports RemoteDebug, with an IP connection you can debug.

I also share a library that complements SmartMeter238. The library I'm talking about is JSmartMeter238, which facilitates communication since you have a JSON layer to work, in case you use MQTT, or Websocket.

https://github.com/rodgon81/JSmartMeter238
telectroboy
Posts: 12
Joined: Tuesday 12 February 2019 14:57
Target OS: OS X
Domoticz version:
Contact:

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

Post by telectroboy »

Friends,

I've saved the original content from my FM25Q16 flash.
You can find it here.

https://github.com/Telectroboy/SmartMet ... er/FM25Q16
havrla
Posts: 5
Joined: Monday 21 September 2020 2:25
Target OS: -
Domoticz version:
Contact:

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

Post by havrla »

Helooo

ID and KEy from Wisen app is easy:
Video:
https://cloud.itnaklic.cz/itnaklic/inde ... H7m76LR3E9

Havrla
Gaudi
Posts: 35
Joined: Monday 12 November 2018 14:47
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

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

Post by Gaudi »

havrla wrote: Monday 21 September 2020 2:31 Helooo

ID and KEy from Wisen app is easy:
Video:
https://cloud.itnaklic.cz/itnaklic/inde ... H7m76LR3E9

Havrla
Thank you for the information!!
I was able to get the information. Just to document how to access the shown screen, and steps:
  • Open Wisen App (Android)
  • Using Menu on the left, go to Managenment (Do search for the right option, my app is in a different language than English)
  • Select the meter you want to check
  • Tap 6 times the icon on the top of the screen, a debug log showing the information will appear
Process is the same for iPhone, although I can confirm that iPhone version does not show the complete information.

@havrla:
Can you confirm your firmware version? Mine shows as 4.1.26.1(A) (updated)

Also, I have noticed that you posted on Github (https://github.com/alryaz/hekrapi-python).
Did you manage to have the Hekr API working (from Github)?
I am unaware on how to install/setup it.

Thank you!
havrla
Posts: 5
Joined: Monday 21 September 2020 2:25
Target OS: -
Domoticz version:
Contact:

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

Post by havrla »

Version: Android - Wisen 1.8.9

I'll try tonight. - install/setup
Gaudi
Posts: 35
Joined: Monday 12 November 2018 14:47
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

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

Post by Gaudi »

havrla wrote: Monday 21 September 2020 18:17 Version: Android - Wisen 1.8.9

I'll try tonight. - install/setup
Thank you, app is the same, I meant Firmware version in the power meter itself. It can be grabbed from the same screen where you posted the "hack" to get the ID and Key information.

I will really appreciate if you could post your results on installing.

Initially I have found a lightweight alternative for just monitoring the power consumption, www.metern.org, which seems to fit my needs as opposed to a full home automation ecosystem. API + this implementation may work. I do have currently a QNAP NAS Online, and also a Raspberry Pi that may use for setting things up.


Thank you for refloating this thread!

Regards
havrla
Posts: 5
Joined: Monday 21 September 2020 2:25
Target OS: -
Domoticz version:
Contact:

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

Post by havrla »

Helooo
firmware wattmeter is OTA version 4.2.1(A)
havrla
Posts: 5
Joined: Monday 21 September 2020 2:25
Target OS: -
Domoticz version:
Contact:

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

Post by havrla »

I wrote to the author of Hekrapi.
He made an example of how to use api.
wait...
Gaudi
Posts: 35
Joined: Monday 12 November 2018 14:47
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

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

Post by Gaudi »

havrla wrote: Wednesday 23 September 2020 14:23 I wrote to the author of Hekrapi.
He made an example of how to use api.
wait...
I was in contact with him, and he kindly helped me set up Home Automation (HASS.IO). There are some caveats, but finally I am able to see my meter outside of the crappy Wisen App.

Issueing the following command:

Code: Select all

echo '{"msgId":6,"action":"appDevAuth","params":{"devTid":"REPLACE_WITH_YOUR_DEVICE_ID","ctrlKey":"REPLACE_WITH_YOUR_CONTROL_KEY"}}' | netcat -q 1 -u XXX.XXX.XXX.XXX 10000
Returns status, and some raw data.

Code: Select all

{"msgId":6,"action":"appDevAuthResp","code":200,"desc":"succuss"}
{"msgId":54523,"action":"devSend","params":{"devTid":"DEVICE_ID","appTid":[],"data":{"raw":"481401010101010008A3170000087C00000001A8"}}}
{"msgId":54525,"action":"devSend","params":{"devTid":"DEVICE_ID","appTid":[],"data":{"raw":"484301010B00052800000000000008F80000000000087D00087D00000000000000084100084100000000000002B902B90000000013860008A3170008A31700000000F4"}}}
I am not a dev myself, but an advanced user. My impression is that this can be integrated to Domoticz as well.


Great advances.

Many thanks to alryaz, the Dev!!!
krkristjan
Posts: 2
Joined: Friday 01 January 2021 14:45
Target OS: Linux
Domoticz version:
Contact:

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

Post by krkristjan »

Happy New Year Folks!

Gaudi can you explain how to add a new device to Home Automation? Some screenshots or screenvidei if it's possible.

I have this device https://www.aliexpress.com/item/4000925 ... 4c4da4ABO2. I can't connect to the Wisen app, I can add this device Tuya or Smart Life app, but I a have 3 phase energy meter these show only 1 phase. At the moment this device is connected local network I know the ip address and port. When I send a command that I found in your post through the Linux terminal, I don't get a response or an error message.

Thank You

Kristjan

Gaudi wrote: Wednesday 23 September 2020 15:03
havrla wrote: Wednesday 23 September 2020 14:23 I wrote to the author of Hekrapi.
He made an example of how to use api.
wait...
I was in contact with him, and he kindly helped me set up Home Automation (HASS.IO). There are some caveats, but finally I am able to see my meter outside of the crappy Wisen App.

Issueing the following command:

Code: Select all

echo '{"msgId":6,"action":"appDevAuth","params":{"devTid":"REPLACE_WITH_YOUR_DEVICE_ID","ctrlKey":"REPLACE_WITH_YOUR_CONTROL_KEY"}}' | netcat -q 1 -u XXX.XXX.XXX.XXX 10000
Returns status, and some raw data.

Code: Select all

{"msgId":6,"action":"appDevAuthResp","code":200,"desc":"succuss"}
{"msgId":54523,"action":"devSend","params":{"devTid":"DEVICE_ID","appTid":[],"data":{"raw":"481401010101010008A3170000087C00000001A8"}}}
{"msgId":54525,"action":"devSend","params":{"devTid":"DEVICE_ID","appTid":[],"data":{"raw":"484301010B00052800000000000008F80000000000087D00087D00000000000000084100084100000000000002B902B90000000013860008A3170008A31700000000F4"}}}
I am not a dev myself, but an advanced user. My impression is that this can be integrated to Domoticz as well.


Great advances.

Many thanks to alryaz, the Dev!!!
havrla
Posts: 5
Joined: Monday 21 September 2020 2:25
Target OS: -
Domoticz version:
Contact:

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

Post by havrla »

Wisen =! ( Tuya or Smart ) .
Diferent SW, diferent cloud.

Tuya and Smart
It has no library for communication and a wattmeter. :-(
Gaudi
Posts: 35
Joined: Monday 12 November 2018 14:47
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

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

Post by Gaudi »

krkristjan wrote:Happy New Year Folks!

Gaudi can you explain how to add a new device to Home Automation? Some screenshots or screenvidei if it's possible.

I have this device https://www.aliexpress.com/item/4000925 ... 4c4da4ABO2. I can't connect to the Wisen app, I can add this device Tuya or Smart Life app, but I a have 3 phase energy meter these show only 1 phase. At the moment this device is connected local network I know the ip address and port. When I send a command that I found in your post through the Linux terminal, I don't get a response or an error message.

Thank You

Kristjan

Gaudi wrote: Wednesday 23 September 2020 15:03
havrla wrote: Wednesday 23 September 2020 14:23 I wrote to the author of Hekrapi.
He made an example of how to use api.
wait...
I was in contact with him, and he kindly helped me set up Home Automation (HASS.IO). There are some caveats, but finally I am able to see my meter outside of the crappy Wisen App.

Issueing the following command:

Code: Select all

echo '{"msgId":6,"action":"appDevAuth","params":{"devTid":"REPLACE_WITH_YOUR_DEVICE_ID","ctrlKey":"REPLACE_WITH_YOUR_CONTROL_KEY"}}' | netcat -q 1 -u XXX.XXX.XXX.XXX 10000
Returns status, and some raw data.

Code: Select all

{"msgId":6,"action":"appDevAuthResp","code":200,"desc":"succuss"}
{"msgId":54523,"action":"devSend","params":{"devTid":"DEVICE_ID","appTid":[],"data":{"raw":"481401010101010008A3170000087C00000001A8"}}}
{"msgId":54525,"action":"devSend","params":{"devTid":"DEVICE_ID","appTid":[],"data":{"raw":"484301010B00052800000000000008F80000000000087D00087D00000000000000084100084100000000000002B902B90000000013860008A3170008A31700000000F4"}}}
I am not a dev myself, but an advanced user. My impression is that this can be integrated to Domoticz as well.


Great advances.

Many thanks to alryaz, the Dev!!!
Hi, I won’t have access to my meter for a couple of weeks.
You can check the Hekr Plug-in for Home Automation and follow the instructions.
Take into account that the commands to issue need to have the data for your meter, otherwise it will not reply.
Also, if you are unable to conect it to your wise app then this is the first thing to do, or you won’t get the proper device ID.
krkristjan
Posts: 2
Joined: Friday 01 January 2021 14:45
Target OS: Linux
Domoticz version:
Contact:

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

Post by krkristjan »

UPDATE: I found it - [email protected] if it is the right one!

Can somebody share with me Wisen app support contacts? I tried to find them from the website but it is mission impossible. At the moment I think I try everything to get the app location work.

Image
Attachments
Wisen - no location
Wisen - no location
IMG_4008.jpeg (51.18 KiB) Viewed 1849 times
Gaudi
Posts: 35
Joined: Monday 12 November 2018 14:47
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

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

Post by Gaudi »

The contact information I used related to the meter itself are:

[email protected]

[email protected]

They kindly replied to my questions.

Can you please comment if you were able to set up the Wisen App?
If so, you should be able to grab meter information to use with the Hekr Addon with Home Assistant.
ss77
Posts: 1
Joined: Wednesday 06 January 2021 4:34
Target OS: Linux
Domoticz version:
Contact:

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

Post by ss77 »

Inspired by netcat :)

Code: Select all

#!/usr/bin/perl
use IO::Socket::INET;
use JSON;
use Data::Dumper;
use WWW::Curl::Simple;

# flush after every write
$| = 1;

my ($socket,$data);

$socket = new IO::Socket::INET ( PeerAddr => '192.168.1.131', PeerPort => 10000, Proto => 'udp' ) ;

$req1 = "{\"msgId\":6,\"action\":\"appDevAuth\",\"params\":{\"devTid\":\"ESP_2M_XXXXXXX\",\"ctrlKey\":\"XXXXXXX\"}}";
$req2 = "{\"msgId\":7,\"action\":\"appSend\",\"params\":{\"devTid\":\"ESP_2M_XXXXXX\",\"ctrlKey\":\XXXXXXX\",\"appTid\":\"XXXXXXXX\",\"data\":{\"raw\":\"480602040a5e\"}}}";

$socket->send($req1);
$socket->send($req2);

$socket->recv($data, 1024, 0);
$socket->recv($data, 1024, 0);
$socket->recv($data, 1024, 0);

$resp = decode_json($data);
$pdu = $resp->{params}->{data}->{raw};
#print "$pdu\n";

$volt = hex(substr $pdu ,28 ,4)/10;
$freq = hex(substr $pdu ,104 ,4)/100;

print $freq;
print "\n";
print $volt;
print "\n";

my $curl = WWW::Curl::Simple->new();
my $res = $curl->get("http://192.168.1.103:8080/json.htm?type=command&param=udevice&idx=86&nvalue=0&svalue=$volt");

$socket->close();
and crontab :
*/5 * * * * /root/test.pl


Gaudi wrote: Wednesday 23 September 2020 15:03
havrla wrote: Wednesday 23 September 2020 14:23
Issueing the following command:

Code: Select all

echo '{"msgId":6,"action":"appDevAuth","params":{"devTid":"REPLACE_WITH_YOUR_DEVICE_ID","ctrlKey":"REPLACE_WITH_YOUR_CONTROL_KEY"}}' | netcat -q 1 -u XXX.XXX.XXX.XXX 10000
Returns status, and some raw data.

Code: Select all

{"msgId":6,"action":"appDevAuthResp","code":200,"desc":"succuss"}
{"msgId":54523,"action":"devSend","params":{"devTid":"DEVICE_ID","appTid":[],"data":{"raw":"481401010101010008A3170000087C00000001A8"}}}
{"msgId":54525,"action":"devSend","params":{"devTid":"DEVICE_ID","appTid":[],"data":{"raw":"484301010B00052800000000000008F80000000000087D00087D00000000000000084100084100000000000002B902B90000000013860008A3170008A31700000000F4"}}}
I am not a dev myself, but an advanced user. My impression is that this can be integrated to Domoticz as well.


Great advances.

Many thanks to alryaz, the Dev!!!
Gaudi
Posts: 35
Joined: Monday 12 November 2018 14:47
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

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

Post by Gaudi »

Hi, finally got home after some days abroad, and have found that the meter has the WiFi disabled. Pressing the settings button (arrow) as indicated in the user manual will not enable it.
So I am now stuck. Has anyone here have an idea if it is possible to enable wifi using the RS485 protocol?
Is there any other possible hack to enable it?
Button seems to respond, as there is an odd icon that appears upon press (above leftmost 0), but quickly disappears and nothing happens. Image

Thank you!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest