|
20 | 20 | from pymodbus.datastore import ModbusSequentialDataBlock, ModbusServerContext |
21 | 21 | from pymodbus.datastore.database import SqlSlaveContext |
22 | 22 | from pymodbus.device import ModbusDeviceIdentification |
23 | | -from pymodbus.server.async_io import StartTcpServer |
| 23 | +from pymodbus.server import StartAsyncTcpServer |
24 | 24 |
|
25 | 25 | # --------------------------------------------------------------------------- # |
26 | 26 | # import the modbus libraries we need |
@@ -68,7 +68,7 @@ def updating_writer(parm1): |
68 | 68 | log.debug(txt) |
69 | 69 |
|
70 | 70 |
|
71 | | -def run_dbstore_update_server(): |
| 71 | +async def run_dbstore_update_server(): |
72 | 72 | """Run dbstore update server.""" |
73 | 73 | # ----------------------------------------------------------------------- # |
74 | 74 | # initialize your data store |
@@ -100,8 +100,8 @@ def run_dbstore_update_server(): |
100 | 100 | loop = asyncio.get_event_loop() |
101 | 101 | loop.start(time, now=False) # initially delay by time |
102 | 102 | loop.stop() |
103 | | - StartTcpServer(context, identity=identity, address=("", 5020)) |
| 103 | + await StartAsyncTcpServer(context, identity=identity, address=("", 5020)) |
104 | 104 |
|
105 | 105 |
|
106 | 106 | if __name__ == "__main__": |
107 | | - run_dbstore_update_server() |
| 107 | + asyncio.run(run_dbstore_update_server()) |
0 commit comments