Changing icon pallet from CoT 2525C to OSM and show the correct Icon

After using node-red to inject an API key to input data onto the map we can modify the code to switch between unknown, friend, neutral, and hostile. When we try to use a different icon such as one from the OSM table transport icon the icon doesn’t change on the map and leaves one of the original 4 2525c icons. What do I need to change in the code to have new items from the api key show up as the transport icons?

var call = msg.payload.eventTime;
var alertid = msg.payload.alertId;
var lat = msg.payload.estimatedEventLocation[1];
var lon = msg.payload.estimatedEventLocation[2];
var headline = msg.payload.headline;
var remark = msg.payload.headline + ' ' + msg.payload.publicPost.link
const cinco = 10 * 60 * 1000;
const diez = 2 * cinco;
const stale = new Date(Date.now() + diez).toISOString();

/*
Not all fields are required for display on most TAK Products, other systems may
have different requirements. YMMV.
*/

msg.payload = {
    "event": {
        "_attributes": {
            "version": "2.0",
            "uid": call,
            "type": "a-h-G-I-i-e-icc",
            "how": "m-p",
            "time": new Date(Date.now()).toISOString(),
            "start": new Date(Date.now()).toISOString(),
            "stale": stale
        },
        "point": {
            "_attributes": {
                "lat": lat,
                "lon": lon,
                "hae": "0.0",
                "ce": "9999999.0",
                "le": "9999999.0"
            }
        },
        "detail": {
            "remarks": remark,
            "usericon": 'iconsetpath=6d781afb-89a6-4c07-b2b9-a89748b6a38f/Transport/caution.png'

        }
        }
}

return msg;

Going to need a bit more information I think.
How are you then converting that to xml and sending that to TAK ?
can you show us the xml that is being sent ?

If you are using the latest (0.15.0) version of my TAK registration node then you can send a simple object to create the marker (values hardcoded just for demo)

msg.payload = {
    name : "Caution-001",
    lat: 52,
    lon: -1,
    icon:"6d781afb-89a6-4c07-b2b9-a89748b6a38f/Transport/caution.png",
    SIDC: "SHGIIE",
    remarks: "Oops - something to look out for here."
}
return msg;

Example flow

[{"id":"d49875594dc11c84","type":"tcp request","z":"f66c5e7c660b2aec","name":"","server":"takserver","port":"8087","out":"sit","ret":"string","splitc":" ","newline":"</event>","trim":true,"tls":"","x":670,"y":1040,"wires":[["e3a6624c9fc609b7"]]},{"id":"58d89fb93ad8e764","type":"tak registration","z":"f66c5e7c660b2aec","name":"House","callsign":"CJ","group":"Cyan","role":"Gateway","latitude":"51.05","longitude":"-1.35","repeat":"60","dphost":"","x":570,"y":980,"wires":[["d49875594dc11c84","a078df188bc96e57"]]},{"id":"e3a6624c9fc609b7","type":"debug","z":"f66c5e7c660b2aec","name":"debug 14","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"topic","statusType":"msg","x":860,"y":1040,"wires":[]},{"id":"327ef306fc571d89","type":"inject","z":"f66c5e7c660b2aec","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":940,"wires":[["15624f42e9a0cf31"]]},{"id":"15624f42e9a0cf31","type":"function","z":"f66c5e7c660b2aec","name":"function 6","func":"msg.payload = {\n    name : \"Dave\",\n    lat: 52,\n    lon: -1,\n    SIDC: \"SHGIIE\",\n    remarks: \"Hey Dave\"\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":940,"wires":[["58d89fb93ad8e764"]]},{"id":"a078df188bc96e57","type":"debug","z":"f66c5e7c660b2aec","name":"debug 17","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"topic","statusType":"msg","x":760,"y":980,"wires":[]},{"id":"6be38ff88df9b951","type":"inject","z":"f66c5e7c660b2aec","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":980,"wires":[["09c713fbc28e0501"]]},{"id":"09c713fbc28e0501","type":"function","z":"f66c5e7c660b2aec","name":"Caution","func":"msg.payload = {\n    name : \"Caution-001\",\n    lat: 52,\n    lon: -1,\n    icon:\"6d781afb-89a6-4c07-b2b9-a89748b6a38f/Transport/caution.png\",\n    SIDC: \"SHGIIE\",\n    remarks: \"Oops - something to look out for here.\"\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":980,"wires":[["58d89fb93ad8e764"]]},{"id":"eab4981983d53f8b","type":"inject","z":"f66c5e7c660b2aec","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":1020,"wires":[["59f08089f0f4c561"]]},{"id":"59f08089f0f4c561","type":"function","z":"f66c5e7c660b2aec","name":"Awacs","func":"msg.payload = {\n    name : \"AWACS\",\n    lat: 51,\n    lon: -2,\n    icon:\"6d180afb-89a6-4c07-b2b3-a89748b6a38f/FalconView/E-3.png\",\n    SIDC: \"SFGPU-------\",\n    remarks: \"I'm watching you\"\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":1020,"wires":[["58d89fb93ad8e764"]]},{"id":"4a017ece45e049ed","type":"inject","z":"f66c5e7c660b2aec","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":1060,"wires":[["4bced043c53463b2"]]},{"id":"4bced043c53463b2","type":"function","z":"f66c5e7c660b2aec","name":"Fema - Destroyed","func":"msg.payload = {\n    name : \"A10\",\n    lat: 51,\n    lon: -3,\n    icon:\"f8f7f666-8b28-4b57-9fbb-e48e61d33b79/Iron Sites/Structure Destroyed.png\",\n    SIDC: \"SFGPU-------\",\n    remarks: \"Bang\"\n}\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":1060,"wires":[["58d89fb93ad8e764"]]}]

I am the one helping rivershark with this code on the server. How would we go about doing the stale and start times for it? I have everything else coded over to your module. btw big fan made my spaghetti code so much easier

Hi, start time is set to "now" when the message is sent. stale time can be set by setting msg.payload.ttl to a time to live in seconds - so based on your code above msg.payload.ttl = 1200