Giter Club home page Giter Club logo

Comments (10)

NickWaterton avatar NickWaterton commented on August 24, 2024

Hi, you have a Json formatting problem.

The string '{white:{br:100, ct:0}}' is not valid Json. Json expects around strings (like “white”, “br”, “ct”).

So you would use the command:

mosquitto_pub -t "/ewelink_command/1001088fc6/send_json" -m '{“white”:{“br”:100, “ct”:0}}' 

You may also have to escape the depending on what OS/shell you are using.

You may also find that you don’t need the brackets ie

mosquitto_pub -t "/ewelink_command/1001088fc6/send_json" -m '“white”:{“br”:100, “ct”:0}' 

Let me know which of these (if any) works.

from ewelink-mqtt.

skycrack-77 avatar skycrack-77 commented on August 24, 2024

Hello Nick, thanks for your support.
unfortunately it doesn't work. I try everything for Days an read all the Comments in your code, without success.
mosquitto_pub -t "/ewelink_command/1001088fc6/send_json" -m '{"white":{"br":100, "ct":0}}' Sending command: {"action": "update", "userAgent": "app", "from": "app", "params": "{\"white\":{\"br\":100, \"ct\":0}}", "apikey": "0ea2ca0f-6b45-43ff-819a-710439769f54", "deviceid": "1001088fc6", "ts": 1619376019, "sequence": "1619376019255"}
[D Main.EwelinkClient ] WS connection closed

mosquitto_pub -t "/ewelink_command/1001088fc6/send_json" -m '"white":{"br":100, "ct":0}'
[D Main.EwelinkClient ] Sending command: {"action": "update", "userAgent": "app", "from": "app", "params": "\"white\":{\"br\":100, \"ct\":50}", "apikey": "0ea2ca0f-6b45-43ff-819a-710439769f54", "deviceid": "1001088fc6", "ts": 1619376520, "sequence": "1619376520404"}
[D Main.EwelinkClient ] WS connection closed

also i try
mosquitto_pub -t "/ewelink_command/1001088fc6/send_json" -m 'white: {'br': 2, 'ct': 0}'

[D Main.EwelinkClient ] CLIENT: message received topic: /ewelink_command/1001088fc6/send_json
[I Main.EwelinkClient ] CLIENT: Received Command: send_json, device: 1001088fc6, Setting: white: {br: 2, ct: 0}
[D Main.Default ] deviceid: 1001088fc6, got command from queue: send_json, white: {br: 2, ct: 0}
[I Main.Default ] Default CLIENT: Received Command: send_json, device: 1001088fc6, Setting: white: {br: 2, ct: 0}
[D Main.Default ] send_json: for device 1001088fc6
[D Main.EwelinkClient ] sending: {
"action": "update",
"apikey": "0ea2ca0f-6b45-42ff-819a-710439769f54",
"deviceid": "1001088fc6",
"from": "app",
"params": "white: {br: 2, ct: 0}",
"sequence": "1619377230468",
"ts": 1619377230,
"userAgent": "app"
}
[D Main.EwelinkClient ] Sending command: {"action": "update", "userAgent": "app", "from": "app", "params": "white: {br: 2, ct: 0}", "apikey": "0ea2ca0f-6b45-42ff-819a-710439769f54", "deviceid": "1001088fc6", "ts": 1619377230, "sequence": "1619377230468"}
[D Main.EwelinkClient ] WS connection closed
[D Main.EwelinkClient ] Disconnecting
[D Main.Default ] deviceid: 10008ae241, process queue exited: task completed
[D Main.Default ] deviceid: 100097c066, process queue exited: task completed
[D Main.Default ] deviceid: 10009345e5, process queue exited: task completed
[D Main.Default ] deviceid: 1000920eae, process queue exited: task completed
[D Main.Default ] deviceid: 1000644d1f, process queue exited: task completed
[D Main.Default ] deviceid: 10003baa31, process queue exited: task completed
[D Main.Default ] deviceid: 100103f737, process queue exited: task completed
[D Main.Default ] deviceid: 10003baafc, process queue exited: task completed
[D Main.Default ] deviceid: 1001088fc6, process queue exited: task completed
[D Main.Default ] deviceid: 10011fcc31, process queue exited: task completed
[D Main.EwelinkClient ] exited keepalive loop
[I Main.EwelinkClient ] published: EWE-MQclient/status: Disconnected
[D Main.EwelinkClient ] Exited Receive Loop
[W Main ] Client Disconnected

Format looks good, but no Success
sorry about that. hope we find a solution. Best Regards

from ewelink-mqtt.

NickWaterton avatar NickWaterton commented on August 24, 2024

I don’t have a B2 bulb to try, but I’ll take a look tomorrow.

By the way:

mosquitto_pub -t "/ewelink_command/1001088fc6/send_json" -m 'white: {'br': 2, 'ct': 0}'

Can’t work. Json expects around strings.
You could try this:

mosquitto_pub -t "/ewelink_command/1001088fc6/send_json" -m 'white: {“br”: 2, “ct”: 0}'

Json formatting is very specific. It might be easier to knock up a custom device for the B2, I’s fairly simple.

Are the settings ‘white’, ‘read’, ‘computer’ etc names that you gave to the settings? Or are they built in?

from ewelink-mqtt.

NickWaterton avatar NickWaterton commented on August 24, 2024

Ok, the problem is that it’s sending the command as a string, not Json.

mosquitto_pub -t "/ewelink_command/1001088fc6/send_json" -m '{"white":{"br":100, "ct":0}}'

Is the correct format, I need to figure out why it’s not being loaded as Json.

from ewelink-mqtt.

NickWaterton avatar NickWaterton commented on August 24, 2024

Ok, found it.

I just pushed a fixed version. Try pulling it now, hopefully it will now work correctly with:

mosquitto_pub -t "/ewelink_command/1001088fc6/send_json" -m '{"white":{"br":100, "ct":0}}'

from ewelink-mqtt.

NickWaterton avatar NickWaterton commented on August 24, 2024

Having looked through the code (which I haven't in a while), if the B2 gets set up as a default device, with the new version I just pushed, you could also use the command:

mosquitto_pub -t "/ewelink_command/1001088fc6/white" -m '{"br":100, "ct":0}'

or

mosquitto_pub -t "/ewelink_command/1001088fc6/bright" -m '{"br":100, "ct":0}'

or computer, read, nightLight etc. as these commands should be created by the default device automatically, along with set_switch. I'm not sure if ltype is a setting (it's set to white right now) - or is read only, but that would also be available as a command, eg:

mosquitto_pub -t "/ewelink_command/1001088fc6/ltype" -m 'read'

let me know if these commands work as expected, if so, a custom device isn't really needed.

from ewelink-mqtt.

skycrack-77 avatar skycrack-77 commented on August 24, 2024

Dear Nick, I am very excited once again.
mosquitto_pub -t "/ewelink_command/1001088fc6/send_json" -m '{"white":{"br":100, "ct":0}}'
works wonderfully.
I hope to be able to derive the remaining application functions in this way.
The other Params in your last Posting i will try.
Thank you very much for your very quick response and the time you invested.
if I had your address I would send you a B2 ;-)

from ewelink-mqtt.

NickWaterton avatar NickWaterton commented on August 24, 2024

Glad it's working.

I don't think sending me a B2 would help as it's a Europe only product I believe (220-240V). - I'm in Canada.

It did help sort out some bugs in the send_json interface anyway!

from ewelink-mqtt.

skycrack-77 avatar skycrack-77 commented on August 24, 2024

from ewelink-mqtt.

NickWaterton avatar NickWaterton commented on August 24, 2024

New App ID and Secret was required.

from ewelink-mqtt.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.