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

Moderator: leecollings

tfjadrian
Posts: 1
Joined: Sunday 30 January 2022 5:38
Target OS: Linux
Domoticz version:
Contact:

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

Post by tfjadrian »

Gaudi wrote: Wednesday 25 September 2019 15:04 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!
Hello,

I am also trying to see the historical data from the Wisen app. Did you manage to do it? When I go to that section, it only shows the graph axis, but no data at all.

Thanks a lot for reading me!
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 »

tfjadrian wrote: Sunday 30 January 2022 5:41
Gaudi wrote: Wednesday 25 September 2019 15:04 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!
Hello,

I am also trying to see the historical data from the Wisen app. Did you manage to do it? When I go to that section, it only shows the graph axis, but no data at all.

Thanks a lot for reading me!
I could not. App is total crap, and besides, it shares your information.
I resorted to use Home Assistant using some addon to access data, but as of now, the WiFi interface of my meter got ruined and I did not replace it.

I may be able to find some time to disconnect it and check for any internal issue, but it is not top of my priorities.

Regards
asistex
Posts: 1
Joined: Friday 23 September 2022 14:57
Target OS: -
Domoticz version:
Contact:

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

Post by asistex »

electric_meter_DTS-238-7_WISEN---integration-homeassistant

https://github.com/SergyiSviderskii/ele ... istant.git

Maybe to whom and will help.
All tested in homeassistant .
alryaz
Posts: 3
Joined: Tuesday 15 October 2019 4:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by alryaz »

Hello everyone!

It's been awhile since I've last replied to this thread (or took part in any development whatsoever), however yesterday I managed to sorta finalize my `hekrapi-python` library adaptation for ESPHome, and put my power meter on it.

So far it has been a blessing to switch from Wisen. Data updates are performed smoothly. There are no pesky timeouts involved.

The project resides here: <GitHub>/alryaz/esphome-components/tree/main/components/hekr

I am, however, a Home Assistant user, therefore I can't really provide guidance on how to set it up for Domoticz. Please take a look at the provided example of how everything is set up. I will attempt to publish a YouTube video soon explaining how to flash the module.
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 »

alryaz wrote: Tuesday 31 January 2023 11:03 Hello everyone!

It's been awhile since I've last replied to this thread (or took part in any development whatsoever), however yesterday I managed to sorta finalize my `hekrapi-python` library adaptation for ESPHome, and put my power meter on it.

So far it has been a blessing to switch from Wisen. Data updates are performed smoothly. There are no pesky timeouts involved.

The project resides here: <GitHub>/alryaz/esphome-components/tree/main/components/hekr

I am, however, a Home Assistant user, therefore I can't really provide guidance on how to set it up for Domoticz. Please take a look at the provided example of how everything is set up. I will attempt to publish a YouTube video soon explaining how to flash the module.
Hi @alryaz, thank you for keeping us posted!

I look forward to your instructions/video to flash the module.
In the meanwhile, can you comment if you managed to just flash the built in communication board on yout meter or if you had to tinker/replace it with a new ESP control board?

Best regards
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 »

alryaz wrote:Hello everyone!

It's been awhile since I've last replied to this thread (or took part in any development whatsoever), however yesterday I managed to sorta finalize my `hekrapi-python` library adaptation for ESPHome, and put my power meter on it.

So far it has been a blessing to switch from Wisen. Data updates are performed smoothly. There are no pesky timeouts involved.

The project resides here: <GitHub>/alryaz/esphome-components/tree/main/components/hekr

I am, however, a Home Assistant user, therefore I can't really provide guidance on how to set it up for Domoticz. Please take a look at the provided example of how everything is set up. I will attempt to publish a YouTube video soon explaining how to flash the module.
Hi @alryaz, any chance to post instructions on how to flash the firmware of the ESP module?

Thank you and regards
Cine5
Posts: 5
Joined: Tuesday 04 April 2023 21:38
Target OS: OS X
Domoticz version:
Contact:

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

Post by Cine5 »

Hello ; i am not programmers but i am using this meter with WISEN running on iphone but the application crash since startup, i tried to uninstall, reboot , but same issue. Someone had used this meter with other application ?? I tried tuya and smart life but they are not compatible with this meter .
Thanks in advance for your help
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 »

Cine5 wrote:Hello ; i am not programmers but i am using this meter with WISEN running on iphone but the application crash since startup, i tried to uninstall, reboot , but same issue. Someone had used this meter with other application ?? I tried tuya and smart life but they are not compatible with this meter .
Thanks in advance for your help
Wisen App is crap, and it does probably post your information to Chinese servers.
Before the WiFi my meter stopped working I was able to connect to it using Hole Assistant (another home automation app) using the Hekr libraries.
Best thing to do will be to flash the internal communication module firmware module to make it more “universal” with an open source alternative, although to do this some electronics knowledge is needed.
This is what apparently some user managed to do, and we are waiting for some more extra information.
Cine5
Posts: 5
Joined: Tuesday 04 April 2023 21:38
Target OS: OS X
Domoticz version:
Contact:

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

