Giter Site home page Giter Site logo

Comments (4)

unparagoned avatar unparagoned commented on August 13, 2024

You need to use a dash before the set -set So

node njstuya.js -ip <deviceip> -id <deviceid> -key <devicekey> -set "{ \"dps\": 1, \"set\": true }"
node njstuya.js -ip <deviceip> -id <deviceid> -key <devicekey> -set "{ \"dps\": 1, \"set\": false }"

from njstuya.

RikMuilwijk avatar RikMuilwijk commented on August 13, 2024

Thank you! I overlooked this in my comment, as stated this was already working.

I'm particularly interested in the MQTT-end of this code. Do you know which device is sending the final MQTT command to my device or where I can find this code? By using this wrapper I can connect to it and control it. On the other hand, sorry for bothering you with this question, I know this might not be the best place for it..

from njstuya.

unparagoned avatar unparagoned commented on August 13, 2024

I think you are on the wrong git page. I think you might want https://github.com/TheAgentK/tuya-mqtt

from njstuya.

unparagoned avatar unparagoned commented on August 13, 2024

I haven't run tuya-mqtt before and it's too much effort to set up, but I did have a quick look at the code and made some changes. I'm not too hot on mqtt so I may be wrong but it doesn't look like you can send dps directly using that code. I made some minor changes so it might work but I haven't tested it. So try using my modified tuya-mqtt file. It's just a couple of functions if you want to add them to your existing setup.
https://github.com/unparagoned/tuya-mqtt/blob/master/tuya-mqtt.js
So there already are functions to publish the data, I added a couple that receive messages that should send the dps commands to your device. So I used a similar format as they are published. But it's not exactly, I don't know if that means it won't wok.
I added two topic or whatever, dps and dpsJ. The J means that the DPSCOMMAND goes through a JSON.parse before being sent on.

 type + "/" + tuyaID + "/" + tuyaKey + "/" + tuyaIP + "/" +dps +"/" +DPSCOMMAND"
So something like this 
socket/32kdjtuyaIDsdfdf/3dfxtuyaKey/123.123.1.0.1/dps/"{ \"dps\": 1, \"set\": true }"

socket/32kdjtuyaIDsdfdf/3dfxtuyaKey/123.123.1.0.1/dpsJ/"{ \"dps\": 1, \"set\": true }"

from njstuya.

Related Issues (20)

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.