Small collection of random styling tweaks, fixes and Pythonism (#35390)

This commit is contained in:
Franck Nijhof 2020-05-09 00:10:17 +02:00 committed by GitHub
parent 3feb55a8e4
commit 4cf186a47e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 28 additions and 57 deletions

View file

@ -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."""