--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send an email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/24de234e-ab39-4747-826c-fc46bdeff2da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
...
Power Management:off
...
You should be able to use the Status node targeted at one of your MQTT nodes - it will receive the status update messages from the node and you can respond how you wish.
On 25 January 2018 at 11:09, Toshi Bass <toshib...@gmail.com> wrote:
How can I check from within a flow if Mqtt becomes disconnected ? I guess I could check for no messages within a set time period but was wondering if there was a better way?
Reason .... I have a pi connected by Wi-fi only, very very occasionally the Wi-fi drops/disconnects and does not recover, I test this on another pi using advanced ping which notifies me via prowl of the problem, however it means the only cause of action is to turn off the power to the pi, not good as it could result in curupting the sd card.
I know node red is still running as I have a external watchdog led flashing once a second .. I also have an external button which does several things depending on the time of day, what I want to do is ..... check if Mqtt is disconnected if so I’ll program the button when activated to reboot the pi.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
#!/bin/bash
ping -c4 192.168.10.254 > /dev/null if [ $? != 0 ] then echo "No network connection, restarting wlan0" /sbin/ifdown 'wlan0' sleep 5 /sbin/ifup --force 'wlan0'fi
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/84fd9f63-77e5-49eb-8c4b-7511c123fb5a%40googlegroups.com.
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
wireless-power off
post-up iw wlan0 set power_save off
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
Toshi,
What are you expecting to get from the status node? It should send a message when the status (connected/disconnected) of the mqtt node changes. What the node is subscribed to is irrelevant - that doesn't affect the node status
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/9013d247-c99b-43b0-b4db-f90989618f1e%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/-Rzx1Q6O6YM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/CAF%3DvhqeiDp3-HJLY%3DxRbyRzHjTqPz9oqP4UeT7gUST1pt8BDDA%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/9013d247-c99b-43b0-b4db-f90989618f1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/-Rzx1Q6O6YM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/CAF%3DvhqeiDp3-HJLY%3DxRbyRzHjTqPz9oqP4UeT7gUST1pt8BDDA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/96046055-5E75-4C9E-95E8-05FE797FD180%40gmail.com.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/-Rzx1Q6O6YM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/4dfb7340-89c7-4328-9e24-f6be5ca23d33%40googlegroups.com.
Colin ... right, that makes it a little easier to test it thanks.Steve ... thanks for you response I already use ping from another pi to notify me that pi4 is offline, what I am after is detecting when the wi-fi has disconnected in the node-red that’s running on pi4 so that I can utilise my one and only external push button that normally does other things to become a reboot button, instead of the current situation were if and I stress if because it’s a very rare occurrence, if pi4 looses Wi-fi my only cause of action is to disconnect the power to pi4.
I know I should and will try to fix the route cause of the problem, so having a safe way to reboot pi4 when this issue arises will help that process.Sent from my iPhone
I know I am a newbie here, but, what about the Ping node?--If I read the question correctly, Toshi is only asking if the MQTT broker connection is good.Ping the broker, if the payload is false, then the MQTT connection is down.Steve Mann
On Thursday, January 25, 2018 at 6:09:40 AM UTC-5, Toshi Bass wrote:How can I check from within a flow if Mqtt becomes disconnected ? I guess I could check for no messages within a set time period but was wondering if there was a better way?
Reason .... I have a pi connected by Wi-fi only, very very occasionally the Wi-fi drops/disconnects and does not recover, I test this on another pi using advanced ping which notifies me via prowl of the problem, however it means the only cause of action is to turn off the power to the pi, not good as it could result in curupting the sd card.
I know node red is still running as I have a external watchdog led flashing once a second .. I also have an external button which does several things depending on the time of day, what I want to do is ..... check if Mqtt is disconnected if so I’ll program the button when activated to reboot the pi.
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/-Rzx1Q6O6YM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/4dfb7340-89c7-4328-9e24-f6be5ca23d33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/ED40479D-6B2E-41A3-B6E8-0AC1084F24D3%40gmail.com.
The only unfortunate side effect of the watchdog flow is that if the main router is off then the pi reboots every 10 mins, but in my case that is not an issue. If you want it to only reboot once if the router is switched off then leave out the inject node.
var msg1 = {};var ip = msg.topic;var count = flow.get('count') || {};if (typeof count[ip] === "undefined") {count[ip] = 0;}if (msg.payload === false) {count[ip] = count[ip] + 1;if (count[ip] > 3) {msg1 = null;} else if (count[ip] > 2) {msg1.payload = ip + " ping failed, count " + count[ip];msg1.topic = "ping failed";} else {msg1 = null;}} else {if (count[ip] > 2) {msg1.payload = ip + " ping ok";msg1.topic = "ping ok";count[ip] = 0;} else {msg1 = null;}}flow.set('count', count);return msg1;
The only unfortunate side effect of the watchdog flow is that if the main router is off then the pi reboots every 10 mins, but in my case that is not an issue. If you want it to only reboot once if the router is switched off then leave out the inject node.To avoid ping repeating actions I use a function that count "ping false".1. sometime the ping node returns false because the pi or the net is busy2. after 3 "ping false" the function sends the output once.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/9cb9d869-fd6e-4853-9585-817552749a51%40googlegroups.com.
On 26 January 2018 at 10:31, cflurin <fluri...@gmail.com> wrote:
On Friday, January 26, 2018 at 11:26:53 AM UTC+1, Colin Law wrote:On 26 January 2018 at 09:53, cflurin <fluri...@gmail.com> wrote:The only unfortunate side effect of the watchdog flow is that if the main router is off then the pi reboots every 10 mins, but in my case that is not an issue. If you want it to only reboot once if the router is switched off then leave out the inject node.To avoid ping repeating actions I use a function that count "ping false".1. sometime the ping node returns false because the pi or the net is busy2. after 3 "ping false" the function sends the output once.In my flow, using the ping and trigger nodes, if you set the ping rate to, for example, every two minutes, and the trigger timeout to 8 minutes then it would need 3 or 4 pings in a row to cause the reboot. You can adjust the rate and timeout to get the effect you want.ColinRight, but the function's msg is null (no output) until ping is true again.If you make it trigger a reboot then won't it re-trigger after it has booted if the ping continues to fail? I think it's operation is exactly the same as mine.Colin
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/c8f64cf3-6511-4497-bbf4-4c803919faf8%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
flow or global? well all my ping nodes are in the same flow and the count as an index = ip-address, so it works for me.
Colin
Correct, I'm using six ping nodes with the same function.Probably it would also work with a context object too. So just change flow by context.
Well I got both methods working like : checking MQTT via status node and checking router (used is online node instead of ping node) i am going to leave them both running and make a decision later which to ultimately use thanks for all your help and advice.
On Friday, January 26, 2018 at 12:40:38 PM UTC, cflurin wrote:Now I remember the reason I use flow instead of context. I use "flow.count" in an another node.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/e914df5f-7f34-4ea6-a2b4-50fd24d52869%40googlegroups.com.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/CACXWFwLsf0FR9Ow%2BhVD_R8AZzrRL2z5ZAwJwX9WYMoi4wCAMow%40mail.gmail.com.
... for whatever reason I very very occasional one of my pi's that only connects via wifi drops it connection ...
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/996ed932-3cca-441d-b1da-b24442b1fddc%40googlegroups.com.
--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/a9bcd023-33b6-431e-ab3b-41a548175df5%40googlegroups.com.