tzapu / node-red-contrib-blynk

Blynk app integration with Node Red
MIT License
17 stars 5 forks source link

Doesn't recover from server down #16

Open scargill opened 8 years ago

scargill commented 8 years ago

It SEEMS that the only way this recovers from the Blynk server being temporarily down - is to restart node-red... any chance of working on that?

tzapu commented 8 years ago

@scargill any verbose logs that i can look at?

mine has been running non stop now for a week...

scargill commented 8 years ago

I will turn verbose on – I’m held back a little here as we’re having the broadband replaces and I’m messing with modems!! It died again this morning (uk installation with just one connection) – opening the connection – UPDATE once again restarted it.

Pete.

From: tzapu [mailto:notifications@github.com] Sent: 15 December 2015 09:22 To: tzapu/node-red-contrib-blynk node-red-contrib-blynk@noreply.github.com Cc: Peter Scargill pete@scargill.org Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

@scargill https://github.com/scargill any verbose logs that i can look at?

mine has been running non stop now for a week...

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-164696865 . https://github.com/notifications/beacon/ABzUg-YxEEDHSAibHEsEZ35igDj26n2cks5pP9NDgaJpZM4Gm_QF.gif

tzapu commented 8 years ago

hi, whenever suits you, just on one server should be fine, no need for both cheers

tzapu commented 8 years ago

finally got a disconnect myself, there doesn t seem to be any reconnect attempt at all. i will look into it more, but there s not point now to give me your logs, saw what i needed, thanks

Toshibass commented 8 years ago

Would be interested to see what your log looks like (just to compare) my setup has also been semi stable over the last few days, although I have had a few ...

17 Dec 18:04:52 - [red] Uncaught Exception: 17 Dec 18:04:52 - Error: write EPIPE at errnoException (net.js:905:11) at Object.afterWrite (net.js:721:19)

mainly when i have been deploying node-red for other reasons nothing to do with n-r-c-b

scargill commented 8 years ago

I’m so pleased – not because your excellent program has gone wrong :) but because you now know I’m not going mad. No, when disconnected I have NEVER seen it try to reconnect… hence the restart of Node-Red. Clearly it’s not the BLYNK server or restarting Node-Red would not make any difference.

Good luck – let me know If you want anything testing.

Pete.

From: tzapu [mailto:notifications@github.com] Sent: 17 December 2015 17:50 To: tzapu/node-red-contrib-blynk node-red-contrib-blynk@noreply.github.com Cc: Peter Scargill pete@scargill.org Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

finally got a disconnect myself, there doesn t seem to be any reconnect attempt at all. i will look into it more, but there s not point now to give me your logs, saw what i needed, thanks

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-165527830 . https://github.com/notifications/beacon/ABzUg7PqfXV4lqW9Uj9I_1B5gNmB6_l1ks5pQu1kgaJpZM4Gm_QF.gif

tzapu commented 8 years ago

added some more fixes to the blynk library, hopefully the blynk team will merge them quickly https://github.com/vshymanskyy/blynk-library-js/pull/13

scargill commented 8 years ago

Does this mean you have updates or we have to wait for BLYNK to do something?

From: tzapu [mailto:notifications@github.com] Sent: 17 December 2015 20:29 To: tzapu/node-red-contrib-blynk node-red-contrib-blynk@noreply.github.com Cc: Peter Scargill pete@scargill.org Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

added some more fixes to the blynk library, hopefully the blynk team will merge them quickly vshymanskyy/blynk-library-js#13 https://github.com/vshymanskyy/blynk-library-js/pull/13

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-165573775 . https://github.com/notifications/beacon/ABzUg8hIj-PhQ9HL1jyGYrRBFOB3y2kbks5pQxKLgaJpZM4Gm_QF.gif

tzapu commented 8 years ago

hi, hopefully i have found what happened and fixed it. but the fix is not in my library is in BLYNK's so they need to accept my fix, merge it, release new package and then we will all rejoice i have pushed the changes from my node red lib, but they are rather useless without the above.

tzapu commented 8 years ago

@scargill i am also glad i was able to replicate something, hopefully it s the same problem you guys have encountered @Toshibass sorry, i missed your post, mainly my log would just show a disconnect and no attempt what so ever of reconnect. i did not have any exception or error thrown.

2015-12-17T19:41:43.821+0200[App/0]OUT17 Dec 17:41:43 - [info] [blynk-lcd-print:b533ba5a.4acc48] disconnected
2015-12-17T19:41:43.821+0200[App/0]OUT17 Dec 17:41:43 - [warn] [blynk-server:c24f6f52.3db09] key: 3e937439596f4ec68851d17b1b25 disconnected
2015-12-17T19:41:43.823+0200[App/0]OUT17 Dec 17:41:43 - [info] [blynk-write:6cdd0d0.f9322f4] disconnected
2015-12-17T19:41:43.824+0200[App/0]OUT17 Dec 17:41:43 - [info] [blynk-write:be2b6429.41d498] disconnected
2015-12-17T19:41:43.824+0200[App/0]OUT17 Dec 17:41:43 - [info] [blynk-read-event:4f0873ad.b0f78c] disconnected
2015-12-17T19:41:43.824+0200[App/0]OUT17 Dec 17:41:43 - [info] [blynk-read-event:aac13828.553ec8] disconnected
2015-12-17T19:41:43.824+0200[App/0]OUT17 Dec 17:41:43 - [info] [blynk-write:de69917.f21967] disconnected
2015-12-17T19:41:43.824+0200[App/0]OUT17 Dec 17:41:43 - [info] [blynk-read-event:d35491e9.2cab7] disconnected
2015-12-17T19:41:43.824+0200[App/0]OUT17 Dec 17:41:43 - [info] [blynk-read-event:7847c61a.87b838] disconnected
2015-12-17T19:41:43.824+0200[App/0]OUT17 Dec 17:41:43 - [info] [blynk-read-event:c8fca961.370358] disconnected
2015-12-17T19:41:43.824+0200[App/0]OUT17 Dec 17:41:43 - [info] [blynk-read-event:e2704bf4.1d8fb8] disconnected
2015-12-17T19:41:43.824+0200[App/0]OUT17 Dec 17:41:43 - [info] [blynk-write:d0d5770c.2f2a88] disconnected
2015-12-17T19:41:43.824+0200[App/0]OUT17 Dec 17:41:43 - [info] [blynk-write:8bca4506.7435b8] disconnected
2015-12-17T19:41:43.824+0200[App/0]OUT17 Dec 17:41:43 - [info] [blynk-write:f6e91480.0916e8] disconnected
2015-12-17T19:41:43.824+0200[App/0]OUT17 Dec 17:41:43 - [info] [blynk-read-event:596546c1.a69ab8] disconnected
2015-12-17T19:41:43.824+0200[App/0]OUT17 Dec 17:41:43 - [info] [blynk-read-event:831b0c14.7ce4f] disconnected
2015-12-17T19:41:43.824+0200[App/0]OUT17 Dec 17:41:43 - [info] [blynk-write:d9d86191.2627a] disconnected
2015-12-17T19:41:43.824+0200[App/0]OUT17 Dec 17:41:43 - [info] [blynk-write:d05ad2df.2fa53] disconnected
2015-12-17T19:41:43.824+0200[App/0]OUT17 Dec 17:41:43 - [info] [blynk-read-event:a2374d16.5dc8b] disconnected
2015-12-17T19:41:43.824+0200[App/0]OUT17 Dec 17:41:43 - [info] [blynk-write:91200a5e.6edff8] disconnected
2015-12-17T19:41:43.824+0200[App/0]OUT17 Dec 17:41:43 - [info] [blynk-write:b5f74e59.4a08b] disconnected
scargill commented 8 years ago

I think you’d better have a chat with the people at Blynk – I asked them to incorporate your changes and this is the result..

http://community.blynk.cc/user_avatar/community.blynk.cc/dmitriy/45/226_1.png

http://mandrillapp.com/track/click/30526449/community.blynk.cc?p=eyJzIjoiUXFkNGJnMjFlbDR4MVhqUFR6VjJCS2tobEc4IiwidiI6MSwicCI6IntcInVcIjozMDUyNjQ0OSxcInZcIjoxLFwidXJsXCI6XCJodHRwOlxcXC9cXFwvY29tbXVuaXR5LmJseW5rLmNjXFxcL3VzZXJzXFxcL2RtaXRyaXlcIixcImlkXCI6XCIzNjgzNGVmYjg0ZGY0YzUwYmVlOWEwYjA3YmEyYmY2MFwiLFwidXJsX2lkc1wiOltcIjg4ODliZmYyM2Y0OTI2MjJlMDY2MjcwNDcwZjFhOGU0M2I0NTQ0NmRcIl19In0 Dmitriy Co-Founder December 18

Could you please explain what fix do you mean?

To respond, http://mandrillapp.com/track/click/30526449/community.blynk.cc?p=eyJzIjoiU25NelVURGlSTVZad2ZaaE12UkxERHczbmVBIiwidiI6MSwicCI6IntcInVcIjozMDUyNjQ0OSxcInZcIjoxLFwidXJsXCI6XCJodHRwOlxcXC9cXFwvY29tbXVuaXR5LmJseW5rLmNjXFxcL3RcXFwvYmx5bmstZm9yLW5vZGUtcmVkXFxcLzMyMDRcXFwvMlwiLFwiaWRcIjpcIjM2ODM0ZWZiODRkZjRjNTBiZWU5YTBiMDdiYTJiZjYwXCIsXCJ1cmxfaWRzXCI6W1wiOGIzZTEzYTE1ZWRjYjljMDU1MTM3YWI5ODBiOTJlNGM0MGUwYTAxZlwiXX0ifQ visit the topic in your browser.

From: tzapu [mailto:notifications@github.com] Sent: 18 December 2015 03:42 To: tzapu/node-red-contrib-blynk node-red-contrib-blynk@noreply.github.com Cc: Peter Scargill pete@scargill.org Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

hi, hopefully i have found what happened and fixed it. but the fix is not in my library is in BLYNK's so they need to accept my fix, merge it, release new package and then we will all rejoice i have pushed the changes from my node red lib, but they are rather useless without the above.

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-165661690 . https://github.com/notifications/beacon/ABzUg43dgbTWSay3Hke9rfnlAX0RbqnKks5pQ3fzgaJpZM4Gm_QF.gif

scargill commented 8 years ago

Well, this morning the node-red blynk icons were all stopped again…

Here’s the link to my various logs for what it is worth..