Post by Cine5 »

No problem dear for flashing tge eprom , i have a beeprog and i am an electronic technician but i don’t have the file . It is possible to download from some sites ? And after programming it is possible to use the meter with tuya application gor example ?
Cheers
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 »

Cine5 wrote:No problem dear for flashing tge eprom , i have a beeprog and i am an electronic technician but i don’t have the file . It is possible to download from some sites ? And after programming it is possible to use the meter with tuya application gor example ?
Cheers
Have you taken a look at the full thread?
[mention]alryaz [/mention] user posted recently some updates, but have been silent since then.
There is no provided file or instructions.
I am also looking for them.
Cine5
Posts: 5
Joined: Tuesday 04 April 2023 21:38
Target OS: OS X
Domoticz version:
Contact:

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

Post by Cine5 »

I tried ewelink , tuya , smart life but also same problem: not compatible with them
If someone have the file in the forum and could help me please 🙏
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 »

Cine5 wrote: Wednesday 05 April 2023 14:58 I tried ewelink , tuya , smart life but also same problem: not compatible with them
If someone have the file in the forum and could help me please 🙏
As you mentioned you are familiar and confident with electronics and flashing, you may want to give a try the following instructions and post back your results:

https://github.com/krikk/Hiking-DDS238- ... ng-Tasmota

It is for DDS238-2 Wifi, which may have similar/same communication hardware as ours (DDS238-4 Wifi). Main difference seems to be that it is 2 DIN modules wide as opposed to 4 modules.

Hope this helps us point into the right direction until Alryaz comes back with his own instructions.

Regards
Cine5
Posts: 5
Joined: Tuesday 04 April 2023 21:38
Target OS: OS X
Domoticz version:
Contact:

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

Post by Cine5 »

Thank you dear 😘
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 »

I thought this thread was already underground. But I see some fighters still playing on this meter.

If you are interested, I leave my implementation that works with ESPHome.

https://github.com/rodgon81/esphome/tre ... s/dxs238xw
Cine5
Posts: 5
Joined: Tuesday 04 April 2023 21:38
Target OS: OS X
Domoticz version:
Contact:

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

Post by Cine5 »

Hi ; i have disabled the location in settings of iphone and the application WISEN works and doesn’t crashed so now i use the meter with WISEN Application without any problem . Thanks for all for your support but also maybe my message can help someone have same issue with the DDS238-4 and WISEN application.
Cheers
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 »

rodgon81 wrote: Monday 10 April 2023 20:20 I thought this thread was already underground. But I see some fighters still playing on this meter.

If you are interested, I leave my implementation that works with ESPHome.

https://github.com/rodgon81/esphome/tre ... s/dxs238xw
Thanks rodgon81 for your great help!

Can you please explain a little bit more on the flashing procedure. I am familiar with electronics, and will be able to connect the meter to a Raspberry Pi or serial to USB to flash it (using an Arduino board, or other means). But I am not familiar ESP8266 programming.

I have not found in the Guithub repo you posted a .bin firmware file.

Would you mind posting brief step by step instructions, including files and software to use?

Also, afterwards how do you set up the WiFi settings so the metter can connect to your Wifi network?


Thanks again!
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 All, I would like to report the successfull outcome of my experimentation with the meter. As previously mentioned, it is the HiKing DDS238-4 W, which comes from factory paired with the Wisen App, which is pure crap.

I would like to thank rodgon81, without his help I would have been unable to complete the task.
Also, he has eagerly helped debug and sole several issues that appeared during testing.

Thank you very much rodgon81!!

Image

In the past, there was some integration to make it work, but it was unreliable, did not remove the cloud connection, and did not allow for fiddling.

After @rodgon81 post, I got in contact with him better understand the required steps, and to debug and troubleshoot the installation.
There were some hiccups, as apparently there are different versions of the meter, but with his great contribution we were able to get it to work.

So, first, with geat power comes great responsibility.
Image

