Now that the broker is running, does mosquitto_sub work? Also, as Vince suggested, adding the -v option (verbose) to the mosquitto command would be useful. rich On Saturday, 1 January 2022 at 11:40:16 UTC-5 Eric K wrote:
> When using, the MQTTSubscirbe driver in weewx, it runs as a weewx service > in the same machine as weewx. > see: https://github.com/bellrichm/WeeWX-MQTTSubscribe > I'm running the mosquitto broker in the same Ubuntu VM as weewx, because > its convenient, and it works fine in my Ubuntu 20.10 VM. > > I have a barometric pressure sensor (a stand-alone wifi device on a > different IP from the Ubuntu VM) that sends data to weewx via MQTT and the > MQTTSubscribe driver. > So, I need to get that to properly connect with mosquitto in Ubuntu 21.04, > like it does in the Ubuntu 20.10. > > The connection we saw when I tried running mosquitto with it's internal > default settings was MQTTSubscribe trying to connect to it. > > weewx@Ubuntu20-WEEWX:~$ mosquitto > 1640984406: mosquitto version 2.0.10 starting > 1640984406: Using default config. > 1640984406: Starting in local only mode. Connections will only be possible > from clients running on this machine. > 1640984406: Create a configuration file which defines a listener to allow > remote access. > 1640984406: For more details see > https://mosquitto.org/documentation/authentication-methods/ > 1640984406: Opening ipv4 listen socket on port 1883. > 1640984406: Opening ipv6 listen socket on port 1883. > 1640984406: mosquitto version 2.0.10 running > 1640984413: New connection from 127.0.0.1:42095 on port 1883. > > *1640984413: New client connected from 127.0.0.1:42095 > <http://127.0.0.1:42095/> as MQTTSubscribe-5503 (p2, c1, k60, > u'None').1640984418: Client MQTTSubscribe-5503 disconnected.* > On Saturday, January 1, 2022 at 4:39:39 AM UTC-6 [email protected] > wrote: > >> Eric, >> >> In one of your posts above, the mosquito broker says it has a connection >> from a client...and given you're running this in a single VM, that must be >> a client on that machine. >> Im struggling to understand why you would want a MQTT broker on the same >> VM as weewx ...when it only needs the client. as weewx doesnt respond to >> mqtt messages/commands (someone will correct me if Im wrong) - maybe you >> dont need mqtt at all ? >> I suggest you test wether the weewx client is working (publishing) by >> using one of the public MQTT brokers such as test.moquito.org (and >> monitor your messages via mqtt explorer. >> If you're running the broker in the same vm as weewx, then you must have >> other mqtt devices (clients)...do they work ? >> I agree with Vince...and Im starting to lose the plot over what you're >> trying to acheive.... >> >> >> On Friday, 31 December 2021 at 23:47:59 UTC vince wrote: >> >>> Work your mosquitto broker problem and that only. >>> Test with mosquitto_sub and mosquitto_pub and get that to work first. >>> Once that works, try to get weewx to subscribe. >>> >>> Try removing any previous garbage your earlier attempts might have put >>> into /run. >>> >>> sudo rm -r /run/mosquitto >>> sudo systemctl start mosquitto >>> >>> On my ubuntu 21.10 vm permissions look like: >>> >>> root@ubuntu-focal:/run# ls -lagd /run/mosquitto >>> drwxr----- 2 root 60 Dec 31 23:42 /run/mosquitto >>> >>> root@ubuntu-focal:/run# ls -lagd /run/mosquitto/* >>> -rw-r--r-- 1 mosquitto 4 Dec 31 23:42 /run/mosquitto/mosquitto.pid >>> >>> On Friday, December 31, 2021 at 2:36:19 PM UTC-8 Eric K wrote: >>> >>>> No, its not working. >>>> Running the commands with sudo still failed to generate a pid file. >>>> Running with the default config allowed mosquitto to start and >>>> MQTTSubscribe tried to connect but it disconnected after 5 seconds. >>>> >>>> When I started weewx and forced wee_reports to run, it bomed out with >>>> many errors including MQTTSubscribe errors. >>>> I suspect because it couldn't connect to mosquitto. >>>> >>>> Since the mosquitto command changed from "port" to "listener", do I >>>> have to change the MQTTSubscribe section of weewx.conf so it calls out >>>> "listener = 1883" rather than "port = 1883"? >>>> >>>> >>>> On Friday, December 31, 2021 at 4:20:01 PM UTC-6 vince wrote: >>>> >>>>> So is it working ? Not working ? >>>>> We can't read minds and your followups are rather cryptic. >>>>> >>>>> Is there any mosquitto process running ? >>>>> If so stop it and try again with 'sudo systemctl start mosquitto' >>>>> >>>>> If you want to try to run mosquitto in the foreground to debug it, add >>>>> the -v switch to make it verbose, and remember to use sudo >>>>> >>>>> -- 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/25f90c9a-fb08-4a63-b8f2-501b8804190fn%40googlegroups.com.
