Page 6 of 18

Re: Help with Yeelight Bulb

Posted: Friday 21 October 2016 10:42
by Derik
farhanito wrote:Does the script works in terminal? Maybe nc isn't installed
how do i try that?
My hue scripts [ and much others ] work fine...

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Posted: Friday 21 October 2016 11:19
by corbin
open terminal
type or paste the command in and hit enter
terminal.PNG
terminal.PNG (22.55 KiB) Viewed 2049 times
If that works to control the light, then you can put it in the bash script and run from Domoticz

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Posted: Friday 21 October 2016 11:22
by corbin
I've tested to confirm it works:
dummy-switch.PNG
dummy-switch.PNG (60.12 KiB) Viewed 2048 times
contents of bright.sh:

Code: Select all

#!/bin/bash
echo -ne '{"id":1,"method":"set_bright","params":[50, "smooth", 500]}\r\n' | nc -w1 192.168.5.29 55443
bright.sh is located in the Domoticz scripts folder:

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Posted: Friday 21 October 2016 11:31
by corbin
Also with your bash command, using start_cf requires the bulb to already be on. if you want to run from off state, replace start_cf with set_scene

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Posted: Friday 21 October 2016 11:35
by corbin
one more thing I just saw in your setup, you have 3 slashes. Change to two:

script:///home

change to

script://home

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Posted: Friday 21 October 2016 11:50
by Derik
corbin wrote:one more thing I just saw in your setup, you have 3 slashes. Change to two:

script:///home

change to

script://home
Make no different...

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Posted: Friday 21 October 2016 12:01
by corbin
does the command work in terminal for you?

Re: Help with Yeelight Bulb

Posted: Friday 21 October 2016 12:05
by corbin
weiweipossible wrote: Besides that, if we implement the same form of API, we may receive a letter from Philips' lawyer ... just like when we develop this bulb using the everyone-is-using PWM technique ...
Are you able to talk about this PWM lawyer letter? Interested to know what it was about?

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Posted: Friday 21 October 2016 13:28
by Derik
Terminal:

Code: Select all

linaro@cubie:~$ cd /home/linaro/domoticz/scripts/bash/yeelight
linaro@cubie:~/domoticz/scripts/bash/yeelight$ echo -ne '{"id":1,"method":"set_s                            cene", "params": ["color", 65280, 70]}\r\n' | nc -w1 192.168.5.30 55443
{"id":1, "result":["ok"]}
{"method":"props","params":{"power":"on"}}
{"method":"props","params":{"color_mode":1,"bright":70,"rgb":65280}}
linaro@cubie:~/domoticz/scripts/bash/yeelight$

Light was off..
And after this on wih a green light...

Other things i try:

Code: Select all

linaro@cubie:~$ cd /home/linaro/domoticz/scripts/bash/yeelight
linaro@cubie:~/domoticz/scripts/bash/yeelight$ echo -ne '{"id":1,"method":"set_s                            cene", "params": ["color", 65280, 70]}\r\n' | nc -w1 192.168.5.30 55443
{"id":1, "result":["ok"]}
{"method":"props","params":{"power":"on"}}
{"method":"props","params":{"color_mode":1,"bright":70,"rgb":65280}}
linaro@cubie:~/domoticz/scripts/bash/yeelight$ ^C
linaro@cubie:~/domoticz/scripts/bash/yeelight$ echo -ne '{"id":1, "method":"start_cf", "params":[3,1,"50,1,16731392,1,360000,2,1700,10,540000,2,2700,100"]}\r\n' | nc -w1 192.168.5.30 55443
{"id":1, "result":["ok"]}
{"method":"props","params":{"flowing":1}}
{"method":"props","params":{"flow_params":"3,1,50,1,16731392,1,360000,2,1700,10,540000,2,2700,100"}}
linaro@cubie:~/domoticz/scripts/bash/yeelight$ ./start_1.sh
{"id":(null), "error":{"code":-1, "message":"invalid command"}}
linaro@cubie:~/domoticz/scripts/bash/yeelight$ ./ start_1.sh
-bash: ./: Is a directory
linaro@cubie:~/domoticz/scripts/bash/yeelight$ ./start_1.sh
{"id":(null), "error":{"code":-1, "message":"invalid command"}}
linaro@cubie:~/domoticz/scripts/bash/yeelight$ ./sunrise_1.sh
{"id":(null), "error":{"code":-1, "message":"invalid command"}}
linaro@cubie:~/domoticz/scripts/bash/yeelight$
Think the script is not ok.

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Posted: Friday 21 October 2016 14:28
by corbin
Can you upload your start_1.sh file please?

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Posted: Friday 21 October 2016 14:47
by Derik

Code: Select all

#!/bin/sh
echo -ne '{"id":1,"method":"set_scene", "params": ["color", 65280, 70]}\r\n' | nc -w1 192.168.5.30 55443
And then:
ScreenShot069.jpg
ScreenShot069.jpg (67.8 KiB) Viewed 2024 times
Working with the portal..

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Posted: Friday 21 October 2016 15:33
by weiweipossible
Derik wrote:Terminal:

Code: Select all

linaro@cubie:~$ cd /home/linaro/domoticz/scripts/bash/yeelight
linaro@cubie:~/domoticz/scripts/bash/yeelight$ echo -ne '{"id":1,"method":"set_s                            cene", "params": ["color", 65280, 70]}\r\n' | nc -w1 192.168.5.30 55443
{"id":1, "result":["ok"]}
{"method":"props","params":{"power":"on"}}
{"method":"props","params":{"color_mode":1,"bright":70,"rgb":65280}}
linaro@cubie:~/domoticz/scripts/bash/yeelight$

Light was off..
And after this on wih a green light...

Other things i try:

Code: Select all

linaro@cubie:~$ cd /home/linaro/domoticz/scripts/bash/yeelight
linaro@cubie:~/domoticz/scripts/bash/yeelight$ echo -ne '{"id":1,"method":"set_s                            cene", "params": ["color", 65280, 70]}\r\n' | nc -w1 192.168.5.30 55443
{"id":1, "result":["ok"]}
{"method":"props","params":{"power":"on"}}
{"method":"props","params":{"color_mode":1,"bright":70,"rgb":65280}}
linaro@cubie:~/domoticz/scripts/bash/yeelight$ ^C
linaro@cubie:~/domoticz/scripts/bash/yeelight$ echo -ne '{"id":1, "method":"start_cf", "params":[3,1,"50,1,16731392,1,360000,2,1700,10,540000,2,2700,100"]}\r\n' | nc -w1 192.168.5.30 55443
{"id":1, "result":["ok"]}
{"method":"props","params":{"flowing":1}}
{"method":"props","params":{"flow_params":"3,1,50,1,16731392,1,360000,2,1700,10,540000,2,2700,100"}}
linaro@cubie:~/domoticz/scripts/bash/yeelight$ ./start_1.sh
{"id":(null), "error":{"code":-1, "message":"invalid command"}}
linaro@cubie:~/domoticz/scripts/bash/yeelight$ ./ start_1.sh
-bash: ./: Is a directory
linaro@cubie:~/domoticz/scripts/bash/yeelight$ ./start_1.sh
{"id":(null), "error":{"code":-1, "message":"invalid command"}}
linaro@cubie:~/domoticz/scripts/bash/yeelight$ ./sunrise_1.sh
{"id":(null), "error":{"code":-1, "message":"invalid command"}}
linaro@cubie:~/domoticz/scripts/bash/yeelight$
Think the script is not ok.
You missed the "id" field which is mandatory.

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Posted: Friday 21 October 2016 16:17
by Derik

Code: Select all

linaro@cubie:~/domoticz/scripts/bash/yeelight$ echo -ne '{"id":1,"method":"set_scene", "params": ["color", 65280, 70]}\r\n' | nc -w1 192.168.5.30 55443
{"id":1, "result":["ok"]}
{"method":"props","params":{"color_mode":1}}
{"method":"props","params":{"bright":70}}
linaro@cubie:~/domoticz/scripts/bash/yeelight$
Te correct way....
Looks


