mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Add doc strings
This commit is contained in:
parent
61fb8271e5
commit
476e4f0517
@ -192,12 +192,15 @@ class Scene(ToggleEntity):
|
|||||||
for key, value in state.attributes.items()))
|
for key, value in state.attributes.items()))
|
||||||
|
|
||||||
def _fuzzy_attribute_compare(self, a, b):
|
def _fuzzy_attribute_compare(self, a, b):
|
||||||
|
""" Compare the attributes passed, use fuzzy logic if they are floats. """
|
||||||
|
|
||||||
if not (isinstance(a, float) and isinstance(b, float)):
|
if not (isinstance(a, float) and isinstance(b, float)):
|
||||||
return False
|
return False
|
||||||
diff = abs(a - b) / (abs(a) + abs(b))
|
diff = abs(a - b) / (abs(a) + abs(b))
|
||||||
return diff <= self.scene_config.fuzzy_match
|
return diff <= self.scene_config.fuzzy_match
|
||||||
|
|
||||||
def _compare_state_attribites(self, attr1, attr2):
|
def _compare_state_attribites(self, attr1, attr2):
|
||||||
|
""" Compare the attributes passed, using fuzzy logic if specified. """
|
||||||
if attr1 == attr2:
|
if attr1 == attr2:
|
||||||
return True
|
return True
|
||||||
if not self.scene_config.fuzzy_match:
|
if not self.scene_config.fuzzy_match:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user