SmartThings Community

Mi Connector (Xiaomi and Yeelight)

(Chals) #479

Login is not required when you connect on local.
Latest version is not supported login.
Install a test3 version

(Chals) #480

Add a code in the DTH.
It’s simple.

(Moshe Vazan) #481

Please if you can share some steps… Where should I put the scene parameters? (Color, brightness, etc’) I really would like to get the movie scene from the yeelight app.

Hope you could share some information so I would be able to edit the script… Best.

(@rnel) #482

Sir, I have tried everything using Synology Manual as guide to install it on my QNAP, but I cannot make it work. Docker is already installed and running, but Management page is not showing. Maybe I don’t have the correct configuration on network. Please help.

(Chals) #483
  1. Add a command.
    I don’t know what you want scene but if you don’t know data
    you have to see packet and find what it is.

def setScene3(){
def body = [
“cmd”: “scene”,
“data”: 1 <— modify
def options = makeCommand(body)
sendCommand(options, null)

  1. Add a command name
    command “setScene1”
    command “setScene2”
    command “setScene3” <---- add

  2. Add a tile
    standardTile(“scene1”, “device.scene”, decoration: “flat”) {
    state “default”, label: “”, action: “setScene3”, icon: “


No need to have External Network Address and set port forward on router. You can use same local server address (settings.address) in SetInfo function by using hubAction and dataCallback in DHT (for example only, you need to modify to work correctly)

def makeURL(type, name){
	def sDate
    def eDate
	use (groovy.time.TimeCategory) {
      def now = new Date()
      def day = settings.historyDayCount == null ? 1 : settings.historyDayCount
      sDate = (now - day.days).format( 'yyyy-MM-dd%20HH:mm:ss', location.timeZone )
      eDate = now.format( 'yyyy-MM-dd%20HH:mm:ss', location.timeZone )
    // Send request
    def options = [
     	"method": "GET",
        "path": "/devices/history/${}/${type}/${sDate}/${eDate}/image",
        "headers": [ "HOST": state.app_url ]
    def myhubAction = new physicalgraph.device.HubAction(options, null, [callback: processImage)

def processImage(physicalgraph.device.HubResponse hubResponse){
    try {
        def response = parseLanMessage(hubResponse.description)
        if (response.status == 200 && response.headers.'Content-Type'.contains("image/png")) {
             def imageBytes =
             if (imageBytes) {
             try {
                  storeImage(getPictureName(type), imageBytes)
             } catch (e) {
                 log.error "Error storing image ${name}: ${e}"
    } else {
        log.error "Image response not successful or not a jpeg response"
    } catch (e) {
        logger('warn', "Exception caught while parsing data: "+e);

By the way, I can see that you have a server with chart capability (Bootstrap?). Can you make a description for chart type and a way to customize chart display (query params?)

(Moshe Vazan) #485

Thanks for taking the time and reply, that exactly what I did as this is the easy part :slight_smile: just copy the scene code…
the part which I don’t understand is where should I add the parameters for the scene?

I would like to use the Movie scene just like the Movie scene from the MiHome app or Yeelight app.

The only modification which I can see is the Data part but again where does the data located?


Mi Connector is running in Raspberry now.

May I install it into QNAP docker and parallel run them?

Because I would like to confirm new Mi Connector (in QNAP docker) that is running properly before remove Raspberry Mi Connector.

(Chals) #487

I don’t know well that scene is working on command.
I have tested.

When I press a movie scene
ceiling notify just a color temperature.
It’s not send other data.

Scene mode of mi-connector is just for this option. [ moon light enable / disable ]

(Chals) #488

I’m gonna try to update it later.

I just use a chart-js library.

(Chals) #489

I’m not sure, cuz I haven’t used a docker on QNAP.
But Some Korean user use a mi connector on QNAP.

(Moshe Vazan) #490

Thanks, would it be possible to edit the code so I can set instead of a scene a favorite parameters?

So I will set in the code the color temp, brightness etc…?

How do your read the data from the mi apps?

(Chals) #492

Color hex values can be obtained from properties. And you can get brightness with a value of 1-100.
(Mi connector change color temperature value to Hex value.)

(Jpenrod St) #493

Fison67 any way that you can add the option for Fahrenheit on the Flora dth? Similar to the Bluetooth weather?


Could you please post your code for Mi Connector server on Raspberry? I gonna try to make connector for new ST app.
Thank you very much.

(Chals) #495

Ok. I’m gonna update Flora DTH soon.

(BobT) #496

fison67 thank you very much for your excellent work. Look forward to add support for yeelink.light.bslamp2 and yeelink.light.strip2 in your future releases.


Does Mi-connector support to control USB port for chuangmi.plug.v3?

(Chals) #498

It’s already supported yeelink.light.bslamp2, yeelink.light.strip2 on test3(docker image) version.

(Chals) #499

It’s supported to control USB port.