Help with tuya-smart-device node

Hello

I have a WIFI switch that I'm controlling via the tuya-smart-device node successfully.

For my home automation setup, I have two independent instances of node red running on the one linux machine under two different user accounts.

The reason for this is that I want to have two dashboards for my home automation system, one for my phone and one for an ipad screen. The dashboard for the doesn't work well on the iphone.

I cannot get both instances of node red to connect to simultaneously to the one tuya device via the tuya-smart-device node. When I disconnect one, the other connects, but not both at the same time.

Can anyone think of a work around for this?

Thanks

I think you are trying to use the node the wrong way. Sorry.

You should make the dashboards for each person and then send the status from both of those bigger parts to the one node.

Just a thought.

Sorry not sure that I follow.

I think the way around it is to use MQTT to connect to the switches. Does anyone have a go by on how to send MQTT commands to WIFI devices in node red?

If you read the tuya node help

  1. Make sure that you haven't created multiple nodes for the same device. Multiple connections to the same device is not possible. This is a limitation of TuyAPI.

You will need to pick one node-red and have that connect to the tuya api. The other node-red instance will have to send its commands via first node-red, using http/mqtt/or other protocol.

Yeah I realized that after I posted. That might be a good work around, otherwise I'm trying to work out how to connect to these devices via straight MQTT, but not sure if that's possible :\

You say you have 2 of the same tuya node to control the one device.

As pointed out: you can't do that.

So my suggestion is that you change the two existing flows and where each talks to their own tuya node: delete one and connect it's inputs to the other one's input.

I use the Tuya nodes and I connect them to other Node- Red instances using MQTT. MQTT in to get status and issue commands and MQTT out to let the rest of the system know the state of the device. The nodes shown below will obviously not work for you but hopefully they will give you some ideas

[{"id":"35200d76f4989e92","type":"mqtt in","z":"4eb208f14551dccd","name":"Tuya Study Light Status","topic":"tuya2mqtt/+/device_status/Smart Bulb 04/get_status","qos":"2","datatype":"json","broker":"ee05e0d9.9118e","nl":false,"rap":true,"rh":0,"inputs":0,"x":120,"y":80,"wires":[["64ea03241ef78d14","a59e34a1af1414ca"]]},{"id":"1197417772aa19fb","type":"debug","z":"4eb208f14551dccd","name":"Tuya Port 1","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":730,"y":20,"wires":[]},{"id":"e2ea327cae523e02","type":"mqtt out","z":"4eb208f14551dccd","name":"Tuya Study Light Status","topic":"tuya2mqtt/NRTDO/device_status/Smart Bulb 04/status","qos":"1","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"ee05e0d9.9118e","x":770,"y":60,"wires":[],"info":"tuya/NRTDO/device_state/smart_bulb_04/state"},{"id":"0524560abd4e2643","type":"debug","z":"4eb208f14551dccd","name":"Tuya Port 2","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":730,"y":120,"wires":[]},{"id":"d84d25b0b9f3c2e7","type":"mqtt in","z":"4eb208f14551dccd","name":"Tuya Study Light Control","topic":"tuya2mqtt/+/device_control/Smart Bulb 04/command","qos":"2","datatype":"json","broker":"ee05e0d9.9118e","nl":false,"rap":true,"rh":0,"inputs":0,"x":130,"y":40,"wires":[["64ea03241ef78d14","a59e34a1af1414ca"]],"info":"tuya/NRDCO/device_control/smart_bulb_04/command\r\ntuya/+/device_control/smart_bulb_04/command"},{"id":"a59e34a1af1414ca","type":"debug","z":"4eb208f14551dccd","name":"MQTT In","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":440,"y":40,"wires":[]},{"id":"64ea03241ef78d14","type":"tuya-smart-device","z":"4eb208f14551dccd","deviceName":"Smart Bulb 04","disableAutoStart":false,"deviceId":"bfed04c9d469db879doe2y","deviceKey":"20120ede82e21064","deviceIp":"","retryTimeout":1000,"findTimeout":1000,"tuyaVersion":"3.1","eventMode":"event-both","x":460,"y":80,"wires":[["e2ea327cae523e02","1197417772aa19fb"],["0524560abd4e2643"]]},{"id":"ee05e0d9.9118e","type":"mqtt-broker","name":"MQTT","broker":"192.168.1.21","port":"1883","clientid":"","autoConnect":true,"usetls":false,"compatmode":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]

Set up home assistant

Integrate tuya smart

Link it to your node thru that api is easiest way I’ve found to use it.

Plus the dashboards are way cleaner!