Hello,
I am not a programmer and am having lots of problems getting this sensor data into my emoncms server. The sensor seems to be working correctly and sending LoRa data to my RAK7244 server/gateway. I have four LoRa temp/hum (LHT65) sensors doing this (MQTT) and are working correctly (I had much help in setting up the function on node-red).
I'm sure the problem must be my "function" syntax and construction as I'm getting errors of CO2_Value_PPM "undefined."
I have attached what I think will give you enough information but will be happy to send more. Thanks in advance.
Bob
> Data From LoRa gateway
>
> Applications/CO2app/Devices/CO2device
>
> applicationID:"18"
> applicationName:"CO2app"
> deviceName:"CO2device"
> devEUI:"2cf7f12122500013"
> rxInfo:
> frequency:904700000
> modulation:"LORA"
> bandwidth:125
> spreadingFactor:10
> codeRate:"4/5"
> polarizationInversion:false
> adr:true
> dr:0
> fCnt:44
> fPort:2
> data:"AQQQeMIGAFZv"
>
> err:0
> CO2_Value_PPM:443 <<--this is the data I need sent
> measurementId:4100
> type:"report_telemetry"
> payload:"01041078C20600566F"
> valid:true
> tags:
> confirmedUplink:true
> devAddr:"01686a36"
> publishedAt:"2021-11-14T21:56:48.345702362Z"
>
> =======================================================
>
> debug message
>
> 11/14/2021, 4:56:48 PMnode: 64d043922a280e22
> msg.payload : Object
> object
> CO2_Value_PPM: undefined
>
> =======================================================
>
> emoncms node
>
>
> Emoncms server emonpi
> Node CO2
> Data Type valid JSON object
> Name CO2
>
> =======================================================
>
> From Node-Red Function Node
>
> On Message
> input = msg.payload
> var CO2_Value_PPM = input.object.CO2_Value_PPM
> msg2 = {payload:{"CO2_Value_PPM":realDataValue}};
> return msg2;
>
> =====================================================
>
> From Json Node
>
>
> Action Always convery to JavaScript Object
> Property msg payload
> Name CO2
>
> ====================================================
>
> MQTT in node
>
>
> Server RAK7244
> Topic application/18/device/2cf7f12122500013/rx
> QoS 1
> Output auto-detect (string or buffer)
> Name CO2
>
> ==================================================