I think this is because the
Cayenne.virtualWrite() is expecting 4 parameters - channel, data, data type, and unit type.
For some examples:
Digital 2-state value 1 on channel 5:
Cayenne.virtualWrite(5, 1, "digital_sensor", "d");
Generic analog value 17.222 on channel 6:
Cayenne.virtualWrite(6, 17.222, "analog_sensor", "null");
Proximity data in centimeters of 50cm on channel 7:
Cayenne.virtualWrite(7, 50, "prox", "cm");
The confusing part is that you need a list of valid data types to build these statements and the list at https://mydevices.com/cayenne/docs/#bring-your-own-thing-api-supported-data-types is out of date or incorrect in some places.
I'm going to make an up to date reference and post it to The Library category, then I'll link it back here later today.