MQTT Plugin for Weewx

168 views
Skip to first unread message

dan Forster

unread,
May 10, 2020, 8:53:45 AM5/10/20
to weewx-user
Hello,


  • I have upgraded my Raspberry Pi to a model 4 with Raspian Buster. I now have Weewx 4 running under Python 3, all working perfectly (Davis Vantage Pro with USB).
  • I would like to use the above link * MQTT plugin with Weewx 4, and see it has a green compatibility tick next to its listing, saying it will work with Python 3.
  • Does this mean I need to install Pip (using sudo apt install python-pip) which I take it is Pip for Python 2, in order for it to work? Or will this plugin work with Pip3?
Cheers for any advice...

Tom, sorry for posting in the wrong section.

Dan


Greg Troxel

unread,
May 10, 2020, 9:29:19 AM5/10/20
to dan Forster, weewx-user
dan Forster <daniel.f...@gmail.com> writes:

> Regarding this plugin https://github.com/weewx/weewx/wiki/mqtt *
>
> - I have upgraded my Raspberry Pi to a model 4 with Raspian Buster. I
> now have Weewx 4 running under Python 3, all working perfectly (Davis
> Vantage Pro with USB).
> - I would like to use the above link * MQTT plugin with Weewx 4, and see
> it has a green compatibility tick next to its listing, saying it will work
> with Python 3.
> - Does this mean I need to install Pip (using sudo apt install
> python-pip) which I take it is Pip for Python 2, in order for it to work?
> Or will this plugin work with Pip3?

I don't use raspian, and you are really asking an OS python question.
I'm answering because I have edited that wiki page at times.

This isn't really about pip. The real requirement is that the python
modules listed have to be present in the version of python that you are
using to run weewx, so that when the mqtt module does an import
statement, they load. See mqtt.py, and notice

import paho.mqtt.client as mqtt

and then a few lines later, code looking for one of several json
implementations.

This definitely means that if you are using e.g. python 3.7 for weewx,
having a python 2.7 paho module installed is not useful.

So if you have prerequisites for weewx installed in some python3.X
version, and you used pip for that, you should run the version of pip
that will install to that same place.

Or, if you have other prerequisites installed via a packaging system,
then you can just install that packages for the python modules paho-mqtt
and python-json using that same packaging system.

On my weewx install (still running python 2.7), I have the following
pkgsrc packages installed. Of course, this is not directly applicable
because you said you are running Raspbian.

py27-paho-mqtt-1.4.0 MQTT version 3.1.1 client class
py27-cjson-1.2.1 Fast JSON encoder/decoder for Python



And you posted in exactly the right place.

vince

unread,
May 10, 2020, 11:46:42 AM5/10/20
to weewx-user
On Sunday, May 10, 2020 at 5:53:45 AM UTC-7, dan Forster wrote:
  •  I now have Weewx 4 running under Python 3, all working perfectly (Davis Vantage Pro with USB).
  • ...which I take it is Pip for Python 2, in order for it to work? Or will this plugin work with Pip3?


If you are using python3, any modules you install must be installed with pip3.

Simple as that.

 
Reply all
Reply to author
Forward
0 new messages