davidrapan / ha-solarman

⚡ Solarman Stick Logger integration for 🏠 Home Assistant
MIT License
110 stars 25 forks source link

Solarman DDZY422-D2 #187

Open bobybob69 opened 1 month ago

bobybob69 commented 1 month ago

Describe the bug A clear and concise description of what the bug is.

I try to install my Solarman DDZY422-D2 Smart Meter using the integration ha-solarman. When setting everything up, I got an error message "Échec de la configuration, nouvel essai: [SERIALNUMBER] Querying IP-ADRESS:PORT failed: [0, 0]."

Attach the debug log As a file or using the 'code' formatting.

To Reproduce Steps to reproduce the behavior:

From the setting, add an integration set your IP address Port Serial number select solarman_dtsd422-d3.yaml apply setting Wait for the confirmation and notice the error message "Échec de la configuration, nouvel essai: [SERIALNUMBER] Querying IP-ADRESS:PORT failed: [0, 0]."

Expected behavior A clear and concise description of what you expected to happen.

I don't know if it's the right configuration path as it's the D3 on the choice list

Screenshots If applicable, add screenshots to help explain your problem.

error solarman integration DDZY422-D2

Metadata: Version: 24.09.27

Additional context Add any other context about the problem here.

I don't know if it's a bug report or if it's a request feature to add the configuration .yaml for the D2 smart meter (I thought D2 / D3 where the same.. ?)

bobybob69 commented 1 month ago

about the log details, If you could explain how to extract them it would be helpful and I would be able to past the code here. thanks ! :)

davidrapan commented 1 month ago

Hi @bobybob69, like this: solarman_enable_debug

bobybob69 commented 1 month ago

Hi @davidrapan

Thanks for looking at the thread

it was running on my screenshot but I didn't understand the file was downloading when clicking on stop 😅

please found bellow the log file

home-assistant_solarman_2024-10-02T19-02-14.489Z.log.zip

Let me know if you get everything

thanks for looking at it ! and let me know if you need anything else to help

davidrapan commented 1 month ago

Extracted flow from the log file:

2024-10-02 21:00:41.664 DEBUG (MainThread) [custom_components.solarman.api] [????????????] Scheduling 2 query requests. #0
2024-10-02 21:00:41.664 DEBUG (MainThread) [custom_components.solarman.api] [????????????] Querying 0001 - 0041 | 0x0001 - 0x0029 # 041 ...
2024-10-02 21:00:41.664 INFO (MainThread) [custom_components.solarman.api] [????????????] Connecting to 17.0.0.81:8899
2024-10-02 21:00:41.672 DEBUG (MainThread) [custom_components.solarman.api] [????????????] SENT: a5 17 00 10 45 02 00 9e 8e ee 9b 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 00 01 00 29 d5 d4 fc 15
2024-10-02 21:00:43.683 DEBUG (MainThread) [custom_components.solarman.api] [????????????] RECD: a5 10 00 10 15 02 4a 9e 8e ee 9b 02 01 8d 8b 48 00 fc 15 00 00 ce 0c b5 66 05 00 a4 15
2024-10-02 21:00:43.684 DEBUG (MainThread) [custom_components.solarman.api] [????????????] Querying 0001 - 0041 | 0x0001 - 0x0029 # 041 failed. [V5FrameError: V5 frame does not contain a valid Modbus RTU frame]

Hi @githubDante, Exception with code 05 (0x05) | Acknowledge. Does it says anything useful? The profile is made for D3 version so it can be just about incompatibility but I'm curious what are your thoughts?

githubDante commented 1 month ago

Hi @davidrapan,

Incompatible profile 100% - wrong start address or quantity

davidrapan commented 1 month ago

Thanks @githubDante,

So you will have to try probe registers using built-in service for reading and create new profile for your device @bobybob69

bobybob69 commented 1 month ago

Hi @davidrapan and @githubDante thanks for looking at the log.

Well, I'm not familiar with that. What could I do to help implement that easily ?

After comparing D2 and D3 it seems like it's just difference of power distribution (simple-phase or triple-phase) D2 is a simple phase, the type of install I've at home.

Let me know I would be more than happy to help learn and implement that with one of you guys

Thanks for helping

bobybob69 commented 1 month ago

Let me know if there is anything I could do to help integrate the D2 guys

Thanks !

davidrapan commented 1 month ago

It's quite simple. You just have to copy for example inverter_definitions/solarman_dtsd422-d3.yaml into inverter_definitions/custom/solarman_ddzy422-d2.yaml

