mirror of
https://github.com/home-assistant/core.git
synced 2025-07-30 16:57:19 +00:00
Fix wirelesstag switch arm/disarm (#59515)
This commit is contained in:
parent
9cb4a5ca39
commit
04e1dc3a10
@ -73,16 +73,14 @@ class WirelessTagPlatform:
|
|||||||
|
|
||||||
def arm(self, switch):
|
def arm(self, switch):
|
||||||
"""Arm entity sensor monitoring."""
|
"""Arm entity sensor monitoring."""
|
||||||
func_name = f"arm_{switch.sensor_type}"
|
func_name = f"arm_{switch.entity_description.key}"
|
||||||
arm_func = getattr(self.api, func_name)
|
if (arm_func := getattr(self.api, func_name)) is not None:
|
||||||
if arm_func is not None:
|
|
||||||
arm_func(switch.tag_id, switch.tag_manager_mac)
|
arm_func(switch.tag_id, switch.tag_manager_mac)
|
||||||
|
|
||||||
def disarm(self, switch):
|
def disarm(self, switch):
|
||||||
"""Disarm entity sensor monitoring."""
|
"""Disarm entity sensor monitoring."""
|
||||||
func_name = f"disarm_{switch.sensor_type}"
|
func_name = f"disarm_{switch.entity_description.key}"
|
||||||
disarm_func = getattr(self.api, func_name)
|
if (disarm_func := getattr(self.api, func_name)) is not None:
|
||||||
if disarm_func is not None:
|
|
||||||
disarm_func(switch.tag_id, switch.tag_manager_mac)
|
disarm_func(switch.tag_id, switch.tag_manager_mac)
|
||||||
|
|
||||||
def start_monitoring(self):
|
def start_monitoring(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user