Xiaomi Chuangmi_ir (Universal IR Remote Controller)

python-miio>=0.3.0 is unreleased and will be available here soon: https://github.com/rytilahti/python-miio

Just check my last commit a few seconds ago: https://github.com/syssi/chuangmi_ir

1 Like

Yes, I already removed the requirement locally and used the script from rytilahti. Managed just now to see each other but got some issue with config ( i believe token is wrong)

So I got it working, but I must say it was some pain in the …
Btw, in my case autodiscovery found the right token for the IR, so no need to play with backups.

wow! PITA but i got the token. is it possible to run this in hassio?

AWESOME!!! got my device today… token was pita as my phone is decrypted but found a way… if needed i will share… but anyway… works well :slight_smile: THANKS!!!

1 Like

@thundergreen considering you got it decrypted (with miio-extract-tokens or some other way?), could you help a fellow user in Xiaomi Mi Vacuum Token from iOS? ?

@teprrr It was a kind of PITA… u will have to install java addn zu be able to decrypt the file… i my case my phone was encrypted with a password. I could then decrypt it after addind java addons… just tell me where u r stuck mate :slight_smile:

@thundergreen I’m not stuck anywhere, but someone on that thread is :slight_smile:

Hi is it possible that this component will make it into one of the future official releses of hass?

1 Like

The license of the original code is unknown and the code base isn’t really clean. It will need some time to get rid of the dust. :wink:

1 Like

Anyone else having trouble in 0.57? Ideas?

2017-11-04 13:33:50 ERROR (SyncWorker_6) [homeassistant.util.package] Unable to install package python-mirobo: Command “/usr/bin/python3 -u -c “import setuptools, tokenize;file=’/tmp/pip-build-0js5vpqq/cryptography/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-x3ph26i2-record/install-record.txt --single-version-externally-managed --prefix --compile --user --prefix=” failed with error code 1 in /tmp/pip-build-0js5vpqq/cryptography/
2017-11-04 13:33:50 ERROR (MainThread) [homeassistant.setup] Not initializing switch.chuangmi_ir because could not install dependency python-mirobo
2017-11-04 13:33:50 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform switch.chuangmi_ir: Could not install all requirements.

Update: so I fixed the problem.
Updated plugin to version in post 54. But had to change from chuangmi.send_package to chuangmi.send_command in all scripts!

Where did you download the custom component? The current version doesn’t use python-mirobo anymore. It’s called python-miio now: https://github.com/syssi/chuangmi_ir

Please install the following system requirements:

apt-get install libffi-dev libssl-dev

Its possible install and activate this addon in resinOS https://home-assistant.io/hassio/installation/ ?

this tool helps to decode Base64 string.

Is it possible to make this a climate component? Would really appreciate

i Get thos switches:

switch.chuang_mi_ir_switch off friendly_name: chuang_mi_ir_switch
assumed_state: false
model: chuangmi.ir.v2
switch.chuang_mi_ir_switch_2 off friendly_name: chuang_mi_ir_switch
assumed_state: false
model: chuangmi.ir.v2
switch.chuang_mi_ir_switch_3 off friendly_name: chuang_mi_ir_switch
assumed_state: false
model: chuangmi.ir.v2

