Small collection of random styling tweaks, fixes and Pythonism (#35390)
This commit is contained in:
parent
3feb55a8e4
commit
4cf186a47e
14 changed files with 28 additions and 57 deletions
|
@ -170,10 +170,8 @@ class ModbusCoilSwitch(ToggleEntity, RestoreEntity):
|
|||
self._available = False
|
||||
return
|
||||
|
||||
value = bool(result.bits[0])
|
||||
self._available = True
|
||||
|
||||
return value
|
||||
return bool(result.bits[0])
|
||||
|
||||
def _write_coil(self, coil, value):
|
||||
"""Write coil using the Modbus hub slave."""
|
||||
|
@ -288,10 +286,9 @@ class ModbusRegisterSwitch(ModbusCoilSwitch):
|
|||
self._available = False
|
||||
return
|
||||
|
||||
value = int(result.registers[0])
|
||||
self._available = True
|
||||
|
||||
return value
|
||||
return int(result.registers[0])
|
||||
|
||||
def _write_register(self, value):
|
||||
"""Write holding register using the Modbus hub slave."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue