third version before modbus cleanup
This commit is contained in:
@@ -47,8 +47,8 @@ async def poll_inverter(site_id: int, db: asyncpg.Connection) -> None:
|
||||
port = int(row["port"] or 502)
|
||||
unit_id = int(row["unit_id"] if row["unit_id"] is not None else 1)
|
||||
try:
|
||||
client = await get_modbus_client(host, port, unit_id)
|
||||
async with client.batch() as mb:
|
||||
client = await get_modbus_client(host, port)
|
||||
async with client.batch(unit_id) as mb:
|
||||
run_state = await mb.read_register(DEYE_REG_RUN_STATE)
|
||||
battery_soc = await mb.read_register(DEYE_REG_BATTERY_SOC)
|
||||
battery_power = await mb.read_register_signed(DEYE_REG_BATTERY_POWER_FLOW)
|
||||
|
||||
Reference in New Issue
Block a user