some more tests
This commit is contained in:
parent
234b519930
commit
6769518f67
1 changed files with 13 additions and 3 deletions
|
@ -1,7 +1,8 @@
|
|||
#!/usr/bin/env python3
|
||||
import unittest
|
||||
|
||||
from pyfroniusreg import gen24_registers
|
||||
from pyfroniusreg import gen24_primo_symo_inverter_register_map_float_storage as gen24_registers
|
||||
from pyfroniusreg import smart_meter_register_map_float as smart_meter
|
||||
|
||||
from pymodbus.client.tcp import ModbusTcpClient
|
||||
|
||||
|
@ -9,7 +10,7 @@ fronius1 = ModbusTcpClient("172.19.107.211", port=502, timeout=10)
|
|||
fronius1.connect()
|
||||
|
||||
|
||||
class TestRead(unittest.TestCase):
|
||||
class TestReadRegs(unittest.TestCase):
|
||||
def test_read_scaled(self):
|
||||
soc = gen24_registers.scaledChaState.get(fronius1)
|
||||
assert isinstance(soc, float)
|
||||
|
@ -35,7 +36,7 @@ class TestRead(unittest.TestCase):
|
|||
# This doesn't seem to return anything useful
|
||||
# SN = gen24_registers.SN.get(fronius1)
|
||||
# assert SN == "12345567"
|
||||
|
||||
class testWriteRegs(unittest.TestCase):
|
||||
def test_write_direct(self):
|
||||
current = gen24_registers.OutWRte.get(fronius1)
|
||||
retval = gen24_registers.OutWRte.set(fronius1, current)
|
||||
|
@ -46,6 +47,15 @@ class TestRead(unittest.TestCase):
|
|||
retval = gen24_registers.scaledInWRte.set(fronius1, current)
|
||||
assert retval is not None
|
||||
|
||||
class testSmartMeter(unittest.TestCase):
|
||||
def test_freq_read(self):
|
||||
Hz = smart_meter.Hz.get(fronius1)
|
||||
print(Hz)
|
||||
assert isinstance(Hz, float)
|
||||
|
||||
def test_import_read(self):
|
||||
wh_import = smart_meter.TotWhImp.get(fronius1)
|
||||
assert isinstance(wh_import, float)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in a new issue