Light was chancing
Only i still get the script in the document not working...

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Posted: Saturday 22 October 2016 2:32
by corbin
So it looks like there is a problem with your bash file. are you able to execute other bash files?

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Posted: Saturday 22 October 2016 8:33
by Derik
corbin wrote:So it looks like there is a problem with your bash file. are you able to execute other bash files?
Yes other scripts are working fine.

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Posted: Saturday 22 October 2016 9:11
by Derik
strange:
the scripts ..when i try to run them

Code: Select all

linaro@cubie:~/domoticz/scripts/bash/yeelight$ ./start.sh
{"id":(null), "error":{"code":-1, "message":"invalid command"}}
linaro@cubie:~/domoticz/scripts/bash/yeelight$ ./sunrise.sh
{"id":1, "result":["ok"]}
linaro@cubie:~/domoticz/scripts/bash/yeelight$
There are 2 things.
1 says ok, only there is no thing happend with the bulb.
1 error.

When i use start in the terminal
The light is working ok.
is there perhaps a other type of script necessary..?
My Hue is ussing without the extention .sh
ScreenShot071.jpg
ScreenShot071.jpg (148.79 KiB) Viewed 1987 times
While there is in the the same, start.

Code: Select all

#!/bin/bash
ScreenShot072.jpg
ScreenShot072.jpg (54.61 KiB) Viewed 1987 times

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Posted: Saturday 22 October 2016 9:24
by corbin
Did you create your Hue script file the same way you created the Yeelight file? Same text editor, file permissions exactly the same etc? Maybe try a Cubieboard forum and see if someone else can run the script ok.

Can you also post up more information about your Cubieboard setup?

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Posted: Saturday 22 October 2016 21:45
by Derik
corbin wrote:Did you create your Hue script file the same way you created the Yeelight file? Same text editor, file permissions exactly the same etc? Maybe try a Cubieboard forum and see if someone else can run the script ok.

Can you also post up more information about your Cubieboard setup?
everything the same
CB2 is the same setup as a Rpi.. so that cannot be the problem.
Is there perhaps someone else that have a script working in a Linux board?

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Posted: Sunday 23 October 2016 3:20
by farhanito
This is my test script..

Code: Select all

#!/bin/bash

toggle="{\"id\":1,\"method\":\"toggle\",\"params\":[]}\r\n"
on="{\"id\":1,\"method\":\"set_power\",\"params\":[\"on\",\"smooth\",500]}\r\n"
off="{\"id\":1,\"method\":\"set_power\",\"params\":[\"off\",\"smooth\",500]}\r\n"
b="{\"id\":1,\"method\":\"set_bright\",\"params\":[$2,\"smooth\",500]}\r\n"
ct="{\"id\":1,\"method\":\"set_ct_abx\",\"params\":[$2,\"smooth\",500]}\r\n"



exec 3<> /dev/tcp/192.168.31.101/55443

# echo $1

case $1 in
	toggle)
		printf "$toggle" >&3
	;;
	on)
		printf "$on" >&3
	;;
	off)
		printf "$off" >&3
	;;
	b)
		printf "$b" >&3
	;;
	ct)
		printf "$ct" >&3
	;;
esac
Only has few functions. Toggle, on, off, brightness (b), and color temperature (ct).
Change the IP according to yours.

Usage:
./toggle.sh toggle
./toggle.sh on
./toggle.sh off
./toggle.sh b [1-100]
./toggle.sh ct [2700-6500]

Re: [Plugin now available in Beta] Help with Yeelight Bulb

Posted: Sunday 23 October 2016 10:58
by Derik
@ Farhanito
Thanks for the script..
Only .....
./ is the command for the portal?

Do you use separate scriptfiles?
How do you make them excuteble?
And please a screendump of your script command in the Domoticz button.
What hardware do you use?