Giter VIP home page Giter VIP logo

Comments (7)

vinodsr avatar vinodsr commented on August 19, 2024 2

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.

vinodsr avatar vinodsr commented on August 19, 2024

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.

vinodsr avatar vinodsr commented on August 19, 2024

@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.

AymanFadda avatar AymanFadda commented on August 19, 2024

Hi. The firmware version is 1.4.2 both for main module and MCU module.
Thanks

from node-red-contrib-tuya-smart-device.

vinodsr avatar vinodsr commented on August 19, 2024

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.

juampe avatar juampe commented on August 19, 2024

I see mispelling of the dps parameter in your code.

dsp: 19

from node-red-contrib-tuya-smart-device.

AymanFadda avatar AymanFadda commented on August 19, 2024

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)

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.