Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional support for per meter byte order and some additional per register configs. #205

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

l0ne5tar
Copy link

  • Add optional 'byteorder' field to meters.
  • Add optional 'functioncodes' list, enables the config to specify function code used when reading individual registers.
  • Add optional 'datatypes' list, allows config to specify int or float type per register. Overrides meter's own 'datatype' when declared.
  • Provided example config of sontex EIA-485 modbus module.
  • Fix for meter parameter reading where only only one register is declared.

… register configs.

 - Add optional per meter 'byteorder' field.
 - Add optional 'functioncodes' list, enables the config to specify function code used when reading individual registers.
 - Add optional 'datatypes' list, allows config to specify int or float type per register. Overrides meter's own 'datatype' when declared.
 - Provided example config of sontex EIA-485 modbus module.
 - Fix for meter parameter reading where only only one register is declared.
@l0ne5tar
Copy link
Author

Hi,
Sorry if this looks a bit rough, I've only been looking at this for a day or so, i thought i'd share in case its useful though.

Anyway, my setup (which was installed for some local electrification of heat gov study) is an SDM630 + sontex superstatic 449 + EIA485 modbus module.

https://sontex.ch/wp-content/uploads/2019/02/supercal531-modbus-ds-en.pdf

I was able to read from the SDM630 out of the box, but the heat meter requires a different byte order to properly read float data.
The functioncode and datatypes stuff was added because the device also has a mixture of int and float types, ive experimented with those locally but theyre not used in the example provided.

I wanted to do it this way because IMO the config should be able to configure the device without any hard coded device specific tests in the interfacer code..

@@ -223,6 +253,11 @@ def read(self):


def set(self, **kwargs):

def as_list(src):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because a single value in the meter field appears to be read as individual chars, i.e.
registers = 724
comes out as if
registers = 7,2,4

@@ -66,6 +66,24 @@
names = V1,V2,V3,I1,I2,I3,P1,P2,P3,TotalPower,Import_kWh,Export_kWh
precision = 2,2,2,2,2,2,2,2,2,2,2,2

[[SONTEX_EIA485]]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just my setup verbatim, it may not be suitable as a generic config example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant