read_all() without params only return INPUT registers
radokristof opened this issue · 3 comments
Not specifying the HOLDING register type at read_all() call, will only return INPUT registers, at least for SDM630
Docs: "Read all input registers by passing the sdm_modbus.registerType.INPUT enum to read_all(). Leave this blank to read both INPUT and HOLDING registers"
pprint.pprint(device.read_all())
{'current_ln': 0.0,
'current_thd': 0.0,
'export_demand_power_active': 0.0,
'export_energy_active': 0.37199997901916504,
'export_energy_reactive': 583.0469970703125,
'frequency': 49.89070129394531,
'import_demand_power_active': 0.0,
'import_energy_active': 804.8999633789062,
'import_energy_reactive': 129.14698791503906,
'l12_voltage': 0.0,
'l12_voltage_thd': 0.0,
'l1_current': 0.0,
'l1_current_thd': 0.0,
'l1_demand_current': 0.0,
'l1_energy_active': 525.7909545898438,
'l1_energy_reactive': 579.3109741210938,
'l1_export_energy_active': 0.001999999862164259,
'l1_export_energy_reactive': 485.68798828125,
'l1_import_energy_active': 525.7889404296875,
'l1_import_energy_reactive': 93.62299346923828,
'l1_phase_angle': 0.0,
'l1_power_active': 0.0,
'l1_power_apparent': 0.0,
'l1_power_factor': 1.0,
'l1_power_reactive': 0.0,
'l1_voltage': 229.43565368652344,
'l1n_voltage_thd': 8.806034088134766,
'l23_voltage': 0.0,
'l23_voltage_thd': 0.0,
'l2_current': 0.0,
'l2_current_thd': 0.0,
'l2_demand_current': 0.0,
'l2_energy_active': 96.83299255371094,
'l2_energy_reactive': 19.376998901367188,
'l2_export_energy_active': 0.2069999873638153,
'l2_export_energy_reactive': 14.773999214172363,
'l2_import_energy_active': 96.6259994506836,
'l2_import_energy_reactive': 4.602999687194824,
'l2_phase_angle': 0.0,
'l2_power_active': 0.0,
'l2_power_apparent': 0.0,
'l2_power_factor': 1.0,
'l2_power_reactive': 0.0,
'l2_voltage': 0.0,
'l2n_voltage_thd': 0.0,
'l31_voltage': 0.0,
'l31_voltage_thd': 0.0,
'l3_current': 0.0,
'l3_current_thd': 0.0,
'l3_demand_current': 0.0,
'l3_energy_active': 182.6479949951172,
'l3_energy_reactive': 113.50599670410156,
'l3_export_energy_active': 0.1629999876022339,
'l3_export_energy_reactive': 82.58499908447266,
'l3_import_energy_active': 182.4849853515625,
'l3_import_energy_reactive': 30.92099952697754,
'l3_phase_angle': 0.0,
'l3_power_active': 0.0,
'l3_power_apparent': 0.0,
'l3_power_factor': 1.0,
'l3_power_reactive': 0.0,
'l3_voltage': 0.0,
'l3n_voltage_thd': 0.0,
'maximum_demand_power_apparent': 10103.8642578125,
'maximum_export_demand_power_active': 0.0,
'maximum_import_demand_power_active': 0.0,
'maximum_import_demand_power_apparent': 10086.0205078125,
'maximum_l1_demand_current': 14.158466339111328,
'maximum_l2_demand_current': 14.047806739807129,
'maximum_l3_demand_current': 14.147042274475098,
'maximum_neutral_demand_current': 12.891606330871582,
'neutral_current': 0.0,
'neutral_demand_current': 0.0,
'total_current': 5580.8583984375,
'total_demand_power_apparent': 0.0,
'total_energy_active': 805.27197265625,
'total_energy_apparent': 1075.0269775390625,
'total_energy_reactive': 712.1939697265625,
'total_import_demand_power_active': 0.0,
'total_line_current': 0.0,
'total_pf': 0.0,
'total_phase_angle': 0.0,
'total_power_active': 0.0,
'total_power_apparent': 0.0,
'total_power_factor': 1.0,
'total_power_reactive': 0.0,
'voltage_ll': 0.0,
'voltage_ll_thd': 0.0,
'voltage_ln': 76.49174499511719,
'voltage_ln_thd': 2.9353444576263428}
Same for SDM120
Good catch. Looks like a case of writing wishful documentation.
I've reworded the readme as reworking read_all()
and _read_all()
to handle both register types at the same time is a bit more work than I'm able to commit to at this time. Feel free to pass a PR if you have an elegant fix.
Thanks for your fast response! For me, it is enough to read INPUT/HOLDING registers separately, I just thought that something is wrong on my side