Comments (7)
I see mispelling of the dps parameter in your code.
dsp: 19
;
Lets wait for the release of tuyapi with the fix. Once it is ready I will patch this node. 👍
from node-red-contrib-tuya-smart-device.
This is a known issue with some devices to query the exact status codetheweb/tuyapi#77
But you will be able to get the events associated with the device.
I am trying to find some alternatives.
Hope the set command is working fine :)
from node-red-contrib-tuya-smart-device.
@AymanFadda Can you please confirm the fimware version of the device ?
Got to Tuya app-> choose the device -> edit -> Select the "Check for firmware update at the bottom"
from node-red-contrib-tuya-smart-device.
Hi. The firmware version is 1.4.2 both for main module and MCU module.
Thanks
from node-red-contrib-tuya-smart-device.
This is a know issue with the tuya library on some devices.
More details about the issue can be found at codetheweb/tuyapi#338
Once it is fixed, we can bring the changes here.
Meanwhile i found a trick to resolve this issue partially .
Make the IP of the device static, and block all TCP/UDP connections above 6670 port from this IP. ( You router should support port blocking) . This prevents the cloud communication of the device. the json unvalid error has to do some thing with the communication with the tuya cloud api. so we are blocking it. Now only using the node we will be able to control the device. The app has no use now. You can disable to the port blocking and re connect the device to configure it via the app.
Once getting the response as null , hit a get request for dps 11( in my case it is the timer ) and value as 0. subsequent get calls wont give the json error. But it will return only the status of the 11 dps until some one issues a power on / off command.
Here is the flow for your reference
[{"id":"b3fe7bd8.137bb8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"e193ccfe.40b18","type":"tuya-smart-device","z":"b3fe7bd8.137bb8","deviceName":"Monitor Plug","deviceId":"ID","deviceKey":"VAL","x":810,"y":260,"wires":[["eeb76561.97b738","fb0c7d92.cda94"]]},{"id":"bfe7b1db.54784","type":"function","z":"b3fe7bd8.137bb8","name":"","func":"msg.payload ={\n dps : 1,\n set : msg.payload\n}\n\n/*\n\n */\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":440,"y":180,"wires":[["e193ccfe.40b18"]]},{"id":"eeb76561.97b738","type":"debug","z":"b3fe7bd8.137bb8","name":"Monitor Log","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1270,"y":160,"wires":[]},{"id":"d80648b8.1f5648","type":"inject","z":"b3fe7bd8.137bb8","name":"Get Schema","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"operation\":\"GET\",\"schema\":true}","payloadType":"json","x":250,"y":240,"wires":[["e193ccfe.40b18"]]},{"id":"e018fb88.6488c8","type":"function","z":"b3fe7bd8.137bb8","name":"","func":"msg.payload ={\n dps : 11,\n set : 0\n}\n\nnode.error(\"re sending the data\")\n/*\n\n */\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":560,"y":320,"wires":[["e193ccfe.40b18"]]},{"id":"fb0c7d92.cda94","type":"function","z":"b3fe7bd8.137bb8","name":"","func":"\nlet valueCount = Object.values(msg.payload.data.dps).filter(a=>a!=null).length;\nif(valueCount > 0) {\n // its fine\n msg.payload=false;\n} else {\n msg.payload=true;\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":980,"y":320,"wires":[["57e44bad.d254e4"]]},{"id":"f8470da2.7efb8","type":"inject","z":"b3fe7bd8.137bb8","name":"Turn On","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":240,"y":160,"wires":[["bfe7b1db.54784"]]},{"id":"bb2fc171.0e31f","type":"inject","z":"b3fe7bd8.137bb8","name":"Turn Off","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":240,"y":200,"wires":[["bfe7b1db.54784"]]},{"id":"57e44bad.d254e4","type":"switch","z":"b3fe7bd8.137bb8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":770,"y":360,"wires":[["e018fb88.6488c8"]]}]
Closing the issue as this is not a bug with this library
from node-red-contrib-tuya-smart-device.
I see mispelling of the dps parameter in your code.
dsp: 19
from node-red-contrib-tuya-smart-device.
I see mispelling of the dps parameter in your code.
dsp: 19
Thank you Juampe. with both dsp or dps it's not working. As vinodsr said, it must be a problem in the API of Tuya.
from node-red-contrib-tuya-smart-device.
Related Issues (20)
- Cannot install HOT 1
- Device not connected HOT 2
- Gateway connection glitch causes restart of Node-Red (uncaught) HOT 4
- Weird key format? HOT 3
- Tuya protocol 3.4, 3.5 support missed HOT 1
- An unusual response - 2 HOT 1
- Node does not work in conjunction with Http in node HOT 1
- how to connect to sub-devices that are managed by a tuya gateway? HOT 2
- Bi-Meter disconnects from node red HOT 5
- GET response the same for schema and DPS ID HOT 3
- unreadable 'data' output from node HOT 2
- Device not connected. Can't send the SET commmand HOT 1
- where do i set the api credentials HOT 1
- [announce] nr_Tuya_OpenAPI_2.0, a node_red flow to access Tuya Cloud HOT 1
- Manage all Tuya devices with node-red HOT 1
- Cluttered log file HOT 7
- Problem with Error code "Payload must be a number in range 0-100" HOT 1
- Error in tuyapi
- More finner log info control
- Data refresh very Slow 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 node-red-contrib-tuya-smart-device.