|
| 1 | +--- |
| 2 | +layout: page |
| 3 | +title: "Xiaomi IR Remote" |
| 4 | +description: "Instructions for how to integrate the Xiaomi IR Remote within Home Assistant." |
| 5 | +date: 2017-01-25 17:08 |
| 6 | +sidebar: true |
| 7 | +comments: false |
| 8 | +sharing: true |
| 9 | +footer: true |
| 10 | +logo: xiaomi.png |
| 11 | +ha_category: Remote |
| 12 | +ha_release: 0.63 |
| 13 | +ha_iot_class: "Local Polling" |
| 14 | +--- |
| 15 | + |
| 16 | +The `xiaomi miio` remote platform allows you to send IR commands from your Xiaomi IR Remote (ChuangmiIr). |
| 17 | + |
| 18 | +Please follow the instructions on [Retrieving the Access Token](/components/vacuum.xiaomi_miio/#retrieving-the-access-token) to get the API token to use in the `configuration.yaml` file. |
| 19 | + |
| 20 | +## {% linkable_title Configuring the Platform %} |
| 21 | + |
| 22 | +To add a Xiaomi IR Remote to your installation, add the following to your configuration.yaml file: |
| 23 | +```yaml |
| 24 | +remote: |
| 25 | + - platform: xiaomi_miio |
| 26 | + host: 192.168.42.42 |
| 27 | + token: YOUR_TOKEN |
| 28 | +``` |
| 29 | +
|
| 30 | +{% configuration %} |
| 31 | +host: |
| 32 | + description: The IP of your remote. |
| 33 | + required: true |
| 34 | + type: string |
| 35 | +token: |
| 36 | + description: The API token of your remote. |
| 37 | + required: true |
| 38 | + type: string |
| 39 | +name: |
| 40 | + description: The name of your remote. |
| 41 | + required: false |
| 42 | + type: string |
| 43 | +slot: |
| 44 | + description: The slot used to save learned command. |
| 45 | + required: false |
| 46 | + type: int |
| 47 | + default: 1 |
| 48 | +timeout: |
| 49 | + description: Timeout for learning a new command. |
| 50 | + required: false |
| 51 | + type: int |
| 52 | + default: 30 |
| 53 | +hidden: |
| 54 | + description: Hide the entity from UI. There is currently no reason to show the entity in UI as turning it off or on does nothing. |
| 55 | + required: false |
| 56 | + type: boolean |
| 57 | + default: True |
| 58 | +commands: |
| 59 | + required: false |
| 60 | + type: map |
| 61 | + keys: |
| 62 | + command: |
| 63 | + description: A list of commands as [raw (learned command)](/components/remote.xiaomi_miio/#raw) or [pronto hex code](/components/remote.xiaomi_miio/#pronto-hex-code). |
| 64 | + required: true |
| 65 | + type: list |
| 66 | +
|
| 67 | +{% endconfiguration %} |
| 68 | +
|
| 69 | +## {% linkable_title Full Configuration %} |
| 70 | +
|
| 71 | +```yaml |
| 72 | +remote: |
| 73 | + - platform: xiaomi_miio |
| 74 | + name: "bathroom remote" |
| 75 | + host: 192.168.42.42 |
| 76 | + token: YOUR_TOKEN |
| 77 | + slot: 1 |
| 78 | + timeout: 30 |
| 79 | + hidden: false |
| 80 | + commands: |
| 81 | + activate_towel_heater: |
| 82 | + command: |
| 83 | + - raw:base64:[optional_frequency] |
| 84 | + read_bad_poem: |
| 85 | + command: |
| 86 | + - raw:base64:[optional_frequency] |
| 87 | + - pronto:pronto_hex:[optional_repeat] |
| 88 | +``` |
| 89 | +
|
| 90 | +## {% linkable_title Use named commands to create UI buttons %} |
| 91 | +
|
| 92 | +```yaml |
| 93 | +script: |
| 94 | + towel_heater: |
| 95 | + sequence: |
| 96 | + - service: remote.send_command |
| 97 | + entity_id: 'remote.bathroom_remote' |
| 98 | + data: |
| 99 | + command: |
| 100 | + - 'activate_towel_heater' |
| 101 | + please_cover_your_ears: |
| 102 | + sequence: |
| 103 | + - service: remote.send_command |
| 104 | + entity_id: 'remote.bathroom_remote' |
| 105 | + data: |
| 106 | + command: |
| 107 | + - 'read_bad_poem' |
| 108 | +``` |
| 109 | +
|
| 110 | +## {% linkable_title Command Types %} |
| 111 | +
|
| 112 | +The Xiaomi IR Remote Platform currently supports two different formats for IR codes. |
| 113 | +
|
| 114 | +### {% linkable_title Raw %} |
| 115 | +
|
| 116 | +A raw command is a command learned from [`remote.xiaomi_miio_learn_command`](/components/remote.xiaomi_miio/#remotexiaomi_miio_learn_command). |
| 117 | + |
| 118 | +A raw command is defined as in the following example: |
| 119 | +`raw:Z6UFANEAAAAjAQAAAwkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQIAE=` |
| 120 | +with an optional last parameter of frequency: |
| 121 | +`raw:Z6UFANEAAAAjAQAAAwkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQIAE=:38400` |
| 122 | + |
| 123 | +### {% linkable_title Pronto Hex Code %} |
| 124 | + |
| 125 | +A pronto hex code is a hex code often supplied by the device manufacturer. |
| 126 | + |
| 127 | +A pronto hex code is defined as in the following example: |
| 128 | +`pronto:0000 006C 0022 0002 015B 00AD 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0041 0016 0016 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0016 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0623 015B 0057 0016 0E6E` |
| 129 | +with an optional last parameter of repeats (required by some devices): |
| 130 | +`pronto:0000 006C 0022 0002 015B 00AD 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0041 0016 0016 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0016 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0623 015B 0057 0016 0E6E:2` |
| 131 | + |
| 132 | +## {% linkable_title Platform Services %} |
| 133 | + |
| 134 | +The Xiaomi IR Remote Platform registers two services. |
| 135 | + |
| 136 | +### {% linkable_title `remote.send_command` %} |
| 137 | + |
| 138 | +Allows sending either named commands using an identifier or sending commands as one of the two types defined in [Command Types](/components/remote.xiaomi_miio/#command-types). |
| 139 | + |
| 140 | +### {% linkable_title `remote.xiaomi_miio_learn_command` %} |
| 141 | + |
| 142 | +Used to learn new commands. |
| 143 | + |
| 144 | +Use the entity_id of the Xiaomi IR Remote to start a learning process. |
| 145 | + |
| 146 | +`slot` and `timeout` can be specified, but multiple commands learned to the same slot can still be sent using [`remote.send_command`](/components/remote.xiaomi_miio/#remotesend_command) even if they are overwritten. |
| 147 | + |
| 148 | +After learning the command the base64 string can be found as a notification in Overview, the string can be copied by left clicking on the string and choose the copy option. |
0 commit comments