Using Send/Expect with Tasker and Yeelight Bulbs

184 views
Skip to first unread message

Graham Barfoot

unread,
Jul 24, 2018, 3:40:27 AM7/24/18
to Android Send/Expect
Hi peeps,

I'm successfully using send commands to tasker to control my yeelight bulbs but what I really want to do is query the bulb status before the send so I don't toggle lights off that are already on etc. Trouble is I can't get the expect to work, and store the response from the bulbs into a tasker variable.

The format for the send to the bulb from the bulb dev manual is:

{"id":1,"method":"get_prop","params":["power", "bright"]}

The response is:

{"id":1, "result":["on", "", "100"]}

I can't get the format for an expect (or I'm completely misunderstanbding what expect is for). Can anyone point me in the right direction. Send expect seems to complain about the JSON format using {}.

I've tried:

"id":1, "result":[<Power>,<Bright>]

"id":1, "result":[%Power,%Bright]

[<Power>,<Bright>]

[%Power,%Bright]

Thanks :)

G.

Graham Barfoot

unread,
Jul 24, 2018, 3:51:00 AM7/24/18
to Android Send/Expect
Ahh - literally the post before this one may have pointed me in the right direction - does this look like it might work?

I'm not at home so can't test at the moment but would be good to know if I'm on the right track finally.

The belw should store the status in %bulbstatus and brightness in %bulbbright

.*("result").*"(?<bulbstatus>on|off)".*"(?<bulbbright>[0-9]{1,3})".*

Reply all
Reply to author
Forward
0 new messages