Comments (4)
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.
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.
I think you are on the wrong git page. I think you might want https://github.com/TheAgentK/tuya-mqtt
from njstuya.
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)
- get/set command format issue with openhab
- is there a way to set set multiple dps options in one command? HOT 1
- Multi-outlet Devices HOT 4
- Error in openHAB HOT 5
- Status HOT 6
- Trying to understand local and cloud mode HOT 5
- Does this also work with the Woox products? HOT 5
- Cannot read schema from device. HOT 1
- Problem with Emylo SS-8839-03 and njstuya local
- "Error: find() timed out." when running "sudo node node_modules/njstuya" HOT 1
- Problem with connection to device after firmware upgrade HOT 5
- Tuya Curtain switch HOT 1
- Plug Compatibility Question - HOT 13
- Gusund Wall Switch does not respond to njstuya commands HOT 1
- debug error on run HOT 1
- Can't read the schema HOT 2
- Please add device - wattmeter. HOT 1
- Commands not send anymore HOT 2
- After upgrading my pi and then rebooting ... HOT 1
- Unable to authenticate after upgrade HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from njstuya.