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

Minimalmodbus add rid175 #179

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

dave-mc
Copy link

@dave-mc dave-mc commented Oct 4, 2022

Updated minimalmodbusinterfacer to add support for RI-D175 single phase modbus meter
This is a low cost 45A meter widely available from electrical wholesalers (i.e. CEF) mechanically it has some advantages over the widely used SDM120 as it allows up to 10mmsq cables and provides connections for 2 neutrals so does not require a separate 'T' connection in the neutral.
Data is returned from the meter as a long with bcd coded data.

Data Sheets attached below
RI_Data_Sheet_RI-D175_MID_01_12_20.pdf
RI-D175-C-COM-Modbus protocol-V02.pdf

updated interface to add RI-D175M meter
This meter codes results in BCD
fixed missing quotes around meter type check
Debugged version of code to read RI-D175 meter with bcd output
Updated to make meter_type consistent
Added additional meter_types for all supported meters. Fallback using datatype still available
Using meter_type allows different meters to share same rs485 interface providing serial parameters match.
Updated config examples to show different meter types using same serial port
Updated from SDM120 readme to show additional meter types
showing examples of supported meters and mixed meters on single serial interface
@@ -245,6 +299,9 @@ def set(self, **kwargs):
if 'address' in setting[meter]:
address = int(setting[meter]['address'])
self._log.info("Setting %s meters %s address %s", self.name, meter, address)

if 'type' in setting[meter]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this backward compatible?

Copy link
Author

Choose a reason for hiding this comment

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

Hi Brian,
yes I think so, if no type is defined then it uses the previous method of working out which meter to use.
I have just tested on my install which uses the new version and put the following config in and it picks up the SDM120 and reads the values
[[SDM120]]
Type = EmonHubMinimalModbusInterfacer
[[[init_settings]]]
device = /dev/ttyUSB0
baud = 9600
[[[runtimesettings]]]
pubchannels = ToEmonCMS,
read_interval = 10
nodename = sdm120
# prefix = sdm_
[[[[meters]]]]
[[[[[sdm120]]]]]
address = 3
registers = 0,6,12,18,30,70,72,74,76
names = V,I,P,VA,PF,FR,EI,EE,RI
precision = 2,3,1,1,3,3,3,3,3

Copy link
Author

Choose a reason for hiding this comment

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

heres the elif statements after the type lookups
'''
elif self.datatype == 'int':
value = self._rs485.read_register(int(self._settings['meters'][meter]['registers'][i]), functioncode=3)
elif self.datatype == 'float':
value = self._rs485.read_float(int(self._settings['meters'][meter]['registers'][i]), functioncode=4, number_of_registers=2)
'''

some of the scaling parameters needed adjustment to get the correct value.
some scaling factors needed adjusting to get correct readings
@dave-mc
Copy link
Author

dave-mc commented Oct 28, 2022

I have updated some of the scaling factors to get the correct results from the RID175 meter

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.

2 participants