mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Revised entity toggle to use is_on
The toggle function in the Entity ABC was using state == STATE_ON to determine whether the entity was on. This was revised to use the is_on property instead.
This commit is contained in:
parent
0624445627
commit
85aa4fdd2e
@ -177,7 +177,7 @@ class ToggleEntity(Entity):
|
||||
|
||||
def toggle(self, **kwargs):
|
||||
""" Toggle the entity off. """
|
||||
if self.state == STATE_ON:
|
||||
if self.is_on:
|
||||
self.turn_off(**kwargs)
|
||||
else:
|
||||
self.turn_on(**kwargs)
|
||||
|
Loading…
x
Reference in New Issue
Block a user