Closed robin-schoch closed 4 months ago
I have ran some test with the clemap energy monitor and i seems to work fine 😅 Some things to keep in mind:
@Zupeuc Have you been able to test the new api with a modbus device? If you like you may provide me your test environment for the modbus device and I will verify if the api is working.
here is some test code to access the sensor with the new api.
Device API:
from sgr_library import SGrDevice
device = SGrDevice()
device.update_xml_spec(<path to spec>).update_config(<path to ini file>).build()
await device.connect()
device_data = await device.read_data()
print(device_data)
fp = device.get_function_profile("PowerFactor")
fp_data = await fp.read()
print(fp_data)
dp = fp.get_data_point("PowerFactorTOT")
dp_data = await dp.read()
print(dp_data)
this is the output: Device
{
('ActivePowerAC', 'ActivePowerACtot'): -36.116,
('ActivePowerAC', 'ActivePowerACL1'): -37.591,
('ActivePowerAC', 'ActivePowerACL2'): 1.475,
('ActivePowerAC', 'ActivePowerACL3'): 0,
('ReactivePowerAC', 'ReactivePowerACtot'): 63.23,
('ReactivePowerAC', 'ReactivePowerACL1'): 56.278,
('ReactivePowerAC', 'ReactivePowerACL2'): 6.952,
('ReactivePowerAC', 'ReactivePowerACL3'): 0,
('ActiveEnergyAC', 'ActiveEnergyACTOT'): -0.69,
('ActiveEnergyAC', 'ActiveEnergyACL1'): -0.715,
('ActiveEnergyAC', 'ActiveEnergyACL2'): 0.025,
('ActiveEnergyAC', 'ActiveEnergyACL3'): 0,
('VoltageAC', 'VoltageTOT'): 462.194,
('VoltageAC', 'VoltageL1'): 230.71,
('VoltageAC', 'VoltageL2'): 231.484,
('VoltageAC', 'VoltageL3'): 0,
('CurrentAC', 'CurrentTOT'): 0.392,
('CurrentAC', 'CurrentL1'): 0.375,
('CurrentAC', 'CurrentL2'): 0.017,
('CurrentAC', 'CurrentL3'): 0,
('ApparentPowerAC', 'ApparentPowerTOT'): 90.718,
('ApparentPowerAC', 'ApparentPowerL1'): 86.555,
('ApparentPowerAC', 'ApparentPowerL2'): 4.163,
('ApparentPowerAC', 'ApparentPowerL3'): 0,
('PowerFactor', 'PowerFactorTOT'): 32.869,
('PowerFactor', 'PowerFactorL1'): 31.506,
('PowerFactor', 'PowerFactorL2'): 0.363,
('PowerFactor', 'PowerFactorL3'): 1
}
Function Profile
{
'PowerFactorTOT': 32.923,
'PowerFactorL1': 31.598,
'PowerFactorL2': 0.325,
'PowerFactorL3': 1
}
Data Point
32.923
Some stuff have to be enhanced as some some stuff like parameter handling is not supported and unclear how it should work.