I removed the function and it looks better. Last debug going into 
mqtt_publish:

11/29/2021, 4:17:17 PMnode: mqtt_payload 
<http://localhost:1880/#>application/18/device/2cf7f12122500013/rx 
: msg.payload : string[87]
string[87]
{ "CO2_Value_PPM": 399, "measurementId": 4100, "type": "report_telemetry" }
<http://localhost:1880/#>

However, weewx still doesn't seem to like it. I'll try changing topics to 
"mytopic" and see what happens.
Now heading for the aspirin bottle and will check results later. Have a 
good evening!
On Monday, November 29, 2021 at 4:28:14 PM UTC-5 vince wrote:

>
>    - You can call the mqtt topic you publish to anything you want, just 
>    make sure weewx subscribes to that topic of course.
>    - You might want to name your debug nodes explicitly but that's just 
>    nice to have for viewing the debug output
>
> Basically go as simple as possible first before adding in the mqtt publish 
> at the end.
>
>    - I'd suggest detaching your function node (for now) and see if the 
>    simple variant I did works for you first.
>    - You could also detach the mqtt publish node (for now) until your 
>    debug node output looks correct.
>
> Go with stuff-comes-in, convert-to-json, grab-the-desired-subset, and see 
> what the debug nodes show you in/between/after each element.
>
> Step through it.
>
> On Monday, November 29, 2021 at 1:12:27 PM UTC-8 [email protected] wrote:
>
>> Thanks, Vince, for all this extra work! I'm still having problems but 
>> feel we are close since you got it to work by injecting my data.
>> I wasn't sure how to feed your flow but here is what I have:
>>
>> [image: 2021-11-29.png]f
>> The debug messages (from right hand area of screen) are as follows:
>>
>> 11/29/2021, 3:15:52 PMnode: 7effad75.c88c64     * ******** [from the 
>> CO2_from RAK7244]*
>> application/18/device/2cf7f12122500013/rx : msg.payload : Object
>> object
>> applicationID: "18"
>> applicationName: "CO2app"
>> deviceName: "CO2device"
>> devEUI: "2cf7f12122500013"
>> txInfo: object
>> frequency: 904700000
>> dr: 0
>> adr: true
>> fCnt: 251
>> fPort: 2
>> data: "AAcAZAA8ANvo"
>> object: object
>>
>> 11/29/2021, 3:16:03 PMnode: 7effad75.c88c64    ***** [also from the 
>> CO2_from RAK7244; not sure why another came (?)]*
>> application/18/device/2cf7f12122500013/rx : msg.payload : Object
>> object
>> applicationID: "18"
>> applicationName: "CO2app"
>> deviceName: "CO2device"
>> devEUI: "2cf7f12122500013"
>> txInfo: object
>> adr: true
>> fCnt: 252
>> fPort: 2
>> data: "AQQQwDkGAIBO"
>> object: object
>>
>> 11/29/2021, 3:16:03 PMnode: 71dff607.6d0c88     *****[from the 
>> CO2_Value_PPM output--this looks correct]*
>> msg.payload : Object
>> { CO2_Value_PPM: 408 }
>>
>> 11/29/2021, 3:16:03 PMnode: 2056fe20.5f0b7a   *****[from the json 
>> output--it stops after this]*
>> msg : error
>> "TypeError: Cannot read property 'messages' of undefined"
>>
>> I wasn't sure what the "topic" should be which you had listed in 
>> publish_to_mqtt so I changed *mytopic* to 
>> *application/18/device/2cf7f12122500013/rx*
>> Is this correct or should it be CO2_Value_PPM?
>>
>> Should I remove my function as it seems to cause a conflict with yours? I 
>> was using this in my other setup
>> with emoncms and it seems to be working there but may not be the correct 
>> form to feed your  process.
>>
>> Please take your time on this, there is no big rush for me. Many thanks!
>> Bob
>> On Monday, November 29, 2021 at 2:25:49 PM UTC-5 vince wrote:
>>
>>> I took a few minutes to relearn node-red a bit and got it to work by 
>>> injecting your starting json and emitting mqtt to a mosquitto broker on the 
>>> same node.  Works fine here.
>>>
>>> I've attached the flows and details for the various nodes as images and 
>>> the whole thing as a json you can try yourself.   The key seems to be 
>>> setting "format JSON string" in the json node.
>>>
>>>
>>>

-- 
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/bfa871e9-3b49-424e-b2c9-a56e0c5024c6n%40googlegroups.com.

Reply via email to