Mi Connector (Xiaomi and Yeelight)

smartapp_misc
dth_sensors
requires_server
smartapp_appliances

(Dean Martin) #146

I followed all the instructions and successfully added my “zhimi.airpurifier.m1” Air purifier to my ST things list. I can monitor all the values for the air purifier however none of the buttons like power, mode etc is working at all.

In other words it seems like my ST DTH has read-only access. Any assistance would be very much appreciated.


(Dean Martin) #147

Hi, I am experiencing the same issue where my ST DTH is showing the current values correctly but no buttons work to update the state of my air purifier. What did you do to resolve this?


(Dean Martin) #148

How does one go about getting a token for say the Air Purifier 2? I have no idea where to start. Please point me in the right direction. All I currently have is the local IP address for the Air Purifier.


(Chals) #150

Hi

Server address(local docker Ip)
Ex) 192.168.0.100:30000

External Ip address(Router Ip with port forward)
Ex) 1.235.11.22:30000


(Chals) #151

It looks like wrong server address.
Server address means that docker ip with port

Ex) 192.168.0.22:30000

  1. First fill the right address on smart app.
  2. Remove things on ST.
  3. If the thing is not registered automatically, just reboot docker.

(Vagelis F ) #152

My wrong last time.Yes external ip is well external (not 192.168)
I have put the docker host ip (which is an ubuntu machine)
with port 30000

docker container mi-connector doesn’t have an internal ip, it’s connected in “host”
network and that’s all.In the ST app in management it displays the UI when I am out of home,like now
Xiaomi gateway v3 luminocity logs are correct on ST live logging but the doors are diplayed open with -1% and buttons when pressed do nothing


(Chals) #153
  1. Remove things on ST.
  2. If the thing is not registered automatically, just reboot docker.
  3. Check docker log when you put on/off button on ST app.

If it’s not working, needs more info.

In ‘on’ function put this
log.debug state.app_url
on gateway dth(save & publish)
And then put ‘on’ button, check live logging on ST IDE.


(Dean Martin) #154

Hi, my ips are both correct, external and internal.

Internal is 192.168.0.201 static ip (I reserved 200 - 254 for static ips.).
External is the host name of my freedns dyndns subdomain (This works correctly because I can access the admin panel from the smartthings app).

I have no problem: Retrieving device parameters like PM2.6, which mode is active ect. This all works fine, which means that the IPs should be fine right? :slight_smile:

What I am having issues with is changing state of the device. So Clicking on buttons does nothing :slightly_frowning_face:

Any ideas?


(Chals) #155

On / Off button is working on ST?

Value changed
Mi connector web -> ST (by ST token, url)

Thing Control
Mi connector ST -> Mi connector web (by server address)

If you add the wrong server address first and the thing is added, it has the wrong server address, so xiaomi is not controlled by ST.

Also, changing the server address does not change the address of the already added device.

When you control things on ST, there must be some log of docker. If there is nothing it means wrong server address.


(roelofk85@gmail.com) #156

Made a better overview on what i did from the start.
Maybe someone can see a mistake i made…

First start of the raspberry on Raspbian.

  • sudo apt-get update -y && sudo apt-get upgrade -y
  • sudo rpi-update
  • sudo reboot

Docker install

  • curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh
  • sudo groupadd docker
  • sudo gpasswd -a $USER docker
  • newgrp docker
  • sudo docker run hello-world

Install mi-connector

  • sudo mkdir /docker
  • sudo mkdir /docker/mi-connector
  • sudo chown -R pi:pi /docker
  • docker pull fison67/mi-connector-arm:latest
  • docker run -d --restart=always -v /docker/mi-connector:/config --name=mi-connector-arm --net=host - - fison67/mi-connector-arm:latest

Installed all the DTH i needed in Smartthings.

Addes the MI Connector smartapp by code
Enable OAuth

Added MI Connector smartapp in the Smartthings app.
Servet address: adress of my pi:30000
save
I can’t do anything in the smartapp, management and remote device mapping isn’t working.

Install Mariadb database:

  • docker pull jsurf/rpi-mariadb
  • docker run -d --name mariadb -e MYSQL_ROOT_PASSWORD=password1234 -e TZ=Asia/Seoul -p 33006:3306 -d jsurf/rpi-mariadb
    Did i had to change things in het command above?

Tried to get it working:

docker run -it -v /docker/mi-connector:/config --net=host fison67/mi-connector:0.0.1 bash
npm start (bash: npm: command not found)

docker run -it -v /docker/mi-connector:/config --net=host fison67/mi-connector-arm:0.0.1 bash
npm start

Do i have to to something in webCoRE?
Never used it before

A few print screens:
Docker ps - a result


mi-connector and the mariadb seems to run fine isn’t it?

Really can’t find it what i did wrong…
Everything installed good, no warning/error’s (only one warming at the npm start)

A few days ago i also saw some xiaomi devices where detected in the command promp, this time i didn’t see that.
With what command i let the raspberry look for the xiaomi stuff?

Can’t wait to buy you some coffee :P.

Thanks!


(Chals) #157

Would you like to install [ fison67/mi-connector-arm:test ] version?

And if it’s not working, open config.json file.
You can see this part.
“xiaomi”: {
“find_limit_time”: “30000”,
“motion_reset_time”: “4900”,
“find_mode”: “auto”,
“polling_time”: “5000”,
“network”: “192.168.11.22”
}

if network item is empty or not exist,
just write… ip address is your raspbery pi address.


(roelofk85@gmail.com) #158

That did the trick.
Installing the :test version worked instantly!
Thanks!! :+1::+1:

Have a nice coffee or a few beers :sunglasses::ok_hand:


(Chals) #159

Thank you so much!!:blush:


(Mathias Caldas) #160

@fison67 is there any plan to support yeelink.light.ceiling2?
I could help debugging if it helps.

Thanks for the great work!


(Chals) #161

I have no yeelink.light.ceiling2 but If it use same protocol as old version, it will work fine.
When I add ceiling2 to mi connector, I will let you know.


(Mathias Caldas) #162

Perfect. Let me know and I’ll test


(Nuno Martins) #163

is it possible to add the siren capability to the HUB? then we could use it as a siren in the SHM !


(Chals) #164

Install a fison67/mi-connector:test or fison67/mi-connector-arm:test version.

I added a ceiling2 model.


(Chals) #165

Ok.
I will add a siren capability asap.


(Nuno Martins) #166

thanks. that will be great!