Eric - Im using weewx on a rPi zero with old Rasbian (I cant be bothered to reinstall/upgrade the OS) - and I installed the weewx mqtt report yesterday (after seeing this thread that there is a way for weewx to publish mqtt). I managed to get it to work - but my system is using python 2.7 - even though my pi has 2 and 3 installed. I had to install the python2 paho-mqtt via pip. A couple of suggestions for you though : - double check the Ubuntu hasnt upgraded from python2 to 3 as the default - and theres no harm in installing paho-mqtt for both IMO. - I vaguely remember (not certain though) that recent MQTT mosquito brokers no longer allow anonymous clients (Im using MQTT on Home Assistant) - Use MQTT Explorer to double check if the mqtt messages are getting to the broker.
hopefully a few things to try.... On Friday, 31 December 2021 at 04:40:09 UTC Eric K wrote: > I forgot to post this: > weewx@Ubuntu20-WEEWX:~$ python3 -c "import > paho.mqtt.client;print(paho.mqtt.client.__file__)" > /usr/lib/python3/dist-packages/paho/mqtt/client.py > > On Thursday, December 30, 2021 at 10:38:58 PM UTC-6 Eric K wrote: > >> Simply reinstalling python3-paho-mqtt has not fixed the system. >> >> I tried the mosquitto_sub command and mosquitto refused the connection. >> weewx@Ubuntu20-WEEWX:~$ mosquitto_sub -h 192.168.7.22 -p 1883 -t >> tele/BMP280/SENSOR -d >> Error: Connection refused >> >> I've got mosquitto.conf set to accpet anymous logins: >> protocol mqtt >> port 1883 >> allow_anonymous true >> >> and I've got weewx.conf set for: >> [MQTTSubscribeService] >> enable = true >> host = localhost >> port = 1883 >> keepalive = 60 >> username = None >> password = None >> >> I tried to manually force mosquitto to start - NO-GO. >> I followed the instructions to get some debug info. >> >> weewx@Ubuntu20-WEEWX:~$ sudo systemctl start mosquitto >> Job for mosquitto.service failed because the control process exited with >> error code. >> See "systemctl status mosquitto.service" and "journalctl -xe" for details. >> >> weewx@Ubuntu20-WEEWX:~$ systemctl status mosquitto.service >> ● mosquitto.service - Mosquitto MQTT Broker >> Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; >> vendor preset: enabled) >> Active: failed (Result: exit-code) since Thu 2021-12-30 22:23:26 >> CST; 3min 56s ago >> Docs: man:mosquitto.conf(5) >> man:mosquitto(8) >> Process: 2797 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto >> (code=exited, status=0/SUCCESS) >> Process: 2798 ExecStartPre=/bin/chown mosquitto: /var/log/mosquitto >> (code=exited, status=0/SUCCESS) >> Process: 2799 ExecStartPre=/bin/mkdir -m 740 -p /var/run/mosquitto >> (code=exited, status=0/SUCCESS) >> Process: 2800 ExecStartPre=/bin/chown mosquitto: /var/run/mosquitto >> (code=exited, status=0/SUCCESS) >> Process: 2801 ExecStart=/usr/sbin/mosquitto -c >> /etc/mosquitto/mosquitto.conf (code=exited, status=1/FAILURE) >> Main PID: 2801 (code=exited, status=1/FAILURE) >> >> I'm not sure how many of weewx's dependencies have to be reinstalled? >> >> On Wednesday, December 29, 2021 at 10:36:37 AM UTC-6 vince wrote: >> >>> On Tuesday, December 28, 2021 at 7:45:22 PM UTC-8 Eric K wrote: >>> >>>> After re-installing python3-paho-mqtt into Ubuntu 21.04 with "sudo >>>> apt-get install python3-paho-mqtt" >>>> /usr/local/lib/python3.9/dist-packages/ is empty >>>> I'm not sure where the reinstalled python3-paho-mqtt files got >>>> installed? >>>> Back in /usr/local/lib/python3.8/dist-packages/ ? >>>> >>> >>> Does it really matter as long as it works ? >>> >>> As I mentioned earlier, if you use pip it goes under /usr/local/lib, but >>> if you use apt then it goes under /usr/lib. >>> >>> But it doesn't really matter. Just go with it. It works. >>> >>> -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/1bce9555-7304-4f0b-8ab1-4c1aa4547178n%40googlegroups.com.
