[Plugin now available in Beta] Help with Yeelight Bulb

Moderator: leecollings

Post Reply
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Help with Yeelight Bulb

Post 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...
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
corbin
Posts: 463
Joined: Saturday 20 August 2016 22:57
Target OS: Windows
Domoticz version: Beta
Location: Brisbane, Australia
Contact:

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

Post by corbin »

open terminal
type or paste the command in and hit enter
terminal.PNG
terminal.PNG (22.55 KiB) Viewed 2048 times
If that works to control the light, then you can put it in the bash script and run from Domoticz
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
User avatar
corbin
Posts: 463
Joined: Saturday 20 August 2016 22:57
Target OS: Windows
Domoticz version: Beta
Location: Brisbane, Australia
Contact:

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

Post by corbin »

I've tested to confirm it works:
dummy-switch.PNG
dummy-switch.PNG (60.12 KiB) Viewed 2047 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:
Attachments
scripts-folder.PNG
scripts-folder.PNG (34.01 KiB) Viewed 2047 times
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
User avatar
corbin
Posts: 463
Joined: Saturday 20 August 2016 22:57
Target OS: Windows
Domoticz version: Beta
Location: Brisbane, Australia
Contact:

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

Post 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
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
User avatar
corbin
Posts: 463
Joined: Saturday 20 August 2016 22:57
Target OS: Windows
Domoticz version: Beta
Location: Brisbane, Australia
Contact:

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

Post by corbin »

one more thing I just saw in your setup, you have 3 slashes. Change to two:

script:///home

change to

script://home
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

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

Post 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...
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
corbin
Posts: 463
Joined: Saturday 20 August 2016 22:57
Target OS: Windows
Domoticz version: Beta
Location: Brisbane, Australia
Contact:

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

Post by corbin »

does the command work in terminal for you?
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
User avatar
corbin
Posts: 463
Joined: Saturday 20 August 2016 22:57
Target OS: Windows
Domoticz version: Beta
Location: Brisbane, Australia
Contact:

Re: Help with Yeelight Bulb

Post 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?
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

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

Post 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.
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
corbin
Posts: 463
Joined: Saturday 20 August 2016 22:57
Target OS: Windows
Domoticz version: Beta
Location: Brisbane, Australia
Contact:

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

Post by corbin »

Can you upload your start_1.sh file please?
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

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

Post 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 2023 times
Working with the portal..
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
weiweipossible
Posts: 10
Joined: Wednesday 19 October 2016 13:09
Target OS: Linux
Domoticz version:
Location: Qingdao, China
Contact:

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

Post 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.
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

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

Post 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...
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
corbin
Posts: 463
Joined: Saturday 20 August 2016 22:57
Target OS: Windows
Domoticz version: Beta
Location: Brisbane, Australia
Contact:

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

Post by corbin »

So it looks like there is a problem with your bash file. are you able to execute other bash files?
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

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

Post 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.
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

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

Post 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 1986 times
While there is in the the same, start.

Code: Select all

#!/bin/bash
ScreenShot072.jpg
ScreenShot072.jpg (54.61 KiB) Viewed 1986 times
Attachments
ScreenShot070.jpg
ScreenShot070.jpg (65.05 KiB) Viewed 1986 times
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
corbin
Posts: 463
Joined: Saturday 20 August 2016 22:57
Target OS: Windows
Domoticz version: Beta
Location: Brisbane, Australia
Contact:

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

Post 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?
Question about the Xiaomi Gateway in Domoticz? Please check the Wiki first: https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

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

Post 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?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
farhanito
Posts: 34
Joined: Friday 19 August 2016 5:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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]
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

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

Post 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?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest