[Solved] No data/payload with connected device

Hi I just started to use Losan and am having the same issue were I get the " A provided attribute is not defined on the device, or the data type is incorrect." error. It appears that I am only getting variables set as Boolean are working, variables set as Numbers all report errors. Does anyone have any ideas why the “Number” variables do not work?

Below are sceen shots and code snippets from my project.
image

Code in my function were is set variables;

payload.data.body.statusUpsBatOverV	=	(Status2 & 0x04)>>2;
payload.data.body.status12V	 =	(Status2 & 0x02)>>1;
payload.data.body.statusCharging		=	(Status2 & 0x01);
payload.data.body.systemV           = (Data1+1000)/100;
payload.data.body.battV             = (Data2+500)/100;
payload.data.body.charge12V         = Data3;
payload.data.body.analogue4         =	Data4;
payload.data.body.analogue5         = Data5;
payload.data.body.airPressure       = Data6;
payload.data.body.tempAir           = (Data7-200)/10;
payload.data.body.tempWater         = (Data8-200)/10;

payload.data.body.rssi_Int          = rssi_Int;
payload.data.body.snr_Float         = snr_Float;
payload.data.body.avgSnr_Float      = avgSnr_Float;
payload.data.body.seqNumber_Int     = seqNumber_Int;

Screen shot from my "Device State Node " were the states are saved
image

You’re very close, but you’ll need to tweak the Device State node a little. Most text fields in the workflow editor support what we call “templates”, which allow you to pull values from the payload using double-curly braces. Each Value field in the Device State node should be updated to use templates. For example:

{{ data.body.airPressure }}

You’ll also noticed I removed payload from the start of that template. The payload variable is only used in the function node. This is because we had to put the payload on some variable so you can access it using JavaScript. All other places in the workflow engine don’t need that extra variable and can just reference the path directly.

So the reason you’re receiving the error is that the value you’re trying to store in the number attributes is the literal string “payload.data.body.airPressure” instead of the evaluated value at that payload location. Swapping each of those with a template should resolve your issue.

Even if you’re not using Sigfox, this is a helpful guide that looks to be pretty similar to your scenario:

Thanks for the prompt response. That sorted my problem.

Awesome!

On a related note, the other type of text field is usually labeled “Payload Path”, which would just be a path and not use the curly braces. In those examples, it would just be data.body.airPressure. The major difference is that templates give you quite a bit of power when it comes to formatting your data. Payload Paths are simply asking for a pointer to your payload somewhere.