Author Topic: Yeelight Plugin Development ?  (Read 527 times)

Offline holdmade

  • Sr. Newbie
  • *
  • Posts: 32
  • Karma: +0/-0
Yeelight Plugin Development ?
« on: August 18, 2017, 06:47:07 am »
Would anyone be up for creating a plugin for Yeelight bulbs ? they are cheap compared to Hue, ~?15

I have asked Vera Support and they have no interest in supporting them.   ::)

There is an open API available using tcp connection, json commands / responses and a notification when status of bulb changes to update any connected devices.

There is also a python library on Github that I am successfully using in Eventghost to control the bulbs but Vera integration would be great so my RTI remote processor can control and have status updates from Vera.

It's beyond my capabilities unfortunately.  :-[

Thanks

Simon

Offline ninkasi

  • Sr. Newbie
  • *
  • Posts: 49
  • Karma: +5/-0
Re: Yeelight Plugin Development ?
« Reply #1 on: September 14, 2017, 03:09:16 am »
Sadly I suspect it's beyond my abilities as well but, as you noted, the API is out there and it doesn't look overly complicated so I'll have a look when I have a chance. I will note that I am impressed with the value (price & quality) of the Xiaomi products. I have a couple of RGB Yeelight strips and they work fine with my Google Home now, and am thinking about getting one of the desk lamps. I also recently got their robot vacuum and am very impressed with it - definitely equal or better than my Neato.

If it turns out I have neither the time nor ability to do it, if there's enough interest for it in the community, maybe we can convince/pay someone via fiverr.com with LUA skills to work on something for us? . :-)

Offline cybrmage

  • Hero Member
  • *****
  • Posts: 1002
  • Karma: +96/-5
Re: Yeelight Plugin Development ?
« Reply #2 on: September 14, 2017, 11:33:18 pm »
I have added experimental support for the Yeelight bulbs to the WiFi/UDP Switch Controller plugin... HERE

Note: Availability of these bulbs in the great white north is sporadic, so I do NOT have any of these bulbs, so if you try the plugin and it does not work, you *WILL* need to provide excerpts of the LuaUPnP log in order to get it working.

Also, as support is experimental, you will need to force installation of the specific version using the instructions in post 3 of the WiFi/UDP thread.
EVL3Vista - Wink Connect - Caseta Connect - Venstar Colortouch - WiFi UDP Switch Controller - MyQGateway

Offline holdmade

  • Sr. Newbie
  • *
  • Posts: 32
  • Karma: +0/-0
Re: Yeelight Plugin Development ?
« Reply #3 on: September 17, 2017, 03:36:05 pm »
@cybrmage,

Thanks for the heads up to Yeelight support on your plugin.

I tried to install v1.45 but the "Lua Engine Failed to Load" (v1.40 installs fine)

The device number is 471 on my Vera.

Hope you can iron this out !

Cheers

These lines show up in my log:

01   09/17/17 20:12:27.114   IOPort::Connect connect -1 127.0.0.1:3481 <0x2d82b680>
01   09/17/17 20:12:31.118   IOPort::Connect connect -1 127.0.0.1:3481 <0x2d82b680>
01   09/17/17 20:12:34.171   Device_Interface::CreateLuaInterface 471 failed to start engine <0x2aded310>
01   09/17/17 20:12:34.436   LuaInterface::LoadCode: [string "local VERSION = "v1.45"..."]:2159: unexpected symbol near ')' <0x2aded310>
01   09/17/17 20:12:35.123   IOPort::Connect connect -1 127.0.0.1:3481 <0x2d82b680>
01   09/17/17 20:12:39.129   IOPort::Connect connect -1 127.0.0.1:3481 <0x2d82b680>
01   09/17/17 20:12:43.133   IOPort::Connect connect -1 127.0.0.1:3481 <0x2d82b680>

Offline cybrmage

  • Hero Member
  • *****
  • Posts: 1002
  • Karma: +96/-5
Re: Yeelight Plugin Development ?
« Reply #4 on: September 17, 2017, 06:19:16 pm »
I've made some changes, based on assumptions - your log excerpt is a little spare... The error indicated could only be generated if the ssdp search did not find any YEELIGHT devices... So I have tweaked the ssdp search algorithm to hopefully find some devices.

Attached is the update...

Upload the file to you vera from Apps/Develop apps/Luup files... Make sure "Restart Luup after upload" is checked.


*** SUPERSEDED ATTACHMENT REMOVED ***
« Last Edit: September 19, 2017, 02:29:28 pm by cybrmage »
EVL3Vista - Wink Connect - Caseta Connect - Venstar Colortouch - WiFi UDP Switch Controller - MyQGateway

Offline holdmade

  • Sr. Newbie
  • *
  • Posts: 32
  • Karma: +0/-0
Re: Yeelight Plugin Development ?
« Reply #5 on: September 18, 2017, 08:05:46 am »
Thanks I'll try it tonight but it wouldn't even install, and stopped at "Lua Engine Failed to Load"

It didn't start the search.

I tried v1.40 and it installed fine and did the search, but not Yeelight obviously.

If it still doesn't work I'll post my whole log, sorry

Cheers
« Last Edit: September 18, 2017, 08:07:50 am by holdmade »

Offline holdmade

  • Sr. Newbie
  • *
  • Posts: 32
  • Karma: +0/-0
Re: Yeelight Plugin Development ?
« Reply #6 on: September 19, 2017, 04:19:23 am »
Hi, now it does install OK and does the discovering for YEELIGHT devices.

However, when I press on Configure I get this is red:

Error executing function configuration(): Unexpected token in JSON at position 21

I attach my full log this time, EcoSwitch device is 474.

From the log, Yeelight is being discovered OK, IP 192.168.1.212

For info, There is a typo in your searches for the SengLED device "Discovy" intead or "Discovery"

Thanks again
« Last Edit: September 19, 2017, 04:53:43 am by holdmade »

Offline cybrmage

  • Hero Member
  • *****
  • Posts: 1002
  • Karma: +96/-5
Re: Yeelight Plugin Development ?
« Reply #7 on: September 19, 2017, 05:14:20 am »
Try this...

Download BOTH files. rename J_ECO_Switch1.js.txt" to J_ECO_Switch1.js" and upload both files to your vera, allow the LuaUPnP engine to reload, then refresh your browser...


*** SUPERSEDED ATTACHMENT REMOVED ***
« Last Edit: September 19, 2017, 02:30:04 pm by cybrmage »
EVL3Vista - Wink Connect - Caseta Connect - Venstar Colortouch - WiFi UDP Switch Controller - MyQGateway

Offline holdmade

  • Sr. Newbie
  • *
  • Posts: 32
  • Karma: +0/-0
Re: Yeelight Plugin Development ?
« Reply #8 on: September 19, 2017, 05:43:26 am »
It now says discovered 1 Yeelight but still has the same error when I click on configure:

Error executing function configuration(): Unexpected token in JSON at position 21

and doesn't display anything else

Cheers

Offline cybrmage

  • Hero Member
  • *****
  • Posts: 1002
  • Karma: +96/-5
Re: Yeelight Plugin Development ?
« Reply #9 on: September 19, 2017, 06:32:09 am »
Ok...

Something in the device data is corrupted... and without better logging, I can't tell where it's being corrupted...

I've added additional debugging... please upload this version, and post logs again... thanks.


*** SUPERSEDED ATTACHMENT REMOVED ***
« Last Edit: September 19, 2017, 02:30:33 pm by cybrmage »
EVL3Vista - Wink Connect - Caseta Connect - Venstar Colortouch - WiFi UDP Switch Controller - MyQGateway

Offline holdmade

  • Sr. Newbie
  • *
  • Posts: 32
  • Karma: +0/-0
Re: Yeelight Plugin Development ?
« Reply #10 on: September 19, 2017, 06:38:21 am »
Here you go

Thanks

Offline cybrmage

  • Hero Member
  • *****
  • Posts: 1002
  • Karma: +96/-5
Re: Yeelight Plugin Development ?
« Reply #11 on: September 19, 2017, 06:53:56 am »
Ok...

This one should do it... (well... at least for device discovery and configuration)


*** SUPERSEDED ATTACHMENT REMOVED ***
« Last Edit: September 19, 2017, 02:31:02 pm by cybrmage »
EVL3Vista - Wink Connect - Caseta Connect - Venstar Colortouch - WiFi UDP Switch Controller - MyQGateway

Offline holdmade

  • Sr. Newbie
  • *
  • Posts: 32
  • Karma: +0/-0
Re: Yeelight Plugin Development ?
« Reply #12 on: September 19, 2017, 07:14:12 am »
No, still the same I'm afraid, it does discover one device but the configure button still fails.

Not sure what the IP address of 192.168.1.255 is line 28381 of the log ? my Yeelight is 192.168.1.219.

Cheers


Offline cybrmage

  • Hero Member
  • *****
  • Posts: 1002
  • Karma: +96/-5
Re: Yeelight Plugin Development ?
« Reply #13 on: September 19, 2017, 07:20:47 am »
The log you posted is incomplete... It does not show the complete startup of the plugin...

EVL3Vista - Wink Connect - Caseta Connect - Venstar Colortouch - WiFi UDP Switch Controller - MyQGateway

Offline holdmade

  • Sr. Newbie
  • *
  • Posts: 32
  • Karma: +0/-0
Re: Yeelight Plugin Development ?
« Reply #14 on: September 19, 2017, 07:26:23 am »
Sorry, been chopping it so I can post it here, hopefully this is complete ?

Cheers