And you will have to find those register which shows matching values in the Solarman App.

Sadly without documentation there is no other way than trial and error.

bobybob69 commented 1 month ago

hi @davidrapan , thanks for the tips !

I try to do the copy / paste yaml parts. But the integration mark an error (see bellow) , I attach also the log.

Since the integration failed, there is nothing more for me to do using the Developper ACTION parts .. ?

action developer tool

Any tips that I could try to implement the D2 ?

Thanks !

integration error

home-assistant_solarman_2024-10-12T18-50-02.280Z.log

davidrapan commented 1 month ago

It's not relevant during this process and you can ignore it. Using ACTIONS will still work.

bobybob69 commented 1 month ago

Bellow are the log after adding the proper modbus register but I still have an issue..

Any thought @davidrapan ?

home-assistant_solarman_2024-10-12T19-24-08.095Z.log

davidrapan commented 1 month ago

According to the log requests to your Smart Meter still contains invalid addresses.

bobybob69 commented 1 month ago

Humm... progress but still some errors.. any thoughts @davidrapan from where I can found these modbus register ? any macOS tools I can use to read theses address using the IP ? I sent an email to see if they have theses for me as there is nothing on the user guide unfortunately

I found these on the net , what do you think ?

solarmlan_DDZY422.yaml.txt

davidrapan commented 1 month ago

Yeah it's not publicly available information and not sure if solarman will be willing to provide the docs.

from where I can found these modbus register ? any macOS tools I can use to read theses address using the IP ?

I told you using the ACTIONS through this integration. That is the best tool you can get.

I found these on the net , what do you think ?

I don't have the device so I can't really tell. But take it slowly. Just start even with single sensor defined in the file with registers you verified that works using said ACTIONS. 😉

githubDante commented 1 month ago

Found this through google solarmlan_DDZY422.yaml.txt

Edit: oops, looks like @bobybob69 found it too, sorry

bobybob69 commented 1 month ago

Hey @davidrapan @githubDante I think I understand how the actions from HA is working. However, how can I use it even if the Smart Meter isn't list ? Would it be better to use YAML config instead of UI ? And so what would be the next step ?

If I understand, There is an action I use to read values , but how can I read values from a devices that's not listed of even setup ? From what I understand from your previous message

Capture d’écran 2024-10-13 à 12 21 12 1

Bellow is what I'm seeing from the actions section when I choose reading value code 4 :

Capture d’écran 2024-10-13 à 12 17 42

Here's my config for the smart meter :

Capture d’écran 2024-10-13 à 12 17 26

I'm not familiar with the modbus things so sorry if I'm asking basic questions :)

Any tips would be helpful :)

Thanks guys !

davidrapan commented 1 month ago

If I understand, There is an action I use to read values , but how can I read values from a devices that's not listed of even setup ?

I told you that you have to setup the device first. And ignore when it shows errors. Then try read different registers and find those which works...

bobybob69 commented 1 month ago

I'm sorry if I don't understand but I just want to make I understand what you say @davidrapan

Did my thinking is on the right way ? If no please let me know

Thanks for your help I will owe you a coffee at the end 😜

davidrapan commented 1 month ago

