Page 1 of 1
Xiaomi IR Remote
Posted: Thursday 28 September 2017 17:24
by DAVIZINHO
Hello,
I have domoticz configure and working fine with miio library (with air purifier configured OK)
I have a XIAOMI IR REMOTE, and i want to integrate it in domoticz. Anyone have idea???
thanks
Re: Xiaomi IR Remote
Posted: Friday 08 December 2017 20:48
by DAVIZINHO
nobody have the xiaomi IR remote??
Re: Xiaomi IR Remote
Posted: Wednesday 27 December 2017 13:33
by DAVIZINHO
Hello again,
I still investigating and fin some info:
python library that suuports Xiaomi IR Remote:
https://github.com/rytilahti/python-miio#id27
I install the library in my raspberry, but im a noob with python and i dont know how to progress

Re: Xiaomi IR Remote
Posted: Saturday 10 March 2018 22:54
by wmmudde
Have this working allready?
Re: Xiaomi IR Remote
Posted: Monday 12 March 2018 14:12
by DAVIZINHO
Yes, it works fine:
you must use this library:
https://github.com/rytilahti/python-miio
and the create scripts:
IR.PY for learn the comand and save it to a codes.txt fileCode: Select all
#!/usr/bin/python3
import sys
import ipaddress
from typing import Any
from miio import ChuangmiIr,DeviceException
import time
import json
num_lines = sum(1 for line in open('codes.txt'))
print ('Stored Ir Keys ->'+ str(num_lines) )
id = num_lines + 1
ir = ChuangmiIr('your.IP','your token')
ir.learn(key=1)
time.sleep(10)
print (ir.read(key=1).get("code"))
with open('codes.txt', 'a') as file:
file.write(ir.read(key=1).get("code")+ '\n')
#
and this other script to irsend.py to send the comand (irsend.py 15), this send the comand in line 15 of your codes.txt
Code: Select all
#!/usr/bin/python3
import sys
import ipaddress
from typing import Any
from miio import ChuangmiIr,DeviceException
import time
f=open('/home/pi/Xiaomi/IR/SALON/codes.txt')
codeline=f.readlines()
#id = codeline[int(sys.argv[1])-1]
id_aux = codeline[int(sys.argv[1])-1].split(" ")
id=id_aux[0]
ir = ChuangmiIr('YOUR.IP','YOUR.TOKEN')
ir.play(id,frequency='')
then integrate with virtual switches in domoticz and ready.
Sorry for the poor explanation but i dont have much time

Re: Xiaomi IR Remote
Posted: Friday 16 March 2018 10:50
by nickmorgan
I will correct not much
In the script
irsend.py the last line should look like this
only so I sent the code
You can also send commands with the following code
Code: Select all
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command miIO.ir_play '{"freq": 38400, "code": "base64..."}'
which is much easier to install into other scripts
Sorry for my bad english

Re: Xiaomi IR Remote
Posted: Wednesday 09 January 2019 16:01
by DoMoney
nickmorgan wrote: ↑Friday 16 March 2018 10:50
I will correct not much
In the script
irsend.py the last line should look like this
only so I sent the code
You can also send commands with the following code
Code: Select all
mirobo --ip 192.168.0.25 --token 689c4056fe28ebb3a2e8c2fe350e51ba raw_command miIO.ir_play '{"freq": 38400, "code": "base64..."}'
which is much easier to install into other scripts
Sorry for my bad english
Please advice, where can I get the token of Xiaomi IR controller?
Re: Xiaomi IR Remote
Posted: Wednesday 09 January 2019 17:03
by salvacalatayud
Do you know how to comand the Xiaomi Mi Home Air Conditioner Companion? It is supported by miio
I only need to turn on and off, but I didn't find the way
Thanks
Re: Xiaomi IR Remote
Posted: Wednesday 20 February 2019 11:18
by Woxa
Faced with a similar problem
Re: Xiaomi IR Remote
Posted: Thursday 16 May 2019 12:53
by dzintars
The above version works with the previous version of XIAOMI remote control (with MI letters on the body). Does not work with the 2019 remote control (with MI logo) with air conditioning. It works with TV and audio systems but doesn't work with air conditioners (York, Mitsibishi, Tadirian.) It looks like the company XIAOMI is specifically forbidden to run air conditioners. Maybe somebody has a solution to run air conditioners with IR from DomoticZ?