Just include it in quotes:

topic = "wx/net13/#"

-tk

On Fri, Oct 19, 2018 at 7:01 AM Bill Morrow <morro...@gmail.com> wrote:

> The configuration of my wxMesh driver includes the MQTT topic to subscribe
> to for readings.
>
> I would like to set it to something like
>
> wxMesh]
>     driver = user.wxMesh
>
>     # MQTT specifics
> ...
>     topic = wx/net13/#
>
>
> so that publications by various nodes are all subscribed to by the driver.
> Each publisher publishes on its own topic, for example
> wx/net13/outdoor
> wx/net13/wind
> wx/net13/indoor
> and I would like the driver to subscribe to all
>
> It looks like python is interpreting the "#" as the start of a comment.
>
> If I escape the "#",
>
> topic = wx/net13/\#
>
> the driver does this:
>
> Oct 19 10:51:43 hostname weewx[31754]: wxMesh: MQTT topic is wx/net13/\
>
> I can remove the configuration in weewx.conf
>
>     #topic = wx/net13/\#          # topic is all weather (indoor and
> outdoor, e.g.)
>
> and hard code it in the driver
>
>     def __init__(self, **stn_dict):
>       # where to find the data file
>       self.host = stn_dict.get('host', 'localhost')
>       self.topic = stn_dict.get('topic', 'wx/net13/#')
>
> but would prefer to have it configurable.
>
>
>
>

Reply via email to