Fix xiaomi_miio button platform regression (#100527)

pull/100608/head
Teemu R 2023-09-19 17:15:43 +02:00 committed by GitHub
parent c3f74ae022
commit 7c4f08e6b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 5 deletions

View File

@ -169,8 +169,12 @@ class XiaomiGenericCoordinatedButton(XiaomiCoordinatedMiioEntity, ButtonEntity):
async def async_press(self) -> None: async def async_press(self) -> None:
"""Press the button.""" """Press the button."""
method = getattr(self._device, self.entity_description.method_press) method = getattr(self._device, self.entity_description.method_press)
params = self.entity_description.method_press_params
if params is not None:
await self._try_command( await self._try_command(
self.entity_description.method_press_error_message, self.entity_description.method_press_error_message, method, params
method, )
self.entity_description.method_press_params, else:
await self._try_command(
self.entity_description.method_press_error_message, method
) )