Skip to content

Commit

Permalink
fix wake up for xiaoai
Browse files Browse the repository at this point in the history
  • Loading branch information
al-one committed Sep 29, 2024
1 parent 5bb200e commit 8488c49
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion custom_components/xiaomi_miot/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ def set_state(self, data: dict):
pass

async def async_press(self):
await self.device.async_write({self.attr: getattr(self.conv, 'value', None)})
pms = getattr(self.conv, 'value', None)
if self._miot_action and self._miot_action.ins:
pms = self.custom_config_list('action_params', pms)
await self.device.async_write({self.attr: pms})

XEntity.CLS[ENTITY_DOMAIN] = ButtonEntity

Expand Down
5 changes: 5 additions & 0 deletions custom_components/xiaomi_miot/core/device_customizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1482,6 +1482,11 @@
'button_actions': 'wake_up,play_music,tv_switchon,stop_alarm',
'text_actions': 'play_text,execute_text_directive',
},
'xiaomi.wifispeaker.l04m:wake_up': {'action_params': ''},
'xiaomi.wifispeaker.l06a:wake_up': {'action_params': ''},
'xiaomi.wifispeaker.l09a:wake_up': {'action_params': ''},
'xiaomi.wifispeaker.lx04:wake_up': {'action_params': ''},
'xiaomi.wifispeaker.x08a:wake_up': {'action_params': ''},
'xjx.toilet.relax': {
'button_actions': 'flush_on',
},
Expand Down
2 changes: 1 addition & 1 deletion custom_components/xiaomi_miot/core/miot_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

_LOGGER = logging.getLogger(__name__)

# https://iot.mi.com/new/doc/guidelines-for-access/other-platform-access/control-api#MIOT%E7%8A%B6%E6%80%81%E7%A0%81
# https://iot.mi.com/new/doc/accesses/direct-access/other-platform-access/control-api#MIOT%E7%8A%B6%E6%80%81%E7%A0%81
SPEC_ERRORS = {
'000': 'Unknown',
'001': 'Device does not exist',
Expand Down

0 comments on commit 8488c49

Please sign in to comment.