New analog value from node appears as slider

Thank you for taking the time to submit your bug/issue! Please use the points below as a guide when submitting.

Hardware : Arduino Uno with a Dragino Lora shield

Data flow Arduino → Gateway → The Things Network - > Cayenne

What I did:
I needed to add another analog output representing battery voltage to an existing node. This node already sent 2 integers (temp and humidity) and a float (water level) up to Cayenne OK.
I added the extra line of code to the Arduino software like this:
//get the data values to send

  • GetTemp(); //global values ‘t’ for temp and ‘h’ for humidity as floats. (4 bytes)*

  • int16_t uRange = tank_depth - GetDistance(); //read water level (2 bytes)*

  • volts = getBatteryVoltage(); //this is the new data being added to the payload*

  • lpp.reset();*

  • lpp.addTemperature(1, t);*

  • lpp.addRelativeHumidity(2, rh);*

  • lpp.addAnalogOutput(3, (float) uRange);*

  • lpp.addAnalogOutput(4, volts);*

What I saw :
I my debug statements on the Arduino I saw the correct voltage being used.
On the things network I saw the extra data field with the correct value.
However on the Cayenne dashboard I saw the new variable appear as Analog Output (4) but as a slider and not a displayed value. The value of the slider is the correct value of the value output to be displayed. If I delete this widget it comes back again automatically as a slider widget.

When I go into settings I can’t change the widget to anything apart from slider.

Any idea what is going wrong here?
I thought I would have to manually add another widget to represent the new variable and I’m a bit surprised it a) did it automatically by noticing the extra data available from The Things Network and b) appears to get it wrong and and input to the Arduino and not an output becuase down in the ARduino it was specified as an output just like the existing working variable.

you need to use Analog Input in place of the Analog Output. when you specific it as an output is an actuator which produces an slide widget on the dashboard.

As I stated

the new variable appear as Analog Output (4) but as a slider

I did not add the widget as the slider, it was added automatically.
Furthermore…

If I delete this widget it comes back again automatically as a slider widget.

and the most important bit…

When I go into settings I can’t change the widget to anything apart from slider.

I already know I need to use an Analog Input, as you can see from the screenshot I have already implemented an Analog Input, changed the name, changed the display accuracy etc.

The problem is the Cayenne dashboard appears to be assuming the incoming data is for an Analog output. The only place the data type is specified is back at the node and that is in line with existing Analog sensors. As the data goes through the The Things Network it is flagged as a Cayenne payload and so there is no code to adjust/scale or in any way modify the data type.
The issue appears when the data comes into the Cayenne system, the variable is decided to be an analog output and not input.
(This was why I included the code from the Arduino so people can see how the data goes into he packets)

This is what the data looks likes from the Application page on The Things Network:

{
“analog_out_3”: 176,
“analog_out_4”: 13.62,
“relative_humidity_2”: 94,
“temperature_1”: 25.6
}
As can be seen, “analog _out_3” and “analog_out_4” are being named and treated in the same way by TTN. In the same way the source node on the Arduino is putting them into a packet structured for a Cayenne final display. (Analog_out here means output from the Arduino node, which should become an analog input to Cayenne)
However for some reason Cayenne is seeing this data as two different types when it is being extracted from the packet(s) from TTN. So my original “analog_output_3” is being imported correctly however the newly added “analog_output_4” is being treated differently by Cayenne. And that is the problem.

i used this code and it gave me this widget on dashboard.

int x;
void loop()
{
  debugSerial.println("-- LOOP");
  x++;
  lpp.reset();
  lpp.addTemperature(1, x);
  lpp.addBarometricPressure(2, x);
  lpp.addGPS(3, 52.37365, 4.88650, 2);
  lpp.addAnalogOutput(4, x);
  lpp.addAnalogInput(5, x);
  lpp.addAnalogInput(6, x);

  // Send it off
  ttn.sendBytes(lpp.getBuffer(), lpp.getSize());

  delay(5000);
}

i hope you get what i meant earlier.
the widget are created on data type you send from the node. if you are sending analogOutput it will create a slider. you need to send the correct data type to create the respective widget type.