1- """ A basic client demonstrating how to use the async version of pysolarmanv5."""
1+ """A basic client demonstrating how to use the async version of pysolarmanv5."""
2+
23from pysolarmanv5 import PySolarmanV5Async
34import asyncio
45
@@ -11,7 +12,12 @@ async def main():
1112 respectively.
1213 """
1314 modbus = PySolarmanV5Async (
14- '192.168.1.121' , 1234567890 , port = 8899 , mb_slave_id = 1 , verbose = False , auto_reconnect = True
15+ "192.168.1.121" ,
16+ 1234567890 ,
17+ port = 8899 ,
18+ mb_slave_id = 1 ,
19+ verbose = False ,
20+ auto_reconnect = True ,
1521 )
1622 await modbus .connect ()
1723
@@ -27,15 +33,18 @@ async def main():
2733 """Query single input register, apply scaling, result as a float"""
2834
2935 print (
30- await modbus .read_input_register_formatted (register_addr = 33035 , quantity = 1 , scale = 0.1 )
36+ await modbus .read_input_register_formatted (
37+ register_addr = 33035 , quantity = 1 , scale = 0.1
38+ )
3139 )
3240
3341 """Query two input registers, shift first register up by 16 bits, result as a signed int, """
3442 print (
35- await modbus .read_input_register_formatted (register_addr = 33079 , quantity = 2 , signed = 1 )
43+ await modbus .read_input_register_formatted (
44+ register_addr = 33079 , quantity = 2 , signed = 1
45+ )
3646 )
3747
38-
3948 """Query single holding register, apply bitmask and bitshift left (extract bit1 from register)"""
4049 print (
4150 await modbus .read_holding_register_formatted (
@@ -45,5 +54,6 @@ async def main():
4554
4655 await modbus .disconnect ()
4756
57+
4858if __name__ == "__main__" :
4959 asyncio .run (main ())
0 commit comments