Thanks for the replies. Here is where I am.
bg@n4mrv:~$ mosquitto_sub -t application/18/device/2cf7f12122500013/rx -h
192.168.1.10 | jq .
{
"applicationID": "18",
"applicationName": "CO2app",
"deviceName": "CO2device",
"devEUI": "2cf7f12122500013",
"txInfo": {
"frequency": 905300000,
"dr": 0
},
"adr": true,
"fCnt": 226,
"fPort": 2,
"data": "AQQQsI8GAF5I",
"object": {
"err": 0,
"messages": [
{
"CO2_Value_PPM": 430,
"measurementId": 4100,
"type": "report_telemetry"
}
],
"payload": "010410B08F06005E48",
"valid": true
}
}
I was using node-red but thought it was conflicting with something else on
Mosquitto-subscribe-weewx so I turned it off. I wasn't sure how to connect
weewx to the output of n-r.
When setting the CO2 sensor up with emoncms (another server) a kind and
knowledgeable soul gave me the following code for a function in n-r:
```
// Test to see if CO2 measurement is present in uplink // Assumption is
msg.payload.object.messages[] array is always present // if not then we
need to test in different way // why do we do this to ensure we don't send
rubbish to emoncms if ("CO2_Value_PPM" in msg.payload.object.messages[0]){
msg =
{payload:{"CO2_Value_PPM":msg.payload.object.messages[0].CO2_Value_PPM}};
return msg; }
```
This cut down the extra data and produced something like: "CO2_Value_PPM:
430" other data was omitted.
You may have an idea about connecting n-r.
Cheers,
Bob
On Sunday, November 28, 2021 at 2:21:01 PM UTC-5 [email protected] wrote:
> From the log extract, this what I see as the payload
>
> {
> "applicationID": "18",
> "applicationName": "CO2app",
> "deviceName": "CO2device",
> "devEUI": "2cf7f12122500013",
> "txInfo": {
> "frequency": 903900000,
> "dr": 0
> },
> "adr": true,
> "fCnt": 220,
> "fPort": 2,
> "data": "AQQQaJsGAAqz",
> "object": {
> "err": 0,
> "messages": [
> {
> "CO2_Value_PPM": 433,
> "measurementId": 4100,
> "type": "report_telemetry"
> }
> ],
> "payload": "010410689B06000AB3",
> "valid": true
> }
> }
>
> On Sunday, 28 November 2021 at 14:07:59 UTC-5 vince wrote:
>
>> Agree. Pre-process it to a format that works with weewx.
>>
>> Again, can you give us a vanilla "mosquitto_sub -t whatever -h the_host"
>> output so we can see what you have a little more clearly ? Piping it to "
>> |
>> jq . " sometimes helps show the nesting and structure a little better
>> for the eyes.
>>
>> On Sunday, November 28, 2021 at 10:51:17 AM UTC-8 [email protected]
>> wrote:
>>
>>> Since you are using Node Red, a possible solution is to use a Change
>>> Node and delete the payload that you don't want to include in weewx.
>>>
>>> On Sunday, November 28, 2021 at 1:41:56 PM UTC-5 [email protected]
>>> wrote:
>>>
>>>> I looked more closely at the payload format and I don't think that
>>>> format is currently supported. specifically the 'nested array'..
>>>>
>>>> "object":{"err":0,"messages":[{"CO2_Value_PPM":433,"measurementId":4100,"type":"report_telemetry"}]
>>>> Busy time of the year, so not sure when I'll have time to delve into a
>>>> solution.
>>>> rich
>>>> On Sunday, 28 November 2021 at 12:22:22 UTC-5 [email protected] wrote:
>>>>
>>>>>
>>>>> Bob,
>>>>> Since you have a lot of fields that you want to ignore, try setting
>>>>> the ignore flag to true at the 'topic' level. Also I don’t think you want
>>>>> to set contains_total. So you would end up with something like this,
>>>>> [[topics]]
>>>>> [[[application/18/device/2cf7f12122500013/rx]]]
>>>>> ignore = true
>>>>> [[[[CO2_Value_PPM]]]]
>>>>> name = co2
>>>>> ignore = false
>>>>>
>>>>> Since the data is published so infrequently, once you get the basic
>>>>> configuration working, you might want to look into the expires_after
>>>>> option. This will cache the value between publications. For additional
>>>>> information see,
>>>>> https://github.com/bellrichm/WeeWX-MQTTSubscribe/wiki/Configuring-additional-options#expires_after
>>>>>
>>>>> rich
>>>>>
>>>>> On Sunday, 28 November 2021 at 11:21:43 UTC-5 [email protected] wrote:
>>>>>
>>>>>> Thanks for coming back so soon with help Storm and Vince.
>>>>>> I am attaching three things in a .txt file rather than pasting in as
>>>>>> the format seems messy and I'm not sure how to make it easier to read.
>>>>>>
>>>>>> 1. My modified section of weewx.conf . Among other things, there
>>>>>> seems to be a problem with float.
>>>>>>
>>>>>> 2. The data sent from the LoRa server when I subscribe
>>>>>> to applications/18/devices/2cf7f12122500013/rx (using MQTT-explorer).
>>>>>> Lots
>>>>>> of unneeded things but it contains the CO2_Value_PPM data.
>>>>>>
>>>>>> 3. A listing of weewx.log in debug mode showing the problems (I
>>>>>> hope). The data seems to be getting there but is not being parsed out
>>>>>> for
>>>>>> what I need.
>>>>>>
>>>>>> Hopefully this will give you an idea of what's going on. Thanks
>>>>>> again for your help.
>>>>>> Bob
>>>>>>
>>>>>> On Saturday, November 27, 2021 at 5:36:51 PM UTC-5 vince wrote:
>>>>>>
>>>>>>> My example:
>>>>>>>
>>>>>>> [MQTTSubscribeService]
>>>>>>> enable = True
>>>>>>> host = 192.168.1.171
>>>>>>> port = 1883
>>>>>>> keepalive = 60
>>>>>>> username = None
>>>>>>> password = None
>>>>>>> binding = loop
>>>>>>> [[message_callback]]
>>>>>>> type = json
>>>>>>> [[topics]]
>>>>>>> unit_system = US
>>>>>>> #
>>>>>>> #--- these are emitted every 5 minutes ---
>>>>>>> # mosquitto_sub -t BaseballRoomConditions -h nuc2
>>>>>>> # {"dateTime": 1621715702, "extraTemp1": 63.16,
>>>>>>> "extraTemp2": 63.5, "pi": 100.28}
>>>>>>> #
>>>>>>> [[[BaseballRoomConditions]]] <=== the topic to subscribe
>>>>>>> to
>>>>>>> [[[[dateTime]]]] <=== the element in that
>>>>>>> topic
>>>>>>> ignore = True <=== optionally ignore this
>>>>>>> item within the topic
>>>>>>> [[[[extraTemp1]]]]
>>>>>>> name = extraTemp1 <=== db element to map the
>>>>>>> item to
>>>>>>> units = degree_F <=== its units
>>>>>>> [[[[extraTemp2]]]]
>>>>>>> name = extraTemp2
>>>>>>> units = degree_F
>>>>>>> [[[[pi]]]]
>>>>>>> ignore = True
>>>>>>>
>>>>>>>
>>>>>>> On Saturday, November 27, 2021 at 2:26:46 PM UTC-8
>>>>>>> [email protected] wrote:
>>>>>>>
>>>>>>>> I believe you need to add the topic you subscribing to in
>>>>>>>> [[[first/topic]]].
>>>>>>>>
>>>>>>>> Example:
>>>>>>>>
>>>>>>>>
>>>>>>>> ##########################################################################################
>>>>>>>> # Acurite-5n1 Sensors
>>>>>>>> # SDR # 1
>>>>>>>> # 433 MHz
>>>>>>>>
>>>>>>>> ##########################################################################################
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> [[[Acurite-Tower/8785/]]]
>>>>>>>>
>>>>>>>> [[[[temperature_F]]]]
>>>>>>>> name = extraTemp7
>>>>>>>> ignore = False
>>>>>>>> contains_total = False
>>>>>>>> conversion_type = float
>>>>>>>> units = degree_F
>>>>>>>>
>>>>>>>> On Saturday, November 27, 2021 at 5:15:24 PM UTC-5 [email protected]
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Hello,
>>>>>>>>> I'm running a RAK7244 LoRaWAN server/gateway on a local network to
>>>>>>>>> which my weewx server is connected. Weeex is the latest stable on
>>>>>>>>> Ubuntu
>>>>>>>>> with extended db.
>>>>>>>>>
>>>>>>>>> A CO2 sensor is sending data to the LoRa server. I have node-red
>>>>>>>>> on my weewx server with a flow connecting to the RAK7244. I want to
>>>>>>>>> have
>>>>>>>>> the CO2 data put into the co2 slot that is available on the weewx db.
>>>>>>>>>
>>>>>>>>> I have installed the weewx extension Mosquitto-subscribe and
>>>>>>>>> attempted to configure weewx.conf as:
>>>>>>>>> #################################################
>>>>>>>>> # Options for 'MQTTSubscribeService'
>>>>>>>>> [MQTTSubscribeService]
>>>>>>>>> # This section is for the MQTTSubscribe service.
>>>>>>>>> # Turn the service on and off.
>>>>>>>>> # Default is: true
>>>>>>>>> # Only used by the service.
>>>>>>>>> enable = true # false
>>>>>>>>>
>>>>>>>>> # The MQTT server.
>>>>>>>>> # Default is localhost.
>>>>>>>>> host = localhost #192.168.1.10 #localhost
>>>>>>>>>
>>>>>>>>> # The port to connect to.
>>>>>>>>> # Default is 1883.
>>>>>>>>> port = 1883
>>>>>>>>>
>>>>>>>>> # Maximum period in seconds allowed between communications
>>>>>>>>> with the broker.
>>>>>>>>> # Default is 60.
>>>>>>>>> keepalive = 60
>>>>>>>>>
>>>>>>>>> # username for broker authentication.
>>>>>>>>> # Default is None.
>>>>>>>>> username = None
>>>>>>>>>
>>>>>>>>> # password for broker authentication.
>>>>>>>>> # Default is None.
>>>>>>>>> password = None
>>>>>>>>>
>>>>>>>>> # The binding, loop or archive.
>>>>>>>>> # Default is: loop
>>>>>>>>> # Only used by the service.
>>>>>>>>> binding = loop
>>>>>>>>>
>>>>>>>>> # The message handler to use
>>>>>>>>> [[message_callback]]
>>>>>>>>> # The format of the MQTT payload.
>>>>>>>>> # Currently support: individual, json, keyword
>>>>>>>>> # Must be specified.
>>>>>>>>> type = json #REPLACE_ME
>>>>>>>>>
>>>>>>>>> # The application/18/device/2cf7f12122500013/rx topics to
>>>>>>>>> subscribe to.
>>>>>>>>> [[topics]]
>>>>>>>>> # Units for MQTT payloads without unit value.
>>>>>>>>> # Valid values: US, METRIC, METRICWX
>>>>>>>>> # Default is: US
>>>>>>>>> unit_system = US
>>>>>>>>>
>>>>>>>>> [[[first/topic]]]
>>>>>>>>>
>>>>>>>>> #value sent from RAK7244
>>>>>>>>>
>>>>>>>>> [[[[CO2_Value_PPM]]]]
>>>>>>>>> #weewx db name
>>>>>>>>> name = co2
>>>>>>>>> ignore = false
>>>>>>>>> contains total = True
>>>>>>>>> conversion type = float
>>>>>>>>>
>>>>>>>>> #[[[SECOND/REPLACE_ME]]]
>>>>>>>>> ################################################
>>>>>>>>>
>>>>>>>>> The message (data) every 60 minutes coming from the node-red
>>>>>>>>> function is:
>>>>>>>>>
>>>>>>>>> {"CO2_Value_PPM":401}
>>>>>>>>>
>>>>>>>>> I may have too many things going here but, as I'm not a
>>>>>>>>> programmer, I'm stuck trying to figure out the problem. The node-red
>>>>>>>>> flow
>>>>>>>>> is connected on both ends (RAK7244-->weewx) but I don't see any data
>>>>>>>>> reaching the db.
>>>>>>>>>
>>>>>>>>> Thanks in advance if anyone can help on this.
>>>>>>>>> Cheers'
>>>>>>>>> Bob
>>>>>>>>>
>>>>>>>>>
--
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/cde1487b-9962-4541-809c-922fbd5818c9n%40googlegroups.com.