# WiFi events and strange going on's

**URL:** <https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673>\
**Category:** General\
**Created:** [27 June 2019 21:14 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673 "2019-06-27T21:14:38Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [28 June 2019 09:27 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673/21 "2019-06-28T09:27:23Z")

</div>

> [@Trying\_to\_learn](#):
>
> The MQTT broker monitors the SOM and EOM channels and that is from where I got those messages.

That statement makes little sense to me. What is a 'channel'? What do you mean by the broker monitoring the channels?

I was wrong about the shutting down message as that is actually sent by the pi at a normal disconnection, such as a power down, I assumed you were talking about the actual LWT message, which is the Comms Failure one.

I see you have not got the Retain flag set on the LWT topics, so what I said about a client connecting later is also wrong. You can only rely on clients will only get those messages if they are actually connected when the event occurs, though I think the broker will buffer up some messages so you may get them if the event occurs during a temporary disconnection (of the client).

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [28 June 2019 09:55 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673/22 "2019-06-28T09:55:19Z")

</div>

Urm, why do you want 2 WAPs? That seems overly complex and error prone. As you already point out, there is a decent chance they are already fighting each other for channels, especially if you live in a crowded environment as we do (surrounded by a mixture of professionals and students).

Just use your router which should (if it is a decent one) be much better able to manage the connections. Better still, ditch the usually relatively rubbish WiFi (but still likely better than using a Pi) on consumer routers for a dedicated AP such as the Ubiquiti Unifi AP's.

If you need to isolate IoT traffic, you should be able to use VLANs to do that.

---

<div class="post-metadata">

**Author:** ![moebius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/moebius/32/2872_2.png) [@moebius](https://discourse.nodered.org/u/moebius)\
**Post date:** [28 June 2019 09:58 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673/23 "2019-06-28T09:58:21Z")

</div>

Do you already have a name for your system? If not, i would call it:

Keep owner busy machine (Enterprise Edition v7)

🙂

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [28 June 2019 10:05 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673/24 "2019-06-28T10:05:20Z")

</div>

> [@Colin](#):
>
> What is a 'channel'?

The "channel" or TOPIC? Ok. Topic (from MQTT node)

TotallyInformation:  
Why? Well there is the modem's WAP. That gives internet access to anything that connects.  
I have a "local WAP" which is only connected to my network.  
It will only have stuff like the Arduino connected, and other LOW TRAFFIC stuff.  
These devices will not be visible on the bigger internet. Not being paranoid. But I wanted to learn about using the RPI as a WAP.  
(Yeah, I'm trying too much probably.)

Yeah, VLANs are on the Radar for use. Just not there yet and weren't possible a long time ago.  
So a separate WAP seemed the easy way to go.

Moebius.. Yup. I get it.  
The RPI WAP Is called .... PiNet.  
My main WAP is...... Oh, gee. I don't really know. All the devices which need to access it know the name, so I just connect when needed.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [5 July 2019 07:06 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673/25 "2019-07-05T07:06:16Z")

</div>

Here is another example of weird MQTT messages.

Though this isn't leading to the RPZ(w) being hung, the messages confused me to why they were sent.

This morning I turned on THIS machine. (NUC) Logged on to the RPZ NR page.  
It is still running.

I turned THIS machine off about 7 minutes later.  
Then around 12:20 for a while, then off soon there after.  
And lastly at 16:.....

Look at the birth/death certificates. (SOM/EOM)

Yet neither of the two machines were turned off at those times.  
It is still up and working.

Anyone one know why these messages would be sent?

![Screenshot%20from%202019-07-05%2017-00-37](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/00b09bbc04c22292dc2173e7aaa5e3bf282100e5.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [5 July 2019 07:21 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673/26 "2019-07-05T07:21:23Z")

</div>

> [@Trying\_to\_learn](#):
>
> Anyone one know why these messages would be sent?

The Will message is sent when an mqtt client drops it's connection. The Birth message is sent when the mqtt node reconnects. That is it. There are no other events that would trigger those messages.

Therefore these events represent times when the client lost its connection and reconnected.

We cannot say any more then that. Something has caused the connection to drop. If you are sure the devices didn't reboot, then something else has interrupted their network connection.

You could check the Node-RED log and the broker logs you will see what they report around these times.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [5 July 2019 07:32 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673/27 "2019-07-05T07:32:24Z")

</div>

Thanks.

Just very interesting that these co-inside with me turning THIS machine on/off.

It has been suggested that the RPI says "There's no more happening, so I will close the MQTT connection".

Yeah, but every ..... 18 seconds there are broadcasts from the broker and that machine is subscribed to some of those channels.

I am looking at a log file I have logs from a device which are time stamped and I have them every minute from 06:00 today until now.

Longer but for the sake of what I just said.

So....... Interesting.  
Why is it doing what it is doing?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [5 July 2019 07:40 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673/28 "2019-07-05T07:40:25Z")

</div>

> [@knolleary](#):
>
> You could check the Node-RED log and the broker logs you will see what they report around these times

I have looked at the node-red log/s and to the best of my knowledge there is nothing obvious there.

Where is the broker logs?

Googling `node-red broker log` I see stuff about logging data. Not too much about looking at the broker's log.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [5 July 2019 07:43 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673/29 "2019-07-05T07:43:05Z")

</div>

> broker

mqtt broker log.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [5 July 2019 08:05 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673/30 "2019-07-05T08:05:44Z")

</div>

(I know.....)

bakman2...

```auto
pi@TelePi:~ $ mqtt broker log
-bash: mqtt: command not found
pi@TelePi:~ $ 

```

I've tried from a few places, but I don't know _where_ I need to be.

I've looked and there are reverences to `/etc/init.d/mosquitto` Nothing there.

I'm lost.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [5 July 2019 08:07 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673/31 "2019-07-05T08:07:18Z")

</div>

@bakman2 please try to use full sentences when replying... Makes it much less likely to cause further confusion as you have just done.

@Trying_to_learn what broker are you using? Mosquitto? How did you install it? Have you googled for mosquitto logging or something similar? I don't know off the top of my head where mosquitto writes it's log file.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [5 July 2019 08:13 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673/32 "2019-07-05T08:13:00Z")

</div>

Nick,

Yes, I have tried, but the search results are about how to log data.

Other searches are talking about `/etc/init.d/mosquitto`  
[One](https://blog.rapid7.com/2016/10/07/logging-mosquitto-server-logs-from-raspberry-pi-to-logentries/)

[Two](http://www.steves-internet-guide.com/mosquitto-logging/)

[Three](https://www.raspberrypi.org/forums/viewtopic.php?t=97422)

But none explain where the log file is - that I can find.

To the best of my knowledge it is the "standard" MQTT that comes with NR.  
At worst, it would be one which was mentioned in link 3 - I think. I don't really remember as _originally_ it was on `stretch` and I updated the machine to `jessie` and reinstalled NR.  
So a lot has happened since then.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [5 July 2019 08:22 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673/33 "2019-07-05T08:22:28Z")

</div>

> [@Trying\_to\_learn](#):
>
> To the best of my knowledge it is the "standard" MQTT that comes with NR.

There is no such thing. Node-RED does not include an mqtt broker, you must have installed something.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [5 July 2019 08:27 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673/34 "2019-07-05T08:27:08Z")

</div>

Ok, I did. It works, and I did all the tests as per the third link.

This for instance:

```auto
Terminal window 1:

Code: Select all

mosquitto_sub -d -t hello/world

Terminal window 2:

Code: Select all

mosquitto_pub -d -t hello/world -m "Greetings from Terminal window 2!"

```

Works.

(Ok, it did work. I just tried them now and they don't work. But MQTT in NR is working.)

But when I do the `mqtt broker log` (be that a command) it doesn't work.

If it is a file..... where is it?

All the stuff I searched pointed to non-existent files.  
eg: `/etc/init.d/mosquitto`

So I'm still in the dark, sorry.

Don't fret too much. I don't want/expect you to drop everything and answer the question here/now.

I'm just asking because I'm stuck with what is going on. I hope though that at the end I learn something and it is helpful to others.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [5 July 2019 08:42 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673/35 "2019-07-05T08:42:41Z")

</div>

I do not want to cause confusion, the 2nd link you found has a FAQ about the log:

`more /var/log/mosquitto/mosquitto.log`

(many logs can be found in `/var/log`).

The detail of logging can be configured in `/etc/mosquitto/mosquitto.conf` or `/etc/mosquitto/conf.d/<filename>.conf` by using the `log_type` option as [described in the documentation](https://mosquitto.org/man/mosquitto-conf-5.html)

`mosquitto.conf` also specifies the log location (in case it is not in `/var/log/mosquitto`)  
So if you do a `cat /etc/mosquitto/mosquitto.conf` you see something like:

```auto
# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example

pid_file /var/run/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log

include_dir /etc/mosquitto/conf.d

```

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [5 July 2019 08:47 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673/36 "2019-07-05T08:47:47Z")

</div>

> [@bakman2](#):
>
> more /var/log/mosquitto/mosquitto.log

```auto
pi@TelePi:~ $ pwd
/home/pi
pi@TelePi:~ $ more /var/log/mosquitto/mosquitto.log
more: stat of /var/log/mosquitto/mosquitto.log failed: No such file or directory
pi@TelePi:~ $ 

```

Sorry. Not here.

```auto
pi@TelePi:~ $ cat /var/log/mosquitto/mosquitto.log
cat: /var/log/mosquitto/mosquitto.log: No such file or directory
pi@TelePi:~ $ cd /var/log
pi@TelePi:/var/log $ lf
apt/ auth.log btmp.1 debug.2.gz kern.log messages.2.gz syslog.2.gz user.log.2.gz
cups/ auth.log.1 daemon.log debug.3.gz kern.log.1 messages.3.gz syslog.3.gz user.log.3.gz
lightdm/ auth.log.2.gz daemon.log.1 debug.4.gz kern.log.2.gz messages.4.gz syslog.4.gz user.log.4.gz
samba/ auth.log.3.gz daemon.log.2.gz dpkg.log kern.log.3.gz nodered-install.log syslog.5.gz wtmp
wicd/ auth.log.4.gz daemon.log.3.gz dpkg.log.1 kern.log.4.gz nodered-install.log.1 syslog.6.gz wtmp.1
alternatives.log boot.log daemon.log.4.gz dpkg.log.2.gz lastlog nodered-install.log.2.gz syslog.7.gz Xorg.0.log
alternatives.log.1 bootstrap.log debug faillog messages syslog user.log Xorg.0.log.old
alternatives.log.2.gz btmp debug.1 fontconfig.log messages.1 syslog.1 user.log.1
pi@TelePi:/var/log $ 

```

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [5 July 2019 08:49 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673/37 "2019-07-05T08:49:25Z")

</div>

Here’s you old post where you were editing it

> [@MQTT doesn't seem to be happy of late](https://discourse.nodered.org/t/mqtt-doesnt-seem-to-be-happy-of-late/6410/18):
>
> Silly me. I said before I edited the mosquitto.log file. Seems I didn't. sudo nano mosquitto.log Though it mentioned the file had been written to while I was editing it: "Do you want to write to file" and I said YES..... It wasn't done. So I tried: pi@TimePi:/var/log/mosquitto $ sudo echo "\*\*\*\*\*\*\*\*\*\* 2019 01 06 09:33" \>\> mosquitto.log -bash: mosquitto.log: Permission denied Not a big deal, but why doesn't that work? Just so I have a "from here" point in the file.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [5 July 2019 08:54 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673/38 "2019-07-05T08:54:43Z")

</div>

Interesting indeed, could you check `/etc/mosquitto/mosquitto.conf`

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [5 July 2019 08:58 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673/39 "2019-07-05T08:58:30Z")

</div>

Ah, but that is on a different machine.

That is `TimePi`. I am now asking why `TelePi` is sending these weird messages.

I shall go and look at `TimePi` if the file exists there - to be sure.

This is what I see:

```auto
pi@TimePi:/var/log $ ld
apache2/ apt/ lightdm/ mosquitto/ ntpstats/ samba/
pi@TimePi:/var/log $

```

Note: `TimePi`

Now TelePi:

```auto
pi@TelePi:/var/log $ ld
apt/ cups/ lightdm/ samba/ wicd/
pi@TelePi:/var/log $ 

```

There is mention of a `mosquitto.config` but I can't find it either.

MQTT is working on that machine.  
0.93 is `TelePi`

Not only is it receiving data every .... 10 seconds. Every 18 seconds it transmits CPU temperature and CPU load back to 0.99 (`TimePi`)

 ![Screenshot%20from%202019-07-05%2018-50-22](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/38617f55a5fb27de0dfba387af62c76e05afd3e9.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [5 July 2019 09:05 UTC](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673/40 "2019-07-05T09:05:33Z")

</div>

> [@Trying\_to\_learn](#):
>
> Ah, but that is on a different machine.

I'm now getting confused.

Which machine is running mosquitto? Or are you running it on every one of your devices?

[Previous page](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673.md?page=1)

[Next page](https://discourse.nodered.org/t/wifi-events-and-strange-going-ons/12673.md?page=3)
