hgross / node-red-contrib-tuya-smart

NodeRED nodes to get data from tuya smart devices (like smart plugs, bulbs, ...).
MIT License
43 stars 14 forks source link

always says "disconnected" #9

Open kiai72 opened 5 years ago

kiai72 commented 5 years ago

Hello,

got deviceId + key with tuyacli. these are the 2 values i configured in the node-red tuya-smart-node. But i always says "disconnected" - don't get any feedback. IP i left blank - and that's why node red always says this node is not configured correctly. Is this related to my problem ?

what ip should i give here ? my internal IP of the doorsensor ?

mturbutt commented 5 years ago

Yes, you need to provide the local IP address of the device on your network (192.168.x.x).

kiai72 commented 5 years ago

i did now. but this does not change anything. ok, it don't the errormessage when i deploy the flow anymore. but status is always disconnected. Trigger never runs. I don't get the point of giving the local IP anyway. This sensor is not online all the time. When i open/close the door - i see it on my router: it goes online for maybe a minute (sends the events to tuya) - then it goes offline again.

mturbutt commented 5 years ago

The tuya api (tuyapi - that this node is built upon) requires an ip address to communicate with the device via your network.

As I understand it, these door sensors are battery powered so the sensor wakes up the board and connects to the network, sends the signal and goes back to sleep to preserve battery power. So what you're seeing is expected.

What is it that you're trying to do? If you connect a debug node to the output of the tuyasmart node and trigger the sensor, do you receive any payload data in the node-red debug console?

kiai72 commented 5 years ago

What is it that you're trying to do? i want to recorgnize door-open and door-close event. i assumed tuyapi acts similar as the tuya app on the smartphone. The smartphone app obviously communicates with the tuya server. isn't it that way ?

If you connect a debug node to the output of the tuyasmart node and trigger the sensor, do you receive any payload data in the node-red debug console? No it just goes on "disconnected" - and does not even runs the following debug node.

mturbutt commented 5 years ago

Can I just check that you don't have the Tuya app open on your phone while you're trying to use the node-red node? This is a known limitation of the tuyapi (see https://github.com/codetheweb/tuyapi#-notes). The mobile app takes over the communication protocol of the device and blocks comms with the NR node/tuyapi. Make sure the mobile app is fully closed and try triggering the sensor again to check the payload data in the debug node. If it was the app causing the issue, you should see the device connect to deliver the data. Fingers crossed...

kiai72 commented 5 years ago

i shut down the smartphone. but no change. It still does not even call the debug-node. isn't there any advanced log that i can check ? image image

mturbutt commented 5 years ago

I'm afraid I don't know. Maybe @hgross is able to shed some light on this. For what it's worth, this node was originally built to talk to always-on devices like power strips, bulbs and leds. The fact that this device only connects when activated (due to battery saving) might be causing the issue. I did a bit of Googleing to see if you could do something using the IFTTT SmartLife service and found this Reddit post where others are having issues with real time triggers from SmartLife door sensors. Other posts seem to suggest flashing the device with Tasmota firmware is the way to go but they also don't support battery operated devices. I'm starting to see a pattern forming here. See the end of this post. Sorry I couldn't be of more help. From what I've read, it sounds like IFTTT/Smartlife might work but there are latency issues.

kiai72 commented 5 years ago

thank you for all this informations. But what i still don't understand is: the device works the way you described: goes to sleep mode/offline - to save battery. But the smartphone app works anyway! that means: the smartphone app does not talk to the doorsensor - it communicates with tuya-server - to query the latest status the sensor sent to the tuya-server. Actually all i want to have is: have the same logic from the smartphone app on the raspberry pi - so the raspberry pi can query the latest reported status (from tuya server). But this is not the way tuyapi works - am i right ? Do you know a way to do this (query the latest reported status from server)?

About Tasmota: interesting project. actually i already thought about it. But you hardly read about success when it comes to doorsensors, that's why i didn't try yet. In this post they seem to have problems after deep-sleep as well. If this will work one day - i might try this as well.

mturbutt commented 5 years ago

You're correct, tuyapi handles all the device traffic locally without accessing tuya-server. The only way I can think of to handle this is to use IFTTT (which works as a service with tuya-server) and have node-red react to the smartlife trigger using IFTTT broker. https://flows.nodered.org/node/node-red-contrib-ifttt-broker

kiai72 commented 5 years ago

the tuya->IFTTT connection is terribly slow! i already tried this. ok, so looks like there's no other option at the moment. Thank you for all your help. please keep me in mind, in case you hear of some new development.

mturbutt commented 5 years ago

I will, of course. Interesting devices so I might want to play with them myself once the issues have been resolved. Haven't tried any battery driven sensors yet but I have a few use cases I want to explore. Good luck.

fuzzyogic commented 5 years ago

i have multiple gosund smart plugs and all was working fine until I got this new batch of plugs last week. The old plugs have wifi module 1.0.4/ mcu module 1.0.4 and those work just fine and are still working fine. The new plugs have not worked yet, they have 1.0.5 for both modules and they are also in the disconnected state. When telneting to port 6668 on the old plugs, the session stays open until i escape out or hit the default timeout value which >=10 secs. When telneting to the new plugs on port 6668, "Connection closed by foreign host" in < 1 sec. I do not have the smart life app open on the phone during any of the tests. If this project is still in development, I would gladly provide whatever info i can get to support these newer modules. I greatly appreciate the node red community and want to say thanks for all that has already been done.

-- edit: fix grammar --

fuzzyogic commented 5 years ago

It looks like the newer firmware implements tls...

https://github.com/codetheweb/tuyapi/issues/175

fuzzyogic commented 5 years ago

It looks like tuyapi has been updated to 5.1.1 to support the new tuya firmware. Is this node red module going to be updated to use 5.1.1?

jncanches commented 5 years ago

It looks like tuyapi has been updated to 5.1.1 to support the new tuya firmware. Is this node red module going to be updated to use 5.1.1?

+1 :-)

