0

I am new here, so please excuse some of my mistakes :D

I want to turn my Yeelight light bulb (compatible with Google Home/Wifi/LAN) on and off by simply pressing a key on my keyboard. The only thing I need, is a file which connects to the light bulb using telnet (I didn't find any other ways to do so) and then execute a command ( {"id":0,"method":"set_power","params":["on"]} or {"id":0,"method":"set_power","params":["off"]} ). The only issue is, the bat file i made doesn't work.

I can manually connect to the bulb using telnet and then execute the command to turn the lights on/off but not automate it.
I want to create a file that turns the lights on and file that does the opposite, using whatever is needed, so I can use my keyboard to execute that file later on.

Much thanks and sorry if this post doesn't belong here!

The bat file I made:

telnet ip port
{"id":0,"method":"set_power","params":["on"]}
wNdg
  • 1
  • 2
    I have no way of testing this, but you _should_ be able to say `echo {"id":0,"method":"set_power","params":["on"]} | telnet ip port`. But again, no way of testing that because it's 2020 and nobody uses telnet for anything because it's insecure. – SomethingDark Jun 14 '20 at 20:12
  • 1
    Maybe you are looking for somethng like [this](https://stackoverflow.com/questions/13197376/is-it-possible-to-use-a-batch-file-to-establish-a-telnet-session-send-a-command)? – Nico Nekoru Jun 14 '20 at 20:22
  • @SomethingDark Thanks, but that doesn't seem to do it, it just says "Wellcome 'CTRL+J' to exit" but nothing happens. Do you know another way to connect to such thing as a light bulb using only ip and port? – wNdg Jun 14 '20 at 20:27
  • @NekoMusume I've allready read that thread, but didn't really learned from it. I sort of overwhelmed with the vbs stuff, since im bloody new to "computer language." I don't even know any real basics or what telnet even is/how it works. – wNdg Jun 14 '20 at 20:31
  • The vbs stuff just send keys to the telnet command-line like `enter` – Nico Nekoru Jun 14 '20 at 21:48
  • Is there a button you have to hit after connecting via telnet initially, or can you just immediately start typing? – SomethingDark Jun 14 '20 at 22:05
  • After connecting to the bulb, cmd is just full of nothing and in the top left a underscore is blinking. When I've previously copied the commamd, I can just right click and hit enter to execute it. The the bulb turns either on or off. (Please excuse my bad English) – wNdg Jun 15 '20 at 06:04

0 Answers0