For those following along, I discovered that the mosquitto_pub & 
mosquitto_sub clients were automatically installed when I installed 
mosquitto into Ubuntu.  Here was the tip-off:
*weewx@Ubuntu20-WEEWX:~$ sudo apt install mosquitto-clients*
*Reading package lists... Done*
*Building dependency tree       *
*Reading state information... Done*
*mosquitto-clients is already the newest version (1.6.12-1).*
*0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.*

I found some Youtube videos by Steve Cope which show examples of using the 
commands.
https://youtu.be/J4pqv9__uzE

He mentions using the debug switch (-d) so you can see that the commands 
are doing something - very useful!

Running mosquitto_pub in one terminal window and mosquitto_sub in another 
is showing feedback of success!

*weewx@Ubuntu20-WEEWX:~$ mosquitto_pub -h 192.168.7.22 -p 1883 -t 
sensors/temperature -m "1266193804 32" -d*
*Client mosq-6o6U1MqsMVovfxfZta sending CONNECT*
*Client mosq-6o6U1MqsMVovfxfZta received CONNACK (0)*
*Client mosq-6o6U1MqsMVovfxfZta sending PUBLISH (d0, q0, r0, m1, 
'sensors/temperature', ... (13 bytes))*
*Client mosq-6o6U1MqsMVovfxfZta sending DISCONNECT*

*weewx@Ubuntu20-WEEWX:/etc/mosquitto$ mosquitto_sub -h 192.168.7.22 -p 1883 
-t sensors/temperature -d*
*Client mosq-VJoHFtTvE0io4OBXfe sending CONNECT*
*Client mosq-VJoHFtTvE0io4OBXfe received CONNACK (0)*
*Client mosq-VJoHFtTvE0io4OBXfe sending SUBSCRIBE (Mid: 1, Topic: 
sensors/temperature, QoS: 0, Options: 0x00)*
*Client mosq-VJoHFtTvE0io4OBXfe received SUBACK*
*Subscribed (mid: 1): 0*
*Client mosq-VJoHFtTvE0io4OBXfe received PUBLISH (d0, q0, r0, m0, 
'sensors/temperature', ... (13 bytes))*
*1266193804 32*
*Client mosq-VJoHFtTvE0io4OBXfe sending PINGREQ*
*Client mosq-VJoHFtTvE0io4OBXfe received PINGRESP*
On Wednesday, May 12, 2021 at 3:20:05 PM UTC-5 [email protected] wrote:

> As Greg said, make sure your MQTT infrastructure is up and running 
> correctly. Since you installed your own broker, a first check is to use 
> mosquitto_sub and mosquitto_pub to a test topic. Once that is working, use 
> mosquitto_sub to subscribe to the broker and topic(s) that you want 
> MQTTSubscribe to subscribe to. This will also provide you with the MQTT 
> message. The actual message will be useful as you configure 
> WeeWX/MQTTSubscribe.
>
> Next read https://github.com/bellrichm/WeeWX-MQTTSubscribe/wiki. This 
> will outline the install steps and point you to 
> https://github.com/bellrichm/WeeWX-MQTTSubscribe/wiki/Configuring, which 
> has the information on configuring WeeWX/MQTTSubscribe. This page will also 
> provide you with links to configuration examples by payload ‘type’.
> rich
>
> On Wednesday, 12 May 2021 at 12:24:37 UTC-4 Greg Troxel wrote:
>
>>
>> Eric Koester <[email protected]> writes: 
>>
>> > I see I mistyped mosquitto in at least one place above. 
>> > The /etc/mosquitto directory is spelled correctly in my Ubuntu 20 
>> machine. 
>> > 
>> > Ok, on the pid file. 
>> > The version of mosquitto in the Ubuntu 20 deb repo still has provision 
>> for 
>> > pid files, so its confusing. 
>>
>> mosquitto has support for pid files, and many systems use them. Whether 
>> they are normal and the right thing, or last year's plan depends on how 
>> your system deals with init things. However this is unlikely to make 
>> things work or not work, just ma make the init system unhappy about 
>> statusing and stopping mosquitto. 
>>
>> > It appears that the mosquitto install is properly starting as a daemon 
>> (I 
>> > see it in the process table in TOP) and running without errors in the 
>> > /var/log/mosquitto/mosquitto.log, so I think I'm ready to move on to 
>> > configuring MQTTSubscribe. 
>>
>> No, you are ready to use mosquitto_sub on the machine you want to run 
>> MQTTSubscribe and see if you are seeing the data from the command-line 
>> client. Pause to reconfigure mosquitto to listen beyond localhost if 
>> you need to, to figure out what you are doing about 1883 vs 8883/tls, 
>> and acls. Any time you can test at an intermedidate point, you make 
>> things simpler to figure out. 
>>
>> You can also use mosquitto_pub on the machine that is supposed to inject 
>> mqtt messsages. 
>>
>> Note that mosquitto silently drops topic writes that are not allowed by 
>> the acl. 
>>
>

-- 
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/de4fa1a8-0606-496a-9f9c-5b04b5efca62n%40googlegroups.com.

Reply via email to