mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 18:39:30 +00:00
Modbus fixes to work with pymodbus 1.3.1 (#8365)
* Fixed a bug where changing fan speed was not possible * Bump pymodbus version to 1.3.1 to fix issue #8285 * Changed all modbus components so that they use CONF_SLAVE from const.py * Fix checking result from a modbus transaction * Add missing decorator * Added modbus write coil service and added descriptions * Removed a hiding debug print
This commit is contained in:
committed by
Paulus Schoutsen
parent
9bc5cd2d4b
commit
c48c2b00a8
@@ -49,6 +49,7 @@ class ModbusCoilSensor(BinarySensorDevice):
|
||||
self._coil = int(coil)
|
||||
self._value = None
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name of the sensor."""
|
||||
return self._name
|
||||
@@ -61,4 +62,10 @@ class ModbusCoilSensor(BinarySensorDevice):
|
||||
def update(self):
|
||||
"""Update the state of the sensor."""
|
||||
result = modbus.HUB.read_coils(self._slave, self._coil, 1)
|
||||
self._value = result.bits[0]
|
||||
try:
|
||||
self._value = result.bits[0]
|
||||
except AttributeError:
|
||||
_LOGGER.error(
|
||||
'No response from modbus slave %s coil %s',
|
||||
self._slave,
|
||||
self._coil)
|
||||
|
||||
Reference in New Issue
Block a user