The meter consists of two separate entities that can be described as:
  • The meter chip, which is responsible of the control, calculations and display of the information. It may or may not have communication capabilities (some meters only display, some interface using pulse or RS485 protocol, or some can communicate internally with a communications module. As per my understanding, there are currently two protocols such chips could use: Tuya or Hekr.
  • The communication module. Usually such module is an ESP8266 (cheaper) or ESP32S (more expensive and with more capabilites).
    This module is responsile of communicating vía WiFi with the outside world, and can have different firmware installed.
Fiddling with the former chip is more difficult, challenging and risky, so the solution is based on reprogramming th communication module with a proper defined firmware.
In order to do so, it is necesasary to open the meter, and get access to the ESP module.

Initial step is to disassemble the meter in order to get access to the ESP8266 module. This is fairly easy, there are 4 screws on the bottom part, and the you can remove the cover.

The module is on the left.
Image
Image

To program, you will need to carefully desolder it (I have not tried to program it soldered, and it may work).
Image
Image

Now the "Difficult part", program the module. You need to get two things:
  • A 3.3V power source (I have used a module prepared for breadboards that can output 5V and 3.3V).
  • A UART programmer. The one I have used is based on CH340 chip and it worked just fine.
Then you will need to connect the module:
  • VCC <--> 3.3V from power module
  • GND <--> GND from power module
  • RX <--> TX from programmer
  • TX <--> RX from programmer
See my setup ( I have used a breadboard):
Image
Image

So far, we are ready.

Be aware that after the following steps, you will have a new firmware. It is strongly suggested that you do backup your module firmware. I will not cover the details here, as there are many pages with instructions.
Some of them:
https://www.instructables.com/How-to-Ba ... Esp8266EX/
https://cyberblogspot.com/how-to-save-a ... -firmware/

There are two solution to install in the ESP8266 module to connect to Home Assistant: Tasmota or ESPHome. This development is for ESPHome. Any user could take advantage of the instructions and make the propoer adjustments for Domoticz.

Now the software part. First you will need to prepare your module to accept the program.
You will need to enable programming mode in the ESP8266 module by connecting the shown pin of the controller to ground:
Image

Then you can proceed with the inital programming that can be done with an online tool found at https://web.esphome.io/
As you press connect you will be taken to a device selection process. And afterwards it will initialize and flash the module.

Once the installation of the first firmware is done, ensure that you remove the short pin installed, as otherwise it will not work properly.

If you set the Wifi config properly, you should be able to program the module OTA, but I suggest that you program the initial configuration connected to the programmer.

Afterwards you will need to use either the ESPHome integration in Home Assistant, or a standalone installation.

Please note that even though you can install ESPHome in Windows, it will not work properly to compile the code to upload. I have learned this the hard way. Use a Virtual Machine with Linux, or a Home Assitant OS Installation. I have used a Home Assistant VM image initially, and then swithed to a Raspberry Pi.

When finished, you can disconnect the USB programmer and test the module connection to your WiFi network.

You are now ready to go on on Home Assistant ESPHome Addon. Your device should appear in the ESPHome manager, and you should be able then to edit its configuration.
After editing , you install it so it is transferred to the module. Test it a couple of times until you make sure it works flawlessly before resoldering into the meter.

The configuration for the yaml file is listed in the rodgon81 github readme:

https://github.com/rodgon81/esphome/tre ... s/dxs238xw

You are now ready to resolder ans start playing with your "unlocked" meter.

I am sure some of the steps may be confusing, bu do investigate, test and post back your findings. I will try to help to the best of my knowledge.


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

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

Post by Gaudi »

After you complete the steps in the previous post, you will need to edit a proper .yaml file that has the settings and configuration for your meter to communicate with Home Assistant.
Also, this will tell ESPHome how to compile the firmware it will upload. See button "Edit" in ESPHome component in Home Assistant.
The addon will address all the requirements, so it is the easy way to follow; the hard way, or expert mode is to install ESPHome in a Linux machine or VM.

Image

Following is the configuration I currently use, that I have adjusted to my needs. Please do edit the Wifi and AP settings to your own. Also, the API Key is crucial to be able to communicate with your device. It will be created at the time of the first setup, and can be adjusted later.

Do not misplace it, as if you do, you will need to desolder and wire it to the computer to reflash. Also make sure you can connect via WiFi before disconnecting from the USB programmer and solder it back into the meter. If you do it wrong, and the fallback AP does not work, you will end up needing to rewire it to the computer.

Code: Select all

#The substution block has all the configurable details
substitutions:
  name: esphome-web-xxxxx
  friendly_name: <<Your Friendly Name>>
  wifi_ssid: <<Your WiFi SSID>>
  wifi_password: <<Your WiFi Password>>

#Required config to access rodgon81 component
external_components:
   - source:
       type: git
       url: https://github.com/rodgon81/esphome
       ref: dev
     refresh: 300s
     components: [ dxs238xw ]

esphome:
  name: $name
  friendly_name: $friendly_name

esp8266:
  board: esp01_1m
  restore_from_flash: true

wifi:
  ssid: $wifi_ssid
  password: $wifi_password
  fast_connect: false
  power_save_mode: none 

 # Fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: <<Fallback AP WiFi SSID>>
    password: <<Fallback AP WiFi>>

# Enable Home Assistant API
api:
  encryption:
    key: <<Your unique API Key, it should be the same as created otherwise it will not connect>>

# Enable logging
logger:
  level: DEBUG
  baud_rate: 0

captive_portal:

ota:
  # Enable fallback hotspot (captive portal) in case wifi connection fails

uart:
  tx_pin: GPIO1
  rx_pin: GPIO3
  baud_rate: 9600

dxs238xw:
  update_interval: 3s

sensor:
  - platform: dxs238xw
    frequency:
      name: "Frequency"

    current_phase_1:
      name: "Current"
    voltage_phase_1:
      name: "Voltage"
    reactive_power_phase_1:
      name: "Reactive Power"
    active_power_phase_1:
      name: "Active Power"
    power_factor_phase_1:
      name: "Power Factor"
    phase_count:
      name: "Phases N°"

    import_active_energy:
      name: "Import Active Energy"
    export_active_energy:
      name: "Export Active Energy"
    total_energy:
      name: "Total Energy"
    # energy_purchase_balance:
    #   name: "Energy Purchase - Balance"
    # energy_purchase_price:
    #   name: "Energy Purchase Price"
    total_energy_price:
      name: "Total Energy Cost"
    contract_total_energy:
      name: "External Meter Total Energy"

  - platform: wifi_signal
    name: WiFi Signal Strength
    update_interval: 30s
  - platform: uptime
    name: Uptime Sensor
    id: uptime_s
    update_interval: 15s
    internal: true 

text_sensor:
  - platform: dxs238xw
    meter_state_detail:
      name: "State - Detail"
      filters:
        - substitute:
          - "Off by Over Voltage -> INACTIVE - Over Voltage"
          - "Off by Under Voltage -> INACTIVE - Under Voltage"
          - "Off by Over Current -> INACTIVE - Over Current"
          - "Off by End Delay -> INACTIVE - End Delay"
          - "Off by User -> INACTIVE - By User"
          - "Off by Unknown -> INACTIVE - Unknown"
          - "Power Ok -> ACTIVE"
    # delay_value_remaining:
    #   name: "Remaining Delay Time"
    meter_id:
      name: "Serial N°"

  - platform: version
    name: ESPHome Version

  - platform: template
    name: Uptime
    lambda: |-
      int seconds = (id(uptime_s).state);
      int days = seconds / (24 * 3600);
      seconds = seconds % (24 * 3600); 
      int hours = seconds / 3600;
      seconds = seconds % 3600;
      int minutes = seconds /  60;
      seconds = seconds % 60;
      return { (String(days) +"d " + String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
    icon: mdi:clock-start
    update_interval: 30s


number:
  - platform: dxs238xw
    max_current_limit:
      name: "Maximum Current"
      mode: box
    max_voltage_limit:
      name: "Maximum Voltage"
      mode: box
    min_voltage_limit:
      name: "Minimum Voltage"
      mode: box
    # delay_value_set:
    #   name: "Delay Time"
    starting_kWh:
      name: "External Meter Initial Value"
    price_kWh:
      name: "kWh Price"

# I have disabled some settings to prevent accidentally cutting energy to my whole house, as the meter is connected at the mains
# switch:
#   - platform: dxs238xw
#     # energy_purchase_state:
#     #   name: "Activate Energy Purchase"
#     meter_state:
#       name: "State SmartMeter"
#     # delay_state:
#     #   name: "Activate Delay"

button:
  - platform: safe_mode
    name: "Restart ESP Module (Safe Mode)"
  - platform: factory_reset
    name: "Factory Reset Settings"
  - platform: restart
    name: "Restart ESP Module"
  - platform: dxs238xw
    reset_data:
      name: "Reset Energy Consumption"


binary_sensor:
  - platform: gpio
    internal: true
    id: button_0
    pin:
      number: GPIO13
      mode:
        input: true
        pullup: true
      inverted: true
    on_multi_click:
    - timing:
        - ON for at least 1s
      then:
        - dxs238xw.meter_state_toggle
      invalid_cooldown: 0ms

  - platform: dxs238xw
    warning_off_by_over_voltage:
      name: "Over Voltage Alert"
    warning_off_by_under_voltage:
      name: "Under Voltage Alert"
    warning_off_by_over_current:
      name: "Over Current Alert"
    warning_off_by_end_purchase:
      name: "End Purchase Alert"
    warning_off_by_end_delay:
      name: "End Delay Alert"
    warning_off_by_user:
      name: "Off by User Alert"
    warning_purchase_alarm:
      name: "Balance Purchase Alert"
    meter_state:
      name: "Relay State"

status_led:
  pin:
    number: GPIO14
    inverted: no
Hope this helps!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests