Improve async/multithreaded behavior of tellstick code (#4989)
* Refactor tellstick code for increased readability. Especially highlight if "device" is a telldus core device or a HA entity. * Refactor Tellstick object model for increased clarity. * Update comments. Unify better with sensors. Fix typo bug. Add debug logging. * Refactor tellstick code for increased readability. Especially highlight if "device" is a telldus core device or a HA entity. * Refactor Tellstick object model for increased clarity. * Update comments. Unify better with sensors. Fix typo bug. Add debug logging. * Fix lint issues. * Remove global variable according to hint from balloob. * Better async/threading behavior for tellstick. * Fix lint/style checks. * Use hass.async_add_job
This commit is contained in:
1 parent
2a7a419ff3
commit
d9614cff46
3 files changed
+77
-44
No files matched your search
@@ -80,9 +80,10 @@ class TellstickLight(TellstickDevice, Light):
|
||||
else:
|
||||
self._state = False
|
||||
|
||||
def _send_tellstick_command(self):
|
||||
"""Let tellcore update the device to match the current state."""
|
||||
if self._state:
|
||||
self._tellcore_device.dim(self._brightness)
|
||||
def _send_device_command(self, requested_state, requested_data):
|
||||
"""Let tellcore update the actual device to the requested state."""
|
||||
if requested_state:
|
||||
brightness = requested_data
|
||||
self._tellcore_device.dim(brightness)
|
||||
else:
|
||||
self._tellcore_device.turn_off()
|
||||
Reference in new issue
Block a user