Skip to content

golang command for controlling Mi LED Desk Lamp - but probably works for other Yeelight lights

License

Notifications You must be signed in to change notification settings

reedwade/myeelight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

myeelight

golang command for controlling Mi LED Desk Lamp - but probably works for other Yeelight lights

to build

If you have a working go environment:

go install .

You should now have a myeelight command in ~/go/bin

NOTE - this is very first drafty but it works

See the code for more but..

Set -host to the address of your desk lamp.

$ myeelight -host 192.168.178.1 on

Each command line arg performs an operation in sequence and there's a 200 millisecond pause on each:

  • on, off, warm, cold, low, high, toggle
  • 1--100 sets the brightness
  • numbers over 1000 set the colour temperature, useful values are 2700..6500
  • comma will pause for one second
  • listen will connect and listen for status updates from the lamp forever
$ myeelight off
192.168.178.31:55443 <- {"id": 1, "method": "set_power",  "params":["off", "smooth", 3000]}
{"id":1, "result":["ok"]}
{"method":"props","params":{"power":"off"}}


$ myeelight on
192.168.178.31:55443 <- {"id": 1, "method": "set_power",  "params":["on", "smooth", 3000]}
{"id":1, "result":["ok"]}
{"method":"props","params":{"power":"on"}}


$ myeelight on warm 40
192.168.178.31:55443 <- {"id": 1, "method": "set_power",  "params":["on", "smooth", 3000]}
{"id":1, "result":["ok"]}
192.168.178.31:55443 <- {"id": 1, "method": "set_ct_abx", "params":[2700, "sudden", 0]}
{"id":1, "result":["ok"]}
{"method":"props","params":{"ct":2700}}
192.168.178.31:55443 <- {"id": 1, "method": "set_bright", "params":[40, "sudden", 0]}
{"id":1, "result":["ok"]}


Commas will give 1 second pauses

$ myeelight warm , cold , warm , cold , warm
192.168.178.31:55443 <- {"id": 1, "method": "set_ct_abx", "params":[2700, "sudden", 0]}
{"id":1, "result":["ok"]}
192.168.178.31:55443 <- {"id": 1, "method": "set_ct_abx", "params":[6500, "sudden", 0]}
{"id":1, "result":["ok"]}
{"method":"props","params":{"ct":6500}}
192.168.178.31:55443 <- {"id": 1, "method": "set_ct_abx", "params":[2700, "sudden", 0]}
{"id":1, "result":["ok"]}
{"method":"props","params":{"ct":2700}}
192.168.178.31:55443 <- {"id": 1, "method": "set_ct_abx", "params":[6500, "sudden", 0]}
{"id":1, "result":["ok"]}
{"method":"props","params":{"ct":6500}}
192.168.178.31:55443 <- {"id": 1, "method": "set_ct_abx", "params":[2700, "sudden", 0]}
{"id":1, "result":["ok"]}
{"method":"props","params":{"ct":2700}}


References

TODO

Need to be able to add smooth transition time to each arg, ex: myeelight off:5000

Try out the cron commands.

About

golang command for controlling Mi LED Desk Lamp - but probably works for other Yeelight lights

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages