{sensor: 1, temp: 25.1, batt: 3.34}
fun(Fields, <<Data/binary>>) ->
Fields#{sensor => binary_part(Data, {0,1}), temp => binary_part(Data, {2,4}), batt => binary_part(Data, {8,4})}
end.fun(Fields, <<SENSOR, Temp:4/binary, Voltage:4/binary>>) ->
Fields#{sensor => SENSOR, temp => Temp, batt => Voltage}
end.First of all, are you using the release 0.4.x or 0.5? The documentation under ‘master’ branch is for 0.5; if you have 0.4.x you need to switch to ‘stable’.
If your data is as you say, then <<Sensor:1/binary, Temp:4/binary, Voltage:4/binary>> shall work. The difference to your last function is that “Sensor” is a binary too.
Petr
--
You received this message because you are subscribed to the Google Groups "LoRaWAN Server Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lorawan-serve...@googlegroups.com.
To post to this group, send email to lorawan...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lorawan-server/15911b85-50f3-47ab-b0e7-2508d976bb81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.