gavinying / modpoll

A New Command-line Tool for Modbus and MQTT
https://gavinying.github.io/modpoll
MIT License
84 stars 17 forks source link

morningstar float16 support #36

Closed mitchell-pioneer closed 6 months ago

mitchell-pioneer commented 6 months ago

Im using modpoll with a morningstar solar controller.

Their data is formatted using float16 not float32. I assume that not supported?

If not where could we add that in the source tree?

F16 Sample Calculation.pdf

mitchell-pioneer commented 6 months ago

So, i see float16 is supported in pymodbus.client_payload()

But not in modbus_task.pl

Looks like one charge is needed

            elif "float32" == ref.dtype:
                ref.update_value(decoder.decode_32bit_float())
                cur_ref += ref.ref_width

Duplicate that code and add

  elif "float16" == ref.dtype:
                ref.update_value(decoder.decode_16bit_float())
                cur_ref += ref.ref_width

I can do it if you want as a pull request?

gavinying commented 6 months ago

Hi @mitchell-pioneer , Cool, your contribution is most welcome.

Gavin

mitchell-pioneer commented 6 months ago

Gavin,

I was unable to work with the python packages so I just made changes to one file. here it is.

modbus_task.zip

What this does is provide support for Morningstar solar charge controllers

https://www.morningstarcorp.com/product_category/solar-charge-controllers/

Ill let you know if I find any other issues.

gavinying commented 6 months ago

Hi @mitchell-pioneer ,no worries. I'll merge your changes in the next release. Thanks. Would be great if you could share your Modbus configure file for Morningstar after you test it out. Happy coding!

mitchell-pioneer commented 6 months ago

I'm going to integrate to several of their charge controllers.. I'll send my results when their done.