Advertisement
Guest User

Untitled

a guest
Feb 14th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1.     # Old method
  2.     def turn_off(self, **kwargs):
  3.         """Turn off the light."""
  4.         self._device.switch_off()
  5.  
  6.  
  7.     # New method
  8.     def turn_off(self, **kwargs):
  9.         """Turn off the light."""
  10.         if self._device.switch_off():           # If response is valid
  11.             self.schedule_update_ha_state()     # Immediately update device state in HA
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement