[WIP] LAN Control Yeelight using Tasker - WITHOUT Yeelight app NOR INTERNET !
**************************************** DISCLAIMER ****************************************
- I’m NOT affiliated with Yeelight/Xiomi in anyway, I’m a Yeelight user like you.
- This project is WORK IN PROGRESS - while it’s useful, expect that somethings might NOT work.
- Please DO NOT request any ETA for changes/features etc, since i’m doing it out of my FREE WILL & TIME.
Nontheless, you’re welcome to change/add whatever you want, and welcome share it with us here- Want to share it ? please publish a LINK TO THIS THREAD @forum.yeelight.com
- and MOST IMPORTANT:
- I am not responsible for bricked devices, any connectivity issue, thermonuclear war, high device wear or alien visits due to any special lightning effects that might happen.
- Do some research if you have any concerns about features included in this Project - all of the project’s code can be read & modify for your liking by you.
- YOU are solely responsible for everything that happens to your Yeelight device / Android device & OS / Tasker
when you’re choosing to use this project.
If you point the finger at us for messing up your device, I will laugh at you.
IMPORTANT NOTE: IT IS MANDATORY TO ENABLE “LAN CONTROL” in Yeelight official app
- You only NEED TO DO IT ONCE, then you don’t need to use that app nor have it installed.
- It is recommended to have Yeelight official app installed, as a “backup plan”, so if something goes wrong with this project, you may have a backup solution available.
Requirements
- Android OS (tested on Nougat & Oreo, should work for others) on NON rooted device.
- Tasker app (tested on v5.xx+, should work on old v4.9 as well)
- Enable “LAN Control” in Yeelight OFFICIAL app ( single time only = set & forget )
- (OPTIONAL) AutoNotification (Only mandatory if you wish QS Tile to work, tested on v.3.8.4)
- (OPTIONAL) “SL4A” & “Py4A” to get auto bulb’s IP detection using SSDP.
- A LOT OF PATIENCE - THIS IS WIP PROJECT !
Features
- Control your Yeelight WITHOUT internet connection - i.e on LAN only !
- QS Tile ( Nougat+ only ): able to toggle power (single click), change presets.(double click when on) and change current controled bulb ( double click when off ).
- basic tasks ( power toggle/change RGB/change bright etc ) with simple input needed ( by using “Perform Task” action ).
Examples:- To Toggle Power or set its power state - it’s one task, either call that task without any input to toggle the power state or add “on” or “off” as input to set the bulb’s power state.
- change RGB/temperature - it’s one task, only need as input R.G.B value (e.g 211.0.11) or temp (e,g 6500)
Take under considuration
- My device is rooted, so it’s untested on non-rooted
nonetheless, non of the actions I use in the project require root so I only assume this works for non-rooted devices as well. - I own a single Yeelight RGB Bulb v2(800lm) so I test the project only on that one device, thus:
- A. Testing the support for multiple bulbs ( i.e multiple IPs ) is impossible for me, although It exist in the project on some degree.
- B. Since the TCP commands are unanimous between Yeelight devices - the project should work on other Yeelight devices as well, BUT IT MIGHT NOT.
DOWNLOAD
- Latest !
- Older
HOW TO INSTALL
- Download xml and put in your device.
( tasker’s default projects folder is ‘/sdcard/tasker/projects’ )
- Open tasker → long click the lowest part of the screen (the projects tray/icons) → import
HOW TO UPDATE
- wipe existing project or change its current name → then import new version like new installation
MUST DO AFTER FRESH INSTALL OR UPDATE !!!
- A. enter Yeelight IP(s) in ‘Preferences’ task, comma delimited if you input more then 1.
( e.i “192.168.0.1**,** 192.168.0.2” )- NOTE 1: it is VERY RECOMMENDED that you set STATIC IP to each Yeelight in your router.
- NOTE 2: if you prefer to work with dynamic IPs - you can use my ‘SSDP auto IP detection method’ - but don’t blame me if you need to use about every hour or so. ( that’s why STATIC IP is advisable ! )
- B. enter IP nickname(s) ‘Preferences’ task ( default is RGB1 ), PER EACH IP you’ve input in step #1, i.e number of IPs = number of nicknames !
- C. RUN ‘Preferences’ task ( to update the permanent memory variables )
- D. (OPTIONAL) TEST: open ‘Examples’ task → enable each relevant section to test other tasks.
- D. (OPTIONAL) to get QS TILE working: enable all 3 profiles → manually run the ‘Tile_Startup’ task to init the QS tile.
( it uses Tile #2 of autonotification addon- make sure it isn’t hidden in autonotification’s app’s settings )
FAQ
-
Yeelight bulb(s) not responding to my commands !
- MAKE SURE you’ve ENABLE “LAN CONTROL” in Yeelight official app !
- open any terminal/shell app and run ‘nc --help’.
if you’re getting "nc: command not found” → you MUST install BUSYBOX → thus you MUST have ROOT !
-
SSDP auto IP detection issues:
- Since it’s based on a python script, users MUST INSTALL BOTH
“SL4A” & “Py4A” apps from THIS SOURCE - After installation, open Py4A (PythonForAndroid) app → click “Install” to download and install python binaries (you must have internet connection)
- To get auto network detection of bulbs, simply enter “Prefrences” task, enable related lines under “SL4A” anchor and run task ( twice, to set the debug reports flag ‘OFF’).
- Don’t forget to manually assign a NICK to each IP - this will be handled in future updates.
- please note that since P4yA works only by reading python files, folders & a file are created under /sdcard/sl4a/scripts.
if you don’t have /sdcard folder, please let me know what is your root folder where you can store files.
- Since it’s based on a python script, users MUST INSTALL BOTH
Future plans / Things to do
- Add UI for everything !
- Embed better mutiple IP(many devices) supports
( many tasks aspects ( like reports ) currently support only single IP. ) - Presets - save/load/change combination of different bulb actions.
- Tile double click actions ( when it’s on ) - being able to change the actions of double-click to any preset predefined ( using UI, preferable ).
Change log
-
v0.5b
-
New Task ‘Sleep Timer’ - make an ‘On’ bulb sleep after X min.
- running task with input X (numeric value) = turn off afer X min ( i.e TCP command cron_add )
- running task with input ‘Status’ = getting back time left of the timer ( bulb must be ‘on’ ) ( i.e TCP command cron_get )
- running task w/o input = turn off timer ( i.e TCP command cron_del )
-
v0.4b
-
Task ‘Change color’ - added support for HSV, i.e ‘set_hsv’ TCP command.
task action is depended on the length of input:- 1 number = temperature color, values of 1700-6500
- 2 numbers (comma delim) = HSV, i.e 1st is hue (0-359), 2nd is saturation (0-100)
- 3 numbers (comma delim) = RGB color, 1st red, 2nd Green, 3rd Blue - each of values 0-255.
-
Change name of task ‘Parse RGB’ to ‘Parse_24bit_to_RGB’
-
Added task ‘Parse_RGB_to_24BIT’ that gets input of comma delimmited RGB color ( e.g 255.255.255 ) and returns 24BIT numeric color.
- Added task ‘Set Default’ to set current settings as default ( so that bulb can retain its settings after disconnection from electricity.
no input is needed, only that the bulb will be toggled on. - New task: ‘Color Flow’, support the use of ‘start_cf’ and ‘stop_cf’ TCP commands.
- When no input passed into task → it will stop current working flow ( stop_cf )
- To get flow working, you need to send this array string ( comma delimited ):
end_mode, Duration, color_mode, value, brightness…Duration2, color_mode2, value2, brightness2
Example
2,500,255.0.0,100,1000,0.255.0,100,500,0.0.255,100
Detailed explanation:- end_mode ( “action” ) is the state of the bulb when flow is ended.
0= restore previous bulb state before flow,
1= leave last flow state (color+bright),
2= turn off
NOTE that you only pass this value ONE TIME ONLY.
only the other four parameters, you can repeat as many times as you want as long as each time you add these four parameters. - Duration= in MS how long each state will stay before switching to the next
min is 50. - color_mode: 1= RGB, 2= Temperature, 7= sleep ( it exist for adding delay w/o change to color * brightness )
- Value: is the value of the color_mode you chose
for 1=RGB, input as point delimited ( e.g 255.255.255 ),
for 2=Temperature, input as a number with value 1700-6500
for 7= sleep, you can input any number - it will be ignored - Brightness: 0-100 ( low to high ) brightness.
- end_mode ( “action” ) is the state of the bulb when flow is ended.
- Added task ‘Set Default’ to set current settings as default ( so that bulb can retain its settings after disconnection from electricity.
-
v0.3b
- Bulb’s IP auto detection using SSDP ! ( YES, even for NON-ROOTED !)
Credits (partially based on): [https://github.com/crquan/work-on-sony-apis/blob/master/search-nex.py](credits: https://github.com/crquan/work-on-sony-apis/blob/master/search-nex.py)- READ FAQ above for guidelines how to make it work
- added two new tasks:
- SSDP_Identify - send SSDP message to broadcast and return reply from bulbs on the lan.
- SSDP_IP_List - call the above task and return a array of IP taken from that above reply.
- There are extra two tasks with SSDP name - they my other trials to get this feature work only for rooted device ( because tcpdump must have root, but tasker can’t run it even with root ).
- QS Tile double click action - Fix few bugs related to IP switching
- Bulb’s IP auto detection using SSDP ! ( YES, even for NON-ROOTED !)
-
v0.2b
-
QS Tile: when it’s “off”, double tap on Tile toggles to next pre-defined IP, till it loops back to 1st IP.
( please note you MUST manually enter the IPs with delimiter “,” using “Prefrences” task. ) -
QS tile status refreshed ( VS real bulb’s status ) when status bar gets open.
- please note that status bar values are different from one phone/rom to another.
to add support for your status bar, send me its full %WIN value when it’s open.
- please note that status bar values are different from one phone/rom to another.
-
v0.1b is online
-
***tested support for ONE YEELIGHT device, although WIP to support many ***
-
task: Toggle power [on|off| non=toogle]
-
task: Change COLOR [R.G.B|Temperature]
-
task: Change Brightness [on,off,non=toogle]
-
task: Parse RGB ( get 24bit coded number → return R.G.B coded 0-255 format )
-
task: Send Command ( get ID, Method & IP list → send command through TCP → return answer from Yeelight )
-
task: Examples - Inc various examples how to use the above tasks
-
task: Preferences - Set IP list, IP nickname & report flag ( flag on = toast message after running each task - good for debugging )
-
QS Tile related:
- task: Tile Click Single - toggle on/off power while changing QS tile
- task: Tile Click Double - loops through 3 modes ( red low bright, red high bright, white-color high bright.
- task: Tile Startup - Initiating QS tile ( after boot etc )
- 3 QS TILE ‘PROFILES’ to suppport single click, double click, and init after boot.