andreypopov commented 5 years ago

the same issue update everything pls)

andreypopov commented 5 years ago

2019-08-08_22-34-36 2019-08-08_22-34-43

Should I use devId + localKey ?

"devId":"478803312cf43203f93d "productId": "8QMq5QyBkZDiA8ME", "localKey": "6efbee0a47399ec3"

razorRun commented 5 years ago

I am getting the same issue. Trying to get a smart plug up and running

kingofmummy commented 5 years ago

was work perfectly before. but now it always disconnected. plzzzzzz update :(

LukSzyd commented 5 years ago

I confirm now it's not working

polyphia commented 4 years ago

I also can confirm it's not working, always disconnected !

Gitarcitano commented 4 years ago

The same problem here, still disconnected.

Mallinanga commented 4 years ago

Same here. Disconnected

bogeuh commented 4 years ago

try this https://github.com/subzero79/node-red-contrib-tuya-local or ifttt webhooks

razorRun commented 4 years ago

Try this.

Its a separate app. but all the smart life devices work with it

On Sat, Feb 22, 2020 at 11:30 AM bogeuh notifications@github.com wrote:

try this https://github.com/subzero79/node-red-contrib-tuya-local or ifttt webhooks

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hgross/node-red-contrib-tuya-smart/issues/9?email_source=notifications&email_token=AFB72ECOXGXK7EPV7O6QMQ3REBIYLA5CNFSM4HMMQQ72YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMUJ3YI#issuecomment-589864417, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFB72EAUF66XMFVKFRUMT4LREBIYLANCNFSM4HMMQQ7Q .

pinpox commented 4 years ago

Any progress on this? Having the same issue with some Tuya switches. I got the devID and localKey but they are always "disconnected"

razorRun commented 4 years ago

Try this node https://github.com/razorRun/node-red-contrib-smartlifeair

On Fri, 11 Sep 2020 at 8:06 PM, Pablo Ovelleiro Corral < notifications@github.com> wrote:

Any progress on this? Having the same issue with some Tuya switches. I got the devID and localKey but they are always "disconnected"

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hgross/node-red-contrib-tuya-smart/issues/9#issuecomment-690943512, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFB72EGQZHPI56ODWAENPULSFHK7FANCNFSM4HMMQQ7Q .

Macht59 commented 2 years ago

I have the same issue. Any progress on this?