Xiaomi IR Remote

Others (MiLight, Hue, Toon etc...)

Moderator: leecollings

Post Reply
DAVIZINHO
Posts: 234
Joined: Sunday 27 August 2017 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Spain
Contact:

Xiaomi IR Remote

Post 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
DAVIZINHO
Posts: 234
Joined: Sunday 27 August 2017 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Spain
Contact:

Re: Xiaomi IR Remote

Post by DAVIZINHO »

nobody have the xiaomi IR remote??
DAVIZINHO
Posts: 234
Joined: Sunday 27 August 2017 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Spain
Contact:

Re: Xiaomi IR Remote

Post 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 :-(
wmmudde
Posts: 22
Joined: Monday 31 July 2017 14:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Xiaomi IR Remote

Post by wmmudde »

Have this working allready?
DAVIZINHO
Posts: 234
Joined: Sunday 27 August 2017 18:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Spain
Contact:

Re: Xiaomi IR Remote

Post 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 file

Code: 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 :-(
nickmorgan
Posts: 2
Joined: Friday 16 March 2018 10:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Xiaomi IR Remote

Post by nickmorgan »

I will correct not much
In the script irsend.py the last line should look like this

Code: Select all

ir.play_raw (id,frequency='')
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 :)
DoMoney
Posts: 8
Joined: Friday 21 December 2018 11:09
Target OS: Windows
Domoticz version:
Contact:

Re: Xiaomi IR Remote

Post 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

Code: Select all

ir.play_raw (id,frequency='')
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?
salvacalatayud
Posts: 112
Joined: Monday 26 June 2017 21:16
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Spain
Contact:

Re: Xiaomi IR Remote

Post 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
Woxa
Posts: 1
Joined: Wednesday 20 February 2019 11:10
Target OS: Windows
Domoticz version:
Contact:

Re: Xiaomi IR Remote

Post by Woxa »

Faced with a similar problem
dzintars
Posts: 3
Joined: Thursday 11 April 2019 7:35
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Xiaomi IR Remote

Post 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?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest