emonhub.txt (822.9 KB)
Sorry - having one of those days.
Ok so emonhub is publishing regularly
Can you SSH in and try
mosquitto_sub -v -u 'emonpi' -P 'emonpimqtt2016' -t emon/#
That updates regularly.
Can you change the log level please
nano /var/www/emoncms/settings.php
and change $log_level
to 1 (INFO).
I’m not sure this will help as my system does not seem to be logging correctly (may be related to path changes see Is Emoncms logging broken).
Set the autorefresh to on (in the admin page) and see what the log produces.
[edit]
You need to restart the MQTT service for it to pick up the change in log level
sudo systemctl restart emoncms_mqtt.service
Sadly still the same
eeek now I can no longer run
mosquitto_sub -v -u ‘emonpi’ -P ‘emonpimqtt2016’ -t emon/#
pi@emonpi:~ $ mosquitto_sub -v -u ‘emonpi’ -P ‘emonpimqtt2016’ -t emon/#
Connection Refused: not authorised.
Connection Refused: not authorised.
Connection Refused: not authorised.
Connection Refused: not authorised.
Connection Refused: not authorised.
Think I’ll have to admit defeat.
As much as I love the emon - it just doesn’t appear stable enough. There are good guys like you who try to help, but I don’t ever seem able to fix the issues without either wiping it and starting from scratch, or buying a new card and even that failed this time
Well it is sitting here for me quite happliy and has done for several years.
Happy to keep going - the number of issue vice the number of installs is fairly low.
Really odd, can you post the output of sudo cat /etc/mosquitto/passwd
?
Looking at the logs may help
journalctl -u mosquitto -f
[edit]
You can recreate the password file with
sudo mosquitto_passwd -c /etc/mosquitto/passwd emonpi
Then use the default password emonpimqtt2016
Restart the service with
sudo systemctl restart emoncms_mqtt.service
Ref - Can only connect with MQTT default credentials - #5 by Bigalboyo
Thanks for helping and preserving with me.
pi@emonpi:~ $ sudo cat /etc/mosquitto/passwd
emonpi:$6$Y8qYIIDeOIzFQ846$/+EWh/w+DC8nD8FRlZjJ/XNyxrJCmPwxNGV8WKHTgZKoe7GFC+9V2 d3sb9RxANtNJhcrk4WASissMCG6J5ke+g==
pi@emonpi:~ $ journalctl -u mosquitto -f
-- Logs begin at Thu 2016-11-03 17:16:43 UTC. --
Jul 18 19:41:58 emonpi systemd[1]: Starting LSB: mosquitto MQTT v3.1 message broker...
Jul 18 19:41:59 emonpi mosquitto[332]: Starting network daemon:: mosquitto.
Jul 18 19:41:59 emonpi systemd[1]: Started LSB: mosquitto MQTT v3.1 message broker.
Jul 18 19:42:15 emonpi systemd[1]: Stopping LSB: mosquitto MQTT v3.1 message broker...
Jul 18 19:42:15 emonpi mosquitto[952]: Stopping network daemon:: mosquittostart-stop-daemon: warning: failed to kill 406: No such process
Jul 18 19:42:15 emonpi mosquitto[952]: .
Jul 18 19:42:15 emonpi systemd[1]: Stopped LSB: mosquitto MQTT v3.1 message broker.
Jul 18 19:42:15 emonpi systemd[1]: Starting LSB: mosquitto MQTT v3.1 message broker...
Jul 18 19:42:15 emonpi mosquitto[961]: Starting network daemon:: mosquitto.
Jul 18 19:42:15 emonpi systemd[1]: Started LSB: mosquitto MQTT v3.1 message broker.
^C
pi@emonpi:~ $
pi@emonpi:~ $ sudo mosquitto_passwd -c /etc/mosquitto/passwd emonpi
Password:
Reenter password:
pi@emonpi:~ $ sudo systemctl restart emoncms_mqtt.service
pi@emonpi:~ $ mosquitto_sub -v -u ‘emonpi’ -P ‘emonpimqtt2016’ -t emon/#
Connection Refused: not authorised.
Connection Refused: not authorised.
Connection Refused: not authorised.
Connection Refused: not authorised.
Connection Refused: not authorised.
Still gets refused. The only thing I done was changed the log level to 1, restart service, got this error, so I changed it back to 2 where it originally was and again restarted the service.
Odd indeed.
It is as annoying for me as for you
How old is the SD Card or did you say this was a new one from the shop? Odd errors like this are sometimes a sign the SD card is failing.
If it does not work using the mosquitto_sub
command emoncms has no chance!
The journal message is slightly off - can you
systemctl status mosquitto.service
and
sudo systemctl restart mosquitto
systemctl status mosquitto.service
and post the 2 outputs please.
pi@emonpi:~ $ systemctl status mosquitto.service
● mosquitto.service - LSB: mosquitto MQTT v3.1 message broker
Loaded: loaded (/etc/init.d/mosquitto; generated; vendor preset: enabled)
Active: active (running) since Thu 2019-07-18 19:42:15 UTC; 12h ago
Docs: man:systemd-sysv-generator(8)
Process: 952 ExecStop=/etc/init.d/mosquitto stop (code=exited, status=0/SUCCESS)
Process: 961 ExecStart=/etc/init.d/mosquitto start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/mosquitto.service
└─968 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
Jul 18 19:42:15 emonpi systemd[1]: Starting LSB: mosquitto MQTT v3.1 message broker…
Jul 18 19:42:15 emonpi mosquitto[961]: Starting network daemon:: mosquitto.
Jul 18 19:42:15 emonpi systemd[1]: Started LSB: mosquitto MQTT v3.1 message broker.
pi@emonpi:~ $
==================================
pi@emonpi:~ $ sudo systemctl restart mosquitto
pi@emonpi:~ $ systemctl status mosquitto.service
● mosquitto.service - LSB: mosquitto MQTT v3.1 message broker
Loaded: loaded (/etc/init.d/mosquitto; generated; vendor preset: enabled)
Active: active (running) since Fri 2019-07-19 07:50:04 UTC; 7s ago
Docs: man:systemd-sysv-generator(8)
Process: 6949 ExecStop=/etc/init.d/mosquitto stop (code=exited, status=0/SUCCESS)
Process: 6958 ExecStart=/etc/init.d/mosquitto start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/mosquitto.service
└─6964 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
Jul 19 07:50:04 emonpi systemd[1]: Starting LSB: mosquitto MQTT v3.1 message broker…
Jul 19 07:50:04 emonpi mosquitto[6958]: Starting network daemon:: mosquitto.
Jul 19 07:50:04 emonpi systemd[1]: Started LSB: mosquitto MQTT v3.1 message broker.
pi@emonpi:~ $
======================
Its a brand new card from the shop, so hopefully not the card failing as that would be slightly frustrating
I am really surprised it is not working Out of the Box then.
So I tried it and ended up with same connection refused!!
Try this:
sudo systemctl stop mosquitto.service
sudo mosquitto_passwd -c /etc/mosquitto/passwd emonpi
sudo systemctl restart mosquitto.service
sudo mosquitto_sub -v -u emonpi -P emonpimqtt2016 -t emon/#
use password emonpimqtt2016
when asked (no quotes).
YAY… ok that bit works again - thanks
Still have the original issue though
#facepalm
Grrrr
So set the log level to 1 and reboot.
Output from mosquitto_sub
command - does it show regularly?
in the log window in EmonCMS do you see
2019-07-19 09:08:57.013|INFO|emoncms_mqtt.php|emon/emonpi/power2 0
2019-07-19 09:08:57.019|INFO|emoncms_mqtt.php|emon/emonpi/power1pluspower2 86
2019-07-19 09:08:57.026|INFO|emoncms_mqtt.php|emon/emonpi/vrms 234.98
2019-07-19 09:08:57.031|INFO|emoncms_mqtt.php|emon/emonpi/t1 0
2019-07-19 09:08:57.037|INFO|emoncms_mqtt.php|emon/emonpi/t2 0
2019-07-19 09:08:57.042|INFO|emoncms_mqtt.php|emon/emonpi/t3 0
2019-07-19 09:08:57.057|INFO|emoncms_mqtt.php|emon/emonpi/t4 0
2019-07-19 09:08:57.063|INFO|emoncms_mqtt.php|emon/emonpi/t5 0
2019-07-19 09:08:57.070|INFO|emoncms_mqtt.php|emon/emonpi/t6 0
2019-07-19 09:08:57.075|INFO|emoncms_mqtt.php|emon/emonpi/pulsecount 0
pi@emonpi:~ $ nano /var/www/emoncms/settings.php
pi@emonpi:~ $ sudo systemctl restart emoncms_mqtt.service
pi@emonpi:~ $ sudo reboot
emonhub.txt (31.7 KB)
That looks to update regularly - alas still the same in the inputs and feeds
Can you post the emoncms log from the admin page please.
The log shows the data is received and that the feeds are being updated.
Can you open the emoncms page in a private window please and check input and feeds again please.
Do your services status look like this?
No bother - love the challenge.