https://www.dropbox.com/sh/k39z2bnsdll4azw/AAAPSwIBuHH6GXclwn-yC64La?dl=0

I restarted the Blynk server – no difference (I don’t think it had stopped).

I looked at the config node – hit update on that – nothing….

I restarted node-red – all is well…. Until the next time it stops – nothing else is stopping – just the blynk stuff..

Pete.

From: tzapu [mailto:notifications@github.com] Sent: 18 December 2015 03:42 To: tzapu/node-red-contrib-blynk node-red-contrib-blynk@noreply.github.com Cc: Peter Scargill pete@scargill.org Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

hi, hopefully i have found what happened and fixed it. but the fix is not in my library is in BLYNK's so they need to accept my fix, merge it, release new package and then we will all rejoice i have pushed the changes from my node red lib, but they are rather useless without the above.

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-165661690 . https://github.com/notifications/beacon/ABzUg43dgbTWSay3Hke9rfnlAX0RbqnKks5pQ3fzgaJpZM4Gm_QF.gif

tzapu commented 8 years ago

aww, crap.. will look at it

tzapu commented 8 years ago

any node red logs as well? out of curiosity, when the icons were off, was the mobile app not updating as well?

scargill commented 8 years ago

The PM2 log file is node-red (strange indeed)… you know I didn’t check the APP – I’ll have to do that next time – ok, until then….

From: tzapu [mailto:notifications@github.com] Sent: 22 December 2015 12:45 To: tzapu/node-red-contrib-blynk node-red-contrib-blynk@noreply.github.com Cc: Peter Scargill pete@scargill.org Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

any node red logs as well? out of curiosity, when the icons were off, was the mobile app not updating as well?

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-166608705 . https://github.com/notifications/beacon/ABzUg9Dv7QLz-j9RPbrHv-HCCQX_y82dks5pST01gaJpZM4Gm_QF.gif

tzapu commented 8 years ago

nothing in pm2.log from node-red directly i think there s another service-name.out.log or similar that pm2 makes that contains the output from the service

tzapu commented 8 years ago

maybe it s also worth listing what packages you have installed, what versions for blynk something like npm list -g --depth=1|grep blynk

scargill commented 8 years ago

Erm.. nothing happened when I did that – just came back to the prompt ??

From: tzapu [mailto:notifications@github.com] Sent: 22 December 2015 13:27 To: tzapu/node-red-contrib-blynk node-red-contrib-blynk@noreply.github.com Cc: Peter Scargill pete@scargill.org Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

maybe it s also worth listing what packages you have installed, what versions for blynk something like npm list -g --depth=1|grep blynk

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-166617434 . https://github.com/notifications/beacon/ABzUg27ynN8jCEej5hNW0anZO9lEvIHVks5pSUcngaJpZM4Gm_QF.gif

tzapu commented 8 years ago

weird, maybe it s different on a rpi

i get this

npm list -g --depth=1|grep blynk
├─┬ node-red-contrib-blynk@0.0.19
│ ├── blynk-library@0.0.25

did you install node-red globally '-g' or locally to a folder?

On 22 Dec 2015, at 15:46, Peter Scargill notifications@github.com wrote:

Erm.. nothing happened when I did that – just came back to the prompt ??

From: tzapu [mailto:notifications@github.com] Sent: 22 December 2015 13:27 To: tzapu/node-red-contrib-blynk node-red-contrib-blynk@noreply.github.com Cc: Peter Scargill pete@scargill.org Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

maybe it s also worth listing what packages you have installed, what versions for blynk something like npm list -g --depth=1|grep blynk

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-166617434 . https://github.com/notifications/beacon/ABzUg27ynN8jCEej5hNW0anZO9lEvIHVks5pSUcngaJpZM4Gm_QF.gif

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-166622011.

scargill commented 8 years ago

Locally.

I install my stuff generally by sitting in the .node-red directory and doing npm install xxxxx

I just tried that command with and without the –g and I get nothing… strange…-library

If I do

Npm view blynk-library version

I get 0.0.25 so at least that is up to date

And for npm view node-red-contrib-blynk version

I get 0.0.19

Pete.

From: tzapu [mailto:notifications@github.com] Sent: 22 December 2015 14:03 To: tzapu/node-red-contrib-blynk node-red-contrib-blynk@noreply.github.com Cc: Peter Scargill pete@scargill.org Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

weird, maybe it s different on a rpi

i get this

npm list -g --depth=1|grep blynk
├─┬ node-red-contrib-blynk@0.0.19 <mailto:node-red-contrib-blynk@0.0.19> 
│ ├── blynk-library@0.0.25 <mailto:blynk-library@0.0.25> 

did you install node-red globally '-g' or locally to a folder?

On 22 Dec 2015, at 15:46, Peter Scargill <notifications@github.com mailto:notifications@github.com > wrote:

Erm.. nothing happened when I did that – just came back to the prompt ??

From: tzapu [mailto:notifications@github.com] Sent: 22 December 2015 13:27 To: tzapu/node-red-contrib-blynk <node-red-contrib-blynk@noreply.github.com mailto:node-red-contrib-blynk@noreply.github.com > Cc: Peter Scargill <pete@scargill.org mailto:pete@scargill.org > Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

maybe it s also worth listing what packages you have installed, what versions for blynk something like npm list -g --depth=1|grep blynk

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-166617434 . https://github.com/notifications/beacon/ABzUg27ynN8jCEej5hNW0anZO9lEvIHVks5pSUcngaJpZM4Gm_QF.gif

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-166622011.

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-166624604 . https://github.com/notifications/beacon/ABzUgx6BOD-XDkS3fNG-PSXERRDzTRVsks5pSU-FgaJpZM4Gm_QF.gif

scargill commented 8 years ago

A thought – my friend David who has also seen the blynk node just stop working as happens for me – seems to think that one reason for that might be too fast MQTT inputs - can you think of a reason why that might be? Could it be the cause of the issue…

Here is David’s input..

Just a thought....

Have you got MQTT input nodes in Node Red that are flooding your Blynk nodes?

I just got Blynk disconnect problems using the bundled (i.e. older) version of Node Red on my Pi Zero. That's the first time I've had it on that version.

It only started after I had added a DHT22 sensor to my ESP board in the garage and also set up a new ESP board in the living room with a DHT22 sensor.

A bit of backtracking revealed that it was ok if I had the garage one running but as soon as I had this:

for the living room one, it caused the Blynk nodes to disconnect. If I removed those MQTT nodes, or even kept them but changed the topic to one that was not being published to, then it was ok.

The garage one (which was NOT causing disconnects) is doing the publishing of sensor data and also is subscribed to some incoming MQTT topics.

But the living room one (that was causing the crashes) was ONLY sensing the DHT22 data and publishing it. Nothing else. So it was sending several MQTT packets per second. So I stuck a

delay (1000);

in the void loop section and as far as I can tell so far that seems to have fixed it.

Could your problems be caused by something similar??

From: tzapu [mailto:notifications@github.com] Sent: 22 December 2015 12:45 To: tzapu/node-red-contrib-blynk node-red-contrib-blynk@noreply.github.com Cc: Peter Scargill pete@scargill.org Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

any node red logs as well? out of curiosity, when the icons were off, was the mobile app not updating as well?

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-166608705 . https://github.com/notifications/beacon/ABzUg9Dv7QLz-j9RPbrHv-HCCQX_y82dks5pST01gaJpZM4Gm_QF.gif

tzapu commented 8 years ago

there was one other user that mentioned mqtt issues bringing down blynk as well, but i could not replicate that either i believe david is using blynk.cc would would restrict the number of requests per second so in his case, a disconnect and/or delay would be sure to happen if he were to flood them.

but this also does not apply in case of your local server, where the requests should be set much higher. my prev version test is still going strong, had a server fail and it kept trying to connect, i was able to see in the log the reconnection attempts. In the end it wasn t successful because i had to mess with dns so it lost the plot... but it did try to reconnect for a few hours quite feverishly

autolycus2000 commented 8 years ago

Yes, that's right - I'm using blynk.cc.

What I have established so far is as follows:

  1. I had Node Red and Blynk running for several days with no problems. I had several flows running which were SENDING out MQTT broadcasts in response to button presses on Blynk.
  2. As soon as I added some MQTT that were INPUTTING into Node Red and then sending their payload to value displays on Blynk I started to get random disconnects. See attached JPG for an example of the kind of flow I am talking about.

flow

  1. I have multiple screens/projects in Blynk. Some of them are receiving these incoming MQTT messages and some are not. When the disconnects happen it is ONLY the projects that receive incoming MQTT messages which disconnect. The other projects all stay running fine.
  2. Once the disconnect happens, my Node Red log file fills with messages like this:

30 Dec 10:45:04 - [info] [blynk-server:7cffee53.83001] key: xxxxxxx disconnected Connecting to SSL: cloud.blynk.cc 8441 Connected Disconnect blynk

(where xxxxxx is the key of the project that the MQTT data is being sent to)

and then after several pages of that it crashes completely with:

30 Dec 10:46:24 - [red] Uncaught Exception: 30 Dec 10:46:24 - Error: write EPIPE at errnoException (net.js:904:11) at Object.afterWrite (net.js:720:19)

I have tried reducing the frequency with which the data is sent from the incoming MQTT message to the Blynk node. Even reducing it to every 15 seconds it still causes disconnects.

Does that help at all?

David.

scargill commented 8 years ago

As you know I don’t think I’m getting those messages but I’m still getting occational disconnects. I hope the info David is providing helps here… would be great to make this bulletproof…

Pete.

From: autolycus2000 [mailto:notifications@github.com] Sent: 30 December 2015 18:50 To: tzapu/node-red-contrib-blynk node-red-contrib-blynk@noreply.github.com Cc: Peter Scargill pete@scargill.org Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

Yes, that's right - I'm using blynk.cc.

What I have established so far is as follows:

  1. I had Node Red and Blynk running for several days with no problems. I had several flows running which were SENDING out MQTT broadcasts in response to button presses on Blynk.
  2. As soon as I added some MQTT that were INPUTTING into Node Red and then sending their payload to value displays on Blynk I started to get random disconnects. See attached JPG for an example of the kind of flow I am talking about.

    https://cloud.githubusercontent.com/assets/16492470/12055540/15b3d770-af26-11e5-9985-428c321c3328.JPG

  3. I have multiple screens/projects in Blynk. Some of them are receiving these incoming MQTT messages and some are not. When the disconnects happen it is ONLY the projects that receive incoming MQTT messages which disconnect. The other projects all stay running fine.
  4. Once the disconnect happens, my Node Red log file fills with messages like this:

30 Dec 10:45:04 - [info] [blynk-server:7cffee53.83001] key: xxxxxxx disconnected Connecting to SSL: cloud.blynk.cc 8441 Connected Disconnect blynk

(where xxxxxx is the key of the project that the MQTT data is being sent to)

and then after several pages of that it crashes completely with:

30 Dec 10:46:24 - [red] Uncaught Exception: 30 Dec 10:46:24 - Error: write EPIPE at errnoException (net.js:904:11) at Object.afterWrite (net.js:720:19)

I have tried reducing the frequency with which the data is sent from the incoming MQTT message to the Blynk node. Even reducing it to every 15 seconds it still causes disconnects.

Does that help at all?

David.

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-168054766 . https://github.com/notifications/beacon/ABzUgxU_8Yt0uFRqGJ4EGEsJvVuVYJQdks5pVB7wgaJpZM4Gm_QF.gif

autolycus2000 commented 8 years ago

Especially as the guys at Blynk plan to start charging us for it in the next couple of months.

scargill commented 8 years ago

Not until it works – and until they announce what they plan to do about new controls – the RGB control is still WAY too big to be of any use… I don’t know what they think we’re going to do with this but I have 4 RGB lights in one room!

:)

From: autolycus2000 [mailto:notifications@github.com] Sent: 30 December 2015 18:59 To: tzapu/node-red-contrib-blynk node-red-contrib-blynk@noreply.github.com Cc: Peter Scargill pete@scargill.org Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

Especially as the guys at Blynk plan to start charging us for it in the next couple of months.

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-168056085 . https://github.com/notifications/beacon/ABzUg0fo3CCt2xadSfvJdbGomJCmCTZlks5pVCDqgaJpZM4Gm_QF.gif

tzapu commented 8 years ago

guys, thanks for this. i will be back on monday in full working order and will try to build more test setups with mqtt as well to see if i can replicate it that way. it s so so annoying that i can t properly replicate this...my server is still going strong

autolycus2000 commented 8 years ago

Thank you!

I've just had another disconnect and here are the details in case it helps you replicate or fix the problem.

I have got 10 flows in Node Red. The three that are significant for this example are called: Garage, Living Room, and Sensors.

I have 5 tokens/projects running in Blynk. The ones that are significant for this example are called Garage, Living Room, and Sensors.

On the Garage Blynk project there are a switch and an LED that are used to turn a light on/off and display it's status. Also a digital readout for temperature and one for humidity. And two history graphs - one for temperature and one for humidity.

On the Living Room Blynk project there are various buttons and sliders for controlling lights, as well as two digital readouts - one for temperature and one for humidity.

And on the Sensors Blynk project there are 4 digital displays which display garage temperature, garage humidity, living room temperature, and living room humidity. Plus two history graphs - one for the two temperature sensors and one for the two humidity sensors.

In Node Red the Living Room flow talks to the Living Room project in Blynk - but ONLY to the buttons and LEDs It does not interact at all with the digital displays or graphs.

The Garage flow talks only to the Garage project and only to the buttons and LEDs.

The Node Red flow called Sensors takes readings from DHT22 sensors via MQTT nodes and sends these on to EmonCMS, Grovestreams, Dweet, and the Blynk nodes for the various digital displays and graphs referred to above. So that means the Sensors flow is talking to all three of the Blynk projects I referred to above.

The disconnect that just happened ONLY affected the Garage project in Blynk. So, my Living Room flow - screeshot below - is all still working fine with all Blynk nodes connected.

image

On my Garage flow the Blynk nodes (which are all either LEDs or buttons) have all disconnected:

image

And on my Sensors flow, the nodes that are part of the Garage project are disconnected but all the others are ok:

image

I am convinced that the problem is related to sending data from Node Red to the digital display widgets and/or the history graph widgets. I say this because: a) I didn't get disconnects before I started using these widgets b) the disconnects only ever affect projects that include these widgets. My other Blynk projects (e.g. the Living Room one mentioned above) do not use digital displays or graphs and do not suffer from disconnects.

Hope this helps. Feel free to ask any questions.

David

autolycus2000 commented 8 years ago

UPDATE: In the past week I have had 2 or 3 disconnects on flows/projects that do NOT use digital display or history graph widgets. So my theory in the post above has now been shown to be incorrect.

tzapu commented 8 years ago

guys, sorry about taking so long, i have activated authentication on my node red, and have lost access to it, no matter what i tried with bcrypt and hashes and all the documentation, it doesn t let me in. it pissed me off so much that i didn't even feel like looking at it for the past few days. anyway, will try some more, if not reinstall.

tzapu commented 8 years ago

with the latest updates from the Blynk team, i built a (very alpha) contrib node that uses websockets instead of the blynk tcp transport. caveats:

Now for the good stuff:

screenshot 2016-01-21 09 08 50

is anyone willing to give it a go? to install you need to do npm install https://github.com/tzapu/node-red-contrib-blynk-websockets in your node-red folder cheers

Toshibass commented 8 years ago

Hi Tzapu sounds very interesting, problem is I am using cloud not local server, I suppose I could try installing local server and then give it a go but it won't be for a couple of weeks as I am on vacation , I am currently still getting disconnect issues which is very irritating.

scargill commented 8 years ago

Keep going for me as I prefer local server.

On 21 January 2016 22:57:23 Toshibass notifications@github.com wrote:

Hi Tzapu sounds very interesting, problem is I am using cloud not local server, I suppose I could try installing local server and then give it a go but it won't be for a couple of weeks as I am on vacation , I am currently still getting disconnect issues which is very irritating.


Reply to this email directly or view it on GitHub: https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-173721801

tzapu commented 8 years ago

well, i have it going for 36+ hours now, 4 projects connected (1 with old contrib, 3 with webscokets contrib) passsing a lot of data when app is open, and still passing data every 30s on around 10vpins when the app is closed... so far so good

i will introduce mqtt to it as well, to see what happens

@Toshibass from what the blynk guys told me, websockets will get included in the cloud version as well, they just need to optimize it and check it some more to make sure it s stable and not bringing their servers to the knees

@scargill if you could give the node a try it would be very good, you could even just replace a few of your current blynk nodes with the new ones, on the same project, and see if some disconnect and others not

scargill commented 8 years ago

MQTT – you have my interest!!

From: tzapu [mailto:notifications@github.com] Sent: 22 January 2016 07:20 To: tzapu/node-red-contrib-blynk Cc: Peter Scargill Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

well, i have it going for 36+ hours now, 4 projects connected (1 with old contrib, 3 with webscokets contrib) passsing a lot of data when app is open, and still passing data every 30s on around 10vpins when the app is closed... so far so good

i will introduce mqtt to it as well, to see what happens

@Toshibass https://github.com/Toshibass from what the blynk guys told me, websockets will get included in the cloud version as well, they just need to optimize it and check it some more to make sure it s stable and not bringing their servers to the knees

@scargill https://github.com/scargill if you could give the node a try it would be very good, you could even just replace a few of your current blynk nodes with the new ones, on the same project, and see if some disconnect and others not

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-173831413 . https://github.com/notifications/beacon/ABzUgwMYxoMN3sF4teNGaHC0w1x6S88Hks5pcc-ygaJpZM4Gm_QF.gif

tzapu commented 8 years ago

@scargill sorry for that, i meant add some mqtt nodes to my test setup because @autolycus2000 i think mentioned mqtt nodes in his flows might have had something to do with disconnects

scargill commented 8 years ago

Oh ok. Well as soon as I get back in my office next weekend I’ll give this another attempt…. Thanks for putting in the effort on this – much appreciated.

Pete.

From: tzapu [mailto:notifications@github.com] Sent: 22 January 2016 08:53 To: tzapu/node-red-contrib-blynk Cc: Peter Scargill Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

@scargill https://github.com/scargill sorry for that, i meant add some mqtt nodes to my test setup because @autolycus2000 https://github.com/autolycus2000 i think mentioned mqtt nodes in his flows might have had something to do with disconnects

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-173850166 . https://github.com/notifications/beacon/ABzUg3TvsKvNr7uMklresaZn94mz-C0_ks5pceVigaJpZM4Gm_QF.gif

Toshibass commented 8 years ago

Sounds promising, it may be of interest, I have 2 projects 1st has 37 blynk nodes and 17 mqtt nodes, 2nd project has 30 blynk nodes and 32 mqtt nodes, originally I had both projects on 1 instance of node-red on a raspberry pi2 however because of the numerous disconnect issues I split the 2 projects onto 2 raspberry pi’s (I still use just 1 mqtt broker) the result was a noticeable improvement on the number of disconnect issues, although I still do get some disconnects were I need to at least re-deploy or worst case restart node-red.

One other point my blynk nodes are not passing data continuously, I have built the flow so when the blynk app opens it triggers a “blynk write even node” which is connected to mqtt which starts the sending of data to “blynk write nodes”, some send values to “value displays” most send data write the state of gpio’s to virtual buttons on the app, the same virtual buttons when pressed send data to “write event nodes” to toggle the value of the relevant gpio, when the app is closed then no data is passed between node-red the blynk.

In other words its pointless trying to send and receive data between rode-red and blynk if the app is not open.

Toshi

From: tzapu Sent: Friday, January 22, 2016 7:20 AM To: tzapu/node-red-contrib-blynk Cc: Toshibass Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

well, i have it going for 36+ hours now, 4 projects connected (1 with old contrib, 3 with webscokets contrib) passsing a lot of data when app is open, and still passing data every 30s on around 10vpins when the app is closed... so far so good

i will introduce mqtt to it as well, to see what happens

@Toshibass from what the blynk guys told me, websockets will get included in the cloud version as well, they just need to optimize it and check it some more to make sure it s stable and not bringing their servers to the knees

@scargill if you could give the node a try it would be very good, you could even just replace a few of your current blynk nodes with the new ones, on the same project, and see if some disconnect and others not

— Reply to this email directly or view it on GitHub.

tzapu commented 8 years ago

yup, i am sending data continuously more as load testing and to get nice full history graphs really i just want to see if connections hold

tzapu commented 8 years ago

well, good news and bad news bad news is that it seems the original version of the blynk contrib does fail faster when mqtt nodes are involved. Honestly, i don t know how that can happen as all nodes are sandboxed as far as i know. it also tries to reconnect, continuously but seems to drop the connection immediatelly.

Connecting to TCP: server:port
Connected
Disconnect blynk
25 Jan 00:12:30 - [info] [blynk-server:de574db2.efd6d] key: 3e937439596key25bde9 disconnected

it reconnected after a redeploy.

the good news, at least i hope so, are that the websockets version of this stayed connected and working even though the other one was down... i m having more and more of an incline to scrap the propriety protocol one and just continue work based on websockets...

this is how it looked, lighter green = websocket nodes

screenshot 2016-01-25 08 08 17
scargill commented 8 years ago

Tzapu - I'm so pleased you've been able to (a) replicate the issue and (b) find a way around it because frankly I could not devote more time to it when it was continually failing on me and I use a LOT of MQTT.. The problem you have is exactly what I had - I had to restart Node-Red - but I never had to restart the computer itself - OR the Blynk server.

I'll take a look at this when I'm back in the UK next week - I think you might be right about scrapping the original as others obviously had similar issues - I know David Miles did (I think he is on holiday I think which is why he is quiet).

When you have this ready to go with a little documentation so I don't have to harrass you - let me know and I'll give it a go.

Great stuff - and thanks for progressing this.

Pete.

scargill commented 8 years ago

So – is a working websockets version up and available???

From: tzapu [mailto:notifications@github.com] Sent: 25 January 2016 11:05 To: tzapu/node-red-contrib-blynk Cc: Peter Scargill Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

well, good news and bad news bad news is that it seems the original version of the blynk contrib does fail faster when mqtt nodes are involved. Honestly, i don t know how that can happen as all nodes are sandboxed as far as i know. it also tries to reconnect, continuously but seems to drop the connection immediatelly.

Connecting to TCP: server:port Connected Disconnect blynk 25 Jan 00:12:30 - [info] [blynk-server:de574db2.efd6d] key: 3e937439596key25bde9 disconnected

it reconnected after a redeploy.

the good news, at least i hope so, are that the websockets version of this stayed connected and working even though the other one was down... i m having more and more of an incline to scrap the propriety protocol one and just continue work based on websockets...

this is how it looked, lighter green = websocket nodes https://cloud.githubusercontent.com/assets/2983312/12547920/b4efa956-c35b-11e5-8790-050efc6bdeb3.png screenshot 2016-01-25 08 08 17

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-174458086 . https://github.com/notifications/beacon/ABzUg7rBJpevnmZm17pnYIGj3Zp6f5kNks5pdeq3gaJpZM4Gm_QF.gif

scargill commented 8 years ago

Ok.. .what am I doing wrong.

I put the latest server on my PI – and installed… and got the app talking to it – new account – logged in ok.

I put 2 nodes on the Pi Node-Red – the new WS types…

And I copied the KEY into the connection and

The APP says my project is not connected and Node-Red says..

node-red-contrib-blynk-websockets:websocket.errors.missing-conf

I have no config file yet, just the admin, client and server JS files – latest JAVA etc..

What am I missing?

From: tzapu [mailto:notifications@github.com] Sent: 22 January 2016 15:18 To: tzapu/node-red-contrib-blynk Cc: Peter Scargill Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

yup, i am sending data continuously more as load testing and to get nice full history graphs really i just want to see if connections hold

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-173932105 . https://github.com/notifications/beacon/ABzUg_E3ciL8k_vel1xz03w6m0UWX9Wzks5pcjGUgaJpZM4Gm_QF.gif

scargill commented 8 years ago

Someone put me out of my misery – I have the server working – the app working – cannot get the node to talk to the server.. what should I have in there…

From: tzapu [mailto:notifications@github.com] Sent: 22 January 2016 08:20 To: tzapu/node-red-contrib-blynk Cc: Peter Scargill Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

well, i have it going for 36+ hours now, 4 projects connected (1 with old contrib, 3 with webscokets contrib) passsing a lot of data when app is open, and still passing data every 30s on around 10vpins when the app is closed... so far so good

i will introduce mqtt to it as well, to see what happens

@Toshibass https://github.com/Toshibass from what the blynk guys told me, websockets will get included in the cloud version as well, they just need to optimize it and check it some more to make sure it s stable and not bringing their servers to the knees

@scargill https://github.com/scargill if you could give the node a try it would be very good, you could even just replace a few of your current blynk nodes with the new ones, on the same project, and see if some disconnect and others not

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-173831413 . https://github.com/notifications/beacon/ABzUgwMYxoMN3sF4teNGaHC0w1x6S88Hks5pcc-ygaJpZM4Gm_QF.gif

scargill commented 8 years ago

Right –mine is working – but wrong – in your DEFAULT you have blah…./ws but to get it to work Toshi showed me that it needs /websocket - might want to fix that.

Only had it running for an hour but had 2 brownouts which reset the router – and it has survived that – the wifi and mains are ATTROCIOUS here in my temporary home near Barcelona (project) but it has survived so far – let’s see how well this WS works…

TZAPU – are you giving it a good hard test with constant MQTT requests?

Pete.

From: tzapu [mailto:notifications@github.com] Sent: 21 January 2016 08:10 To: tzapu/node-red-contrib-blynk Cc: Peter Scargill Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

with the latest updates from the Blynk team, i built a (very alpha) contrib node that uses websockets instead of the blynk tcp transport. caveats:

Now for the good stuff:

