Skip to content

Commit

Permalink
Update modbus.py
Browse files Browse the repository at this point in the history
适配最新版HA2023.2.3
  • Loading branch information
xiaxianguyue authored Feb 9, 2023
1 parent c4283dd commit 7463e3f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions custom_components/peacefair_energy/modbus.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from pymodbus.client.sync import ModbusTcpClient, ModbusUdpClient
from pymodbus.client import ModbusTcpClient, ModbusUdpClient
from pymodbus.transaction import ModbusRtuFramer, ModbusIOException
from pymodbus.pdu import ModbusRequest
import threading
Expand Down Expand Up @@ -84,12 +84,12 @@ def read_holding_register(self):

def read_input_registers(self, address, count):
with self._lock:
kwargs = {"unit": self._slave}
kwargs = {"slave": self._slave}
return self._client.read_input_registers(address, count, **kwargs)

def reset_energy(self):
with self._lock:
kwargs = {"unit": self._slave}
kwargs = {"slave": self._slave}
request = ModbusResetEnergyRequest(**kwargs)
self._client.execute(request)

Expand Down

0 comments on commit 7463e3f

Please sign in to comment.