Re: [weewx-development] Reading weewx.conf, including an MQTT "#" wildcard

2018-10-19 Thread Bill Morrow
Excellent, that worked, Tom.

I've updated the wxMesh driver to read JSON, motivated by the death of the 
Raspberry Pi B1 I was using as a gateway between nrf24 radios and MQTT. 
I'll get it up to git hub after a bit more testing.

The prototype outdoor station uses a nrf24 radio, the new one I am working 
on uses the lower frequency RF69 model which has better range and still 
plenty of bandwidth.

The RF24 gateway is moved to a nodeMCU, propped up by a not-yet-integrated 
radiometer and faithfully guarded by my mascot.

[image: 20181019_135358annotated.jpg]




On Friday, 19 October 2018 12:33:43 UTC-3, Tom Keffer wrote:
>
> Just include it in quotes:
>
> topic = "wx/net13/#"
>
> -tk
>
> On Fri, Oct 19, 2018 at 7:01 AM Bill Morrow  > 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.
>>
>>
>>
>>

Re: [weewx-development] Reading weewx.conf, including an MQTT "#" wildcard

2018-10-19 Thread Thomas Keffer
Just include it in quotes:

topic = "wx/net13/#"

-tk

On Fri, Oct 19, 2018 at 7:01 AM Bill Morrow  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.
>
>
>
>


[weewx-development] Reading weewx.conf, including an MQTT "#" wildcard

2018-10-19 Thread Bill Morrow
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.