first I need to found a way to have the meter not showing any error for the first setup (it doesn't matter if for sensor from the smart meter there is error right)

I'm saying again. it does not matter if it shows errors. IGNORE THEM! Just add it so you can use the ACTIONS. Thats all.

bobybob69 commented 1 month ago

hey guys @davidrapan @githubDante , I just get an answer from solarman, does this helps ?

Single Phase meter DDZY422-D2 parameters_1728884136958_yiy4p.pdf

bobybob69 commented 1 month ago

first I need to found a way to have the meter not showing any error for the first setup (it doesn't matter if for sensor from the smart meter there is error right)

I'm saying again. it does not matter if it shows errors. IGNORE THEM! Just add it so you can use the ACTIONS. Thats all.

To be faire @davidrapan , I should miss something.. I'm sorry. When you say "if it show error ignore them" what do you mean ?

Here's the status of the meter actually

Capture d’écran 2024-10-14 à 18 12 13

How can I ignore this error ? Even in this state, iit doesn't appear on the action menu .. :(

davidrapan commented 1 month ago

What I mean is that even you see error ACTIONS will still work so you just can leave it as it is.

bobybob69 commented 1 month ago

Well @davidrapan , don't ask me how, I change few line on the code (helped by ChatGPT) and now the smart meter is added

Capture d’écran 2024-10-14 à 18 40 25

now when I'm in the action menu what would be the best to troubleshoot each register ? I think I'm not using the correct syntax for the register .. ?

Capture d’écran 2024-10-14 à 18 39 24

what about this screenshot, I'm on the right way ?

thanks for helping

davidrapan commented 1 month ago

what about this screenshot, I'm on the right way ?

Yes you are. That means that you just can't read register number 1 so you need to continue with 2... and so on. But to be 100% sure I would also try reading using Modbus Function Code 3 (it has separate service for that).

bobybob69 commented 1 month ago

hi @davidrapan , hope you're well ! I spend almost a day to review register during my days off 😅

all of them failed with the same error : Échec de l'exécution de l'action solarman.read_holding_registers. V5 frame does not contain a valid Modbus RTU frame

I don't understand at all what could be the issue.

Any thought / Tips ? I was looking for an app that could read modbus from the solarman smart meter, but I don't found anything else.

Perhaps there is something wrong on the config no ?

Here's the code I try to set and that made the smart meter being available on HA without error as shared previously

If @githubDante you also have thoughts to help don't hesitate to share :)

Thanks guys for your support

#

Solarman Smart Meter DDZY422-D2

#

default: slave_id: 3 update_interval: 15 digits: 6 timeout: 30

requests:

parameters:

davidrapan commented 1 month ago

There are two ACTIONS for reading:

Did you also tried with the other one?

bobybob69 commented 1 month ago

Hey @davidrapan , yes I try with both methods. Still having same error message.

How can I be sure the meter is reachable from HA after I set it up ?

The IP if a fixed one so I'm 100% sure this is the good one.

What I'm less sure is the YAML for the config. It let me add the smart meter , but the only entities I've is "connection" and it appear "disconnected" I don't know if it's 100% sure but I've a doubt..

What's your thought ?

Thanks and have a great day

image

davidrapan commented 1 month ago

How can I be sure the meter is reachable from HA after I set it up ?

Because you are getting replies from it?

bobybob69 commented 1 month ago

I don't know @davidrapan ..

how can I know if I've answer, since the beginning I'm facing error so I don't know if I'm receiving anything..

Nothing else to do except the action button ?

What would you need (except the Modbus) to be able to add the smart meter into HA , even if it's without any data ?

davidrapan commented 1 month ago

V5 frame does not contain a valid modbus RTU frame.

This means that the device is talking with you but you send incorrect request.

bobybob69 commented 1 month ago

oh ok , so , it's a good things ..

But to be honest I try several number of Modbus register and none if working.. is there a way to at least have 1 modbus register that should works as it's kind of a standard ? No matter the register I always have theses error and I tried different combination .. no one works.

Capture d’écran 2024-10-16 à 20 49 51

Or if we compare to the solarman_dtsd422-d3.yaml , is there some "classic" register that should work 100% sure ?

Maybe this can help to see if it's working anyway

Thanks for your help @davidrapan as always

bobybob69 commented 1 month ago

I also saw this pages : HERE

Which register modbus should I use if I want to try ? dec or hex address ?

Thanks!

bobybob69 commented 1 month ago

Also get theses errors from the logs when trying each time the action of modbus reading.. which setting would need to be changed ?

Capture d’écran 2024-10-16 à 20 59 39
bobybob69 commented 4 weeks ago

Hey @davidrapan how are you ? Well, after few investigation here's what's I get from SOLARMAN It's in Chinese for the moment I'll need to translate and integrate it. If you want I can share it with you bellow if you want to take a look at the file and try isolate few data's. Thanks for your help as always

davidrapan commented 4 weeks ago

Sure thing, put the untranslated original here.

bobybob69 commented 4 weeks ago

hey @davidrapan please found bellow the file :)

Let me know if it's a good starting point !

DDZY422-D2型单相远程费控智能电能表-modbus通讯内容(HT-YF2018-0929-01)_1729757263801_10de75.xlsx

bobybob69 commented 3 weeks ago

Hey @davidrapan Does that helps ? I try on my side but I didn't found a way to have it works I shoukd have something set wrong at some point ..

davidrapan commented 3 weeks ago

If you have still issues just take it slowly. Create file with just single entity description and add more after you make sure that what you already have works.

davidrapan commented 3 weeks ago

Hey @bobybob69, try this:

#
# Solarman Smart Meter DDZY422-D2
#
# Reference: https://github.com/user-attachments/files/17586995/DDZY422-D2.-modbus.HT-YF2018-0929-01._1729757263801_10de75.xlsx
#

default:
  update_interval: 5
  digits: 3

parameters:
  - group: Variable Data 1
    items:
      - name: Voltage
        class: voltage
        uom: V
        scale: 0.1
        rule: 1
        registers: [0x0001]

      - name: Current
        class: current
        uom: A
        scale: 0.001
        rule: 2
        magnitude: True
        registers: [0x0003, 0x0002]

      - name: Power
        class: power
        uom: W
        scale: 1
        rule: 2
        magnitude: True
        registers: [0x0007, 0x0006]

      - name: Power Factor
        class: power_factor
        state_class: measurement
        scale: 0.001
        rule: 2
        magnitude: True
        registers: [0x000C]

      - name: Frequency
        class: frequency
        state_class: measurement
        uom: Hz
        scale: 0.01
        rule: 1
        registers: [0x000D]
bobybob69 commented 3 weeks ago

hey @davidrapan

I got the same error message .. "Échec de la configuration, nouvel essai: [2616102558] V5FrameError: V5 frame does not contain a valid Modbus RTU frame"

As you did the file and you used the modbus config Solarman share with me for this model, it confirm there is something else wrong on my side.. but what could be wrong ?

Bellow is the config from the solarman

smart meter config

Can it be the port that's not the good one ?

Maybe the way I use add the config ?

I'm using File Editor module then I go to customer component > solarman > inverter_definitions > I create a file I named solarman_DDZY422-D2.yaml and I copy paste the code you sent. Then I save and I restart entirely my HA instance..

file editor config

Ping on the IP from the smart meter is working so I know there is a response from the smart meter.

What could be wrong here ? :/

thanks mate for our collaboration I appreciate !

davidrapan commented 3 weeks ago

I'm using File Editor module then I go to customer component > solarman > inverter_definitions > I create a file I named solarman_DDZY422-D2.yaml and I copy paste the code you sent. Then I save and I restart entirely my HA instance..

You did it correctly!

Enable debug log and upload the file.

davidrapan commented 3 weeks ago

I can't see in the doc to which memory area are the registers mapped so maybe it's worth the shot to try 0x04.

Try to replace that default section with:

default:
  update_interval: 5
  code: 0x04
  digits: 3
bobybob69 commented 2 weeks ago

hi @davidrapan , I tried to adjust the default section as you mentioned but nothing changed Please found bellow the logs.

So if I understand, we are just looking for the correct memory right ? and for you, all the rest of the config is ok 👍

home-assistant_solarman_2024-11-03T20-38-21.631Z.log

davidrapan commented 2 weeks ago

Yeah well if it's not even working with this minimal yaml file (which is was made using xlsx file you provided)...

I'm afraid that there is something else going on which is outside of our reach.

I'm out of ideas... there is proly not much we can do, right @githubDante?

githubDante commented 2 weeks ago

Why don't you try with the registers from the XLS file e.g. from 0x105 to 0x107 ? It's a 6 byte Date&Time.

davidrapan commented 2 weeks ago

Okay, try this one:

#
# Solarman Smart Meter DDZY422-D2
#
# Reference: https://github.com/user-attachments/files/17586995/DDZY422-D2.-modbus.HT-YF2018-0929-01._1729757263801_10de75.xlsx
#

default:
  update_interval: 5
  digits: 3

parameters:
  - group: Variable Data 1
    items:
      - name: Date & Time
        platform: datetime
        rule: 8
        registers: [0x0105, 0x0106, 0x0107]
bobybob69 commented 2 weeks ago

hey guys @githubDante @davidrapan

just tried now, and still same error message ... "Echec de la configuration, nouvel essai: [2616102558] V5FrameError: V5 frame does not contain a valid Modbus RTU frame"

please found bellow the logs (in the meantime It can maybe help for #203 as logs turn all day until it turn off when I restart HomeAssistant during no solar production)

home-assistant_solarman_2024-11-04T20-14-28.300Z.log

you confirm when I made the change from the config file, I restart HA instance and I re-set the meter ?

thanks guys

davidrapan commented 2 weeks ago

Uhm but you don't have that device (2616102558) configured w/ solarman_DDZY422-D2.yaml!

I see it configured with deye_hybrid.yaml!

bobybob69 commented 2 weeks ago

Hummmm strange I double checked, it's configured with the right profile..

See logs bellow

home-assistant_solarman_2024-11-04T20-28-09.595Z.log