Xiaomi IR Remote
The xiaomi miio
remote platform allows you to send IR commands from your Xiaomi IR Remote (ChuangmiIr).
Please follow the instructions on Retrieving the Access Token to get the API token to use in the configuration.yaml
file.
Configuring the Platform
To add a Xiaomi IR Remote to your installation, add the following to your configuration.yaml file:
remote:
- platform: xiaomi_miio
host: 192.168.42.42
token: YOUR_TOKEN
Configuration Variables
- host
-
(string)(Required)The IP of your remote.
- token
-
(string)(Required)The API token of your remote.
- name
-
(string)(Optional)The name of your remote.
- slot
-
(int)(Optional)The slot used to save learned command.
Default value: 1
- timeout
-
(int)(Optional)Timeout for learning a new command.
Default value: 30
- hidden
-
(boolean)(Optional)Hide the entity from UI. There is currently no reason to show the entity in UI as turning it off or on does nothing.
Default value: true
- commands
-
(map)(Optional)
-
- command
-
(list)(Required)A list of commands as raw (learned command) or pronto hex code.
Full Configuration
remote:
- platform: xiaomi_miio
name: "bathroom remote"
host: 192.168.42.42
token: YOUR_TOKEN
slot: 1
timeout: 30
hidden: false
commands:
activate_towel_heater:
command:
- raw:base64:[optional_frequency]
read_bad_poem:
command:
- raw:base64:[optional_frequency]
- pronto:pronto_hex:[optional_repeat]
Use named commands to create UI buttons
script:
towel_heater:
sequence:
- service: remote.send_command
entity_id: 'remote.bathroom_remote'
data:
command:
- 'activate_towel_heater'
please_cover_your_ears:
sequence:
- service: remote.send_command
entity_id: 'remote.bathroom_remote'
data:
command:
- 'read_bad_poem'
Command Types
The Xiaomi IR Remote Platform currently supports two different formats for IR codes.
Raw
A raw command is a command learned from remote.xiaomi_miio_learn_command
.
A raw command is defined as in the following example:
raw:Z6UFANEAAAAjAQAAAwkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQIAE=
with an optional last parameter of frequency:
raw:Z6UFANEAAAAjAQAAAwkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQIAE=:38400
Pronto Hex Code
A pronto hex code is a hex code often supplied by the device manufacturer.
A pronto hex code is defined as in the following example:
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
with an optional last parameter of repeats (required by some devices):
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
Platform Services
The Xiaomi IR Remote Platform registers two services.
remote.send_command
Allows sending either named commands using an identifier or sending commands as one of the two types defined in Command Types.
remote.xiaomi_miio_learn_command
Used to learn new commands.
Use the entity_id of the Xiaomi IR Remote to start a learning process.
slot
and timeout
can be specified, but multiple commands learned to the same slot can still be sent using remote.send_command
even if they are overwritten.
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.