is anyone willing to give it a go? to install you need to do npm install https://github.com/tzapu/node-red-contrib-blynk-websockets in your node-red folder cheers

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-173480344 . https://github.com/notifications/beacon/ABzUgzbynZGE4Pk4ZVbtgl6xiofKUknMks5pcHu8gaJpZM4Gm_QF.gif

scargill commented 8 years ago

Ok, question – got the new setup running…

If I make a slider and arrange 2 injects – 0 and 200 – I can send the slider going back and forth.. great.

But if I set the slider to 0 with the button… and STOP the app – and press the 200 button and THEN START the app – it does not seem to catch up – as I understood it the info is held in the server regardless of whether the APP is running or not.

So why isn’t the app catching up when you start it again???

Bug? Misunderstanding? Really that needs to work – you have no way to tell the APP has just started and needs refreshing so it needs to pick up the values from the server…

Pete.

From: tzapu [mailto:notifications@github.com] Sent: 22 January 2016 15:18 To: tzapu/node-red-contrib-blynk Cc: Peter Scargill Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

yup, i am sending data continuously more as load testing and to get nice full history graphs really i just want to see if connections hold

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-173932105 . https://github.com/notifications/beacon/ABzUg_E3ciL8k_vel1xz03w6m0UWX9Wzks5pcjGUgaJpZM4Gm_QF.gif

tzapu commented 8 years ago

hi, glad you got it working, i was fast asleep :)

sorry for the lack of documentation and everything, but i didn t want to put more time in it before knowing it s a valid path to go down on (which it seems it is, yeey) yes, every timer i have on my test pages, one half a second, and a few 30s ones, i m actually proxying through mqtt to the flow for testing, so every few blynk requests theres an mqtt request

regarding your slider thing, as far as i understand, the blynk guys added a sync ability recently, but looking at their documentation it seems to do the oposite of what you need:

State syncing
Blynk allows you easily restore hardware state from widget values in case your hardware was reset or disconnected. We call this feature state syncing. Here is simple code snippet :
BLYNK_CONNECTED() {
  if (isFirstConnect) {
    Blynk.syncAll();
  }
}
The syncAll command set all virtual pin values based on what is currently set on the app. In other words every virtual widget will generate BLYNK_WRITE event on hardware side.

while testing, i for one did not see any sync messages go to node -red

the guys seem flexible enough, and seem to be fulfilling any request that makes sense, so maybe we just need to ask them for a Blynk App Open event, on which everyone could just write the latest state to the interface.

if this thing is more reliable for you as well, i ll start going through all the motions, publish to npm, touch up, add docs, implement the rest of the widgets, and so on

cheers

scargill commented 8 years ago

I got up this morning and… all read – disconnected.. but then I noted that the server was down – I suspect a reboot and I’ve not yet set it in the startup.

I started the server and the nodes came back on… no problem.

So it would seem the only issue is…

You have a button – you turn it on and off via Node-Red - fine… Turn it ON. STOP the App… turn it OFF… Start the App. It’s state is not updated.

Is this the fault of the APP, the SERVER or the Node-Red Interface..

Perhaps you can talk to the Blynk people?

I’ll ask also.

Pete.

From: tzapu [mailto:notifications@github.com] Sent: 27 January 2016 05:53 To: tzapu/node-red-contrib-blynk Cc: Peter Scargill Subject: Re: [node-red-contrib-blynk] Doesn't recover from server down (#16)

hi, glad you got it working, i was fast asleep :)

sorry for the lack of documentation and everything, but i didn t want to put more time in it before knowing it s a valid path to go down on (which it seems it is, yeey) yes, every timer i have on my test pages, one half a second, and a few 30s ones, i m actually proxying through mqtt to the flow for testing, so every few blynk requests theres an mqtt request

regarding your slider thing, as far as i understand, the blynk guys added a sync ability recently, but looking at their documentation it seems to do the oposite of what you need:

State syncing Blynk allows you easily restore hardware state from widget values in case your hardware was reset or disconnected. We call this feature state syncing. Here is simple code snippet : BLYNK_CONNECTED() { if (isFirstConnect) { Blynk.syncAll(); } } The syncAll command set all virtual pin values based on what is currently set on the app. In other words every virtual widget will generate BLYNK_WRITE event on hardware side.

while testing, i for one did not see any sync messages go to node -red

the guys seem flexible enough, and seem to be fulfilling any request that makes sense, so maybe we just need to ask them for a Blynk App Open event, on which everyone could just write the latest state to the interface.

if this thing is more reliable for you as well, i ll start going through all the motions, publish to npm, touch up, add docs, implement the rest of the widgets, and so on

cheers

— Reply to this email directly or view it on GitHub https://github.com/tzapu/node-red-contrib-blynk/issues/16#issuecomment-175397533 . https://github.com/notifications/beacon/ABzUg-TMTKsNt9EwLcr_-Rn18vQ5__ocks5peETHgaJpZM4Gm_QF.gif

tzapu commented 8 years ago

that s good news then i ll talk to them as well, there s a slack channel now, so this should be easier

tzapu commented 8 years ago

@scargill spoke about your issue to the node red guys, and they said it should work. tested it myself like this https://www.dropbox.com/s/tjd69glbs2hse2o/Screenshot%202016-01-27%2012.15.19.png?dl=0

V30 is a small slider in my app

and i can report it does work, the slider changes even when app in background or completly killed

i tested on ios...

btw, this only works for virtual pins