but myconfig looks like:

 - platform: chuangmi_ir
   name: "livingroomirremote"
   host: 192.168.1.141
   token: 570a6f6e854a18ae4a20f742ed7a5bea
   switches:
     tv:
       command_on: 'Z6VLAAkCAABpAgAAYgYAAKYIAACJEQAAoSMAAKScAABYeQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFAQEBAQEBAQEhISEhISEhIQEBISEBAQEBISEBASEhISFhNXE1AQ=='
       command_off: 'Z6VLAAkCAABpAgAAYgYAAKYIAACJEQAAoSMAAKScAABYeQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFAQEBAQEBAQEhISEhISEhIQEBISEBAQEBISEBASEhISFhNXE1AQ=='
     ac_on_off:
       command_on: 'Z6VTAoEBAADqAQAA4wQAAJEGAADlDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0IBAQEBAQEBAQEBAQIBAQEBAQEBAQEBAQEBAQEBAQIBAgICAgICAQICAgICAgICAgEBAQEBAQEBAQECAgEBAgICAgEBAgIBAQECAQECAQECAgECAgECAgECAgEBAgEBAQEBAgIBAgICAQEBAQECAgECAgICAgEBAgEBAQEBAQEBAgICAgICAgIBAQEBAQEBAQICAgICAgICAQEBAQEBAQECAgICAgICAgEBAQEBAQEBAgICAgICAgIBAQEBAQEBAQICAgICAgICAQICAQIBAgECAQECAQIBAgIBAQEBAgICAQICAgIBAQEBAQEBAQEBAQICAgICAgICAQEBAQEBAQECAgICAgICAgEBAQEBAQEBAgICAgICAgICAgEBAQEBAQEBAgICAgICAA=='
       command_off: 'Z6VTAoEBAADsAQAA4QQAAJAGAADnDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0IBAQEBAQEBAQEBAQIBAQEBAQEBAQEBAQEBAQEBAQIBAgICAgICAQICAgICAgICAgEBAQEBAQEBAQECAgEBAgICAgEBAgIBAQECAQECAQECAgECAgECAgECAgEBAgEBAQEBAgIBAgICAQEBAQECAgECAgICAgEBAgEBAQEBAQEBAgICAgICAgIBAQEBAQEBAQICAgICAgICAQEBAQEBAQECAgICAgICAgEBAQEBAQEBAgICAgICAgIBAQEBAQEBAQICAgICAgICAQICAQIBAgECAQECAQIBAgIBAQECAgICAQICAgEBAQEBAQEBAQEBAQICAgICAgICAQEBAQEBAQECAgICAgICAgEBAQEBAQEBAgICAgICAgICAgEBAQEBAQEBAgICAgICAA=='
     ac_swing:
       command_on: 'Z6VTAoEBAADqAQAA4QQAAJAGAADnDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0IBAQEBAQEBAQEBAQIBAQEBAQEBAQEBAQEBAQEBAQIBAgICAgICAQICAgICAgICAgEBAQEBAQEBAQECAgEBAgICAgEBAgIBAQECAQECAQECAgECAgECAgECAQEBAQEBAgECAgICAgIBAQEBAQECAgECAgICAgEBAgEBAQEBAQEBAgICAgICAgIBAQEBAQEBAQICAgICAgICAQEBAQEBAQECAgICAgICAgEBAQEBAQEBAgICAgICAgIBAQEBAQEBAQICAgICAgICAQICAQIBAgECAQECAQIBAgIBAQECAgICAQICAgEBAQEBAQEBAQEBAQICAgICAgICAQEBAQEBAQECAgICAgICAgEBAQEBAQEBAgICAgICAgICAgEBAQEBAQEBAgICAgICAA=='
       command_off: 'Z6VTAoEBAADqAQAA4QQAAJAGAADnDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0IBAQEBAQEBAQEBAQIBAQEBAQEBAQEBAQEBAQEBAQIBAgICAgICAQICAgICAgICAgEBAQEBAQEBAQECAgEBAgICAgEBAgIBAQECAQECAQECAgECAgECAgECAQEBAQEBAgECAgICAgIBAQEBAQECAgECAgICAgEBAgEBAQEBAQEBAgICAgICAgIBAQEBAQEBAQICAgICAgICAQEBAQEBAQECAgICAgICAgEBAQEBAQEBAgICAgICAgIBAQEBAQEBAQICAgICAgICAQICAQIBAgECAQECAQIBAgIBAQECAgICAQICAgEBAQEBAQEBAQEBAQICAgICAgICAQEBAQEBAQECAgICAgICAgEBAQEBAQEBAgICAgICAgICAgEBAQEBAQEBAgICAgICAA=='
       ```
1 Like

hey what do i do if i get this error:

> 2017-12-25 17:29:47 ERROR (SyncWorker_18) [homeassistant.util.package] Unable to install package python-miio==0.3.0: Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lq0e3ug3/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-6q5th2gc-record/install-record.txt --single-version-externally-managed --prefix  --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-lq0e3ug3/cryptography/
> 2017-12-25 17:29:47 ERROR (MainThread) [homeassistant.setup] Not initializing switch.chuangmi_ir because could not install dependency python-miio==0.3.0
> 2017-12-25 17:29:47 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform switch.chuangmi_ir: Could not install all requirements.
1 Like

There are some system dependencies missing. Please install libffi-dev and libssl-dev:

sudo apt-get install libffi-dev libssl-dev
1 Like

Did u think about making a ac component with it? Also I bought for 240€ zwave climate components …still interested

1 Like

i got these error when trying to send packet, any idea?

2018-01-12 22:24:54 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/miio/device.py", line 236, in send
    self.__id += 1
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/miio/device.py", line 236, in send
    self.__id += 1
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/miio/device.py", line 236, in send
    self.__id += 1
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/miio/device.py", line 236, in send
    self.__id += 1
socket.timeout: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/custom_components/switch/chuangmi_ir.py", line 98, in _send_packet
    ir_remote.send("miIO.ir_play", {'freq':38400, 'code': str(packet)})
  File "/srv/homeassistant/lib/python3.5/site-packages/miio/device.py", line 258, in send
  File "/srv/homeassistant/lib/python3.5/site-packages/miio/device.py", line 258, in send
  File "/srv/homeassistant/lib/python3.5/site-packages/miio/device.py", line 258, in send
  File "/srv/homeassistant/lib/python3.5/site-packages/miio/device.py", line 259, in send
miio.device.DeviceException

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 1031, in _event_to_service_call
    yield from service_handler.func(service_call)
  File "/usr/lib/python3.5/asyncio/coroutines.py", line 210, in coro
    res = func(*args, **kw)
  File "/home/homeassistant/.homeassistant/custom_components/switch/chuangmi_ir.py", line 100, in _send_packet
    except (socket.timeout, ValueError):
NameError: name 'socket' is not defined