Skip to content

Instantly share code, notes, and snippets.

@davejlong
Last active March 12, 2025 15:39
Show Gist options
  • Save davejlong/273bd83f49855dda75501b4886bc4a45 to your computer and use it in GitHub Desktop.
Save davejlong/273bd83f49855dda75501b4886bc4a45 to your computer and use it in GitHub Desktop.
Sync UniFi network device information to Hudu
{
"name": "Sync UniFi to Hudu",
"nodes": [
{
"parameters": {},
"type": "n8n-nodes-unifi.uniFiNetwork",
"typeVersion": 1,
"position": [
220,
0
],
"id": "5dd6855f-fb4f-4437-8cc2-0eb22b5aee01",
"name": "Get all UniFi Sites",
"credentials": {
"unifiNetworkApi": {
"id": "I3cGinngkHZbRZQ7",
"name": "UniFi Network account"
}
}
},
{
"parameters": {
"resource": "device",
"siteId": "={{ $json.id }}"
},
"type": "n8n-nodes-unifi.uniFiNetwork",
"typeVersion": 1,
"position": [
440,
0
],
"id": "abd646c7-fc1f-445a-9855-a726167f07c8",
"name": "Get Devices at each site",
"credentials": {
"unifiNetworkApi": {
"id": "I3cGinngkHZbRZQ7",
"name": "UniFi Network account"
}
}
},
{
"parameters": {
"resource": "assets",
"filters": {
"filter_layout_id": 2,
"primary_serial": "={{ $json.macAddress }}"
}
},
"type": "n8n-nodes-hudu.hudu",
"typeVersion": 1,
"position": [
660,
0
],
"id": "9d1ddcac-4a30-4f11-8d9f-641a5ea3189d",
"name": "Lookup device in Hudu by MAC",
"credentials": {
"huduApi": {
"id": "w2jTY7l07dFShCu6",
"name": "Hudu account"
}
}
},
{
"parameters": {
"resource": "assets",
"operation": "update",
"id": "={{ $('Lookup device in Hudu by MAC').item.json.id }}",
"company_id": "={{ $('Lookup device in Hudu by MAC').item.json.company_id }}",
"updateShowOtherFieldsSelector": true,
"updateFieldMappings": {
"mappingMode": "defineBelow",
"value": {
"10": "={{ $json.ipAddress }}",
"199": "={{ $json.firmwareVersion }}"
},
"matchingColumns": [],
"schema": [
{
"id": "11",
"displayName": "Configuration (RichText)",
"required": false,
"defaultMatch": false,
"type": "string",
"display": true,
"canBeUsedToMatch": true,
"description": "Copy & Paste the Configuration",
"label": "Configuration",
"removed": true
},
{
"id": "199",
"displayName": "Firmware Version (Text)",
"required": false,
"defaultMatch": false,
"type": "string",
"display": true,
"canBeUsedToMatch": true,
"label": "Firmware Version",
"removed": false
},
{
"id": "10",
"displayName": "IP Address (Website)",
"required": false,
"defaultMatch": false,
"type": "string",
"display": true,
"canBeUsedToMatch": true,
"description": "Management IP Address",
"label": "IP Address",
"removed": false
},
{
"id": "13",
"displayName": "Notes (RichText)",
"required": false,
"defaultMatch": false,
"type": "string",
"display": true,
"canBeUsedToMatch": true,
"label": "Notes",
"removed": true
},
{
"id": "135",
"displayName": "Purchase Date (Date)",
"required": false,
"defaultMatch": false,
"type": "dateTime",
"display": true,
"canBeUsedToMatch": true,
"label": "Purchase Date",
"removed": true
},
{
"id": "9",
"displayName": "Role (Dropdown)",
"required": false,
"defaultMatch": false,
"display": true,
"canBeUsedToMatch": true,
"label": "Role",
"removed": true
},
{
"id": "12",
"displayName": "Subscription/Support Renewal (Date)",
"required": false,
"defaultMatch": false,
"type": "dateTime",
"display": true,
"canBeUsedToMatch": true,
"label": "Subscription/Support Renewal",
"removed": true
},
{
"id": "136",
"displayName": "Warranty Expiration Date (Date)",
"required": false,
"defaultMatch": false,
"type": "dateTime",
"display": true,
"canBeUsedToMatch": true,
"label": "Warranty Expiration Date",
"removed": true
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"updateFields": {
"primary_manufacturer": "Ubiquiti",
"primary_model": "={{ $json.model }}",
"primary_serial": "={{ $json.macAddress }}"
}
},
"type": "n8n-nodes-hudu.hudu",
"typeVersion": 1,
"position": [
1100,
0
],
"id": "72e9b8cc-bf9b-4a65-b587-da3cbb2c4f61",
"name": "Update device with information from UniFi",
"credentials": {
"huduApi": {
"id": "w2jTY7l07dFShCu6",
"name": "Hudu account"
}
}
},
{
"parameters": {
"rule": {
"interval": [
{
"field": "hours",
"hoursInterval": 2
}
]
}
},
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [
0,
0
],
"id": "49bff22c-a0c2-42b3-82f7-ff6daa790569",
"name": "Schedule Trigger"
},
{
"parameters": {
"resource": "device",
"operation": "get",
"siteId": "={{ $('Get all UniFi Sites').item.json.id }}",
"deviceId": "={{ $('Get Devices at each site').item.json.id }}"
},
"type": "n8n-nodes-unifi.uniFiNetwork",
"typeVersion": 1,
"position": [
880,
0
],
"id": "4c4d0cbf-7fee-496b-b452-cc164876190f",
"name": "Get detailed device information",
"credentials": {
"unifiNetworkApi": {
"id": "I3cGinngkHZbRZQ7",
"name": "UniFi Network account"
}
}
}
],
"pinData": {},
"connections": {
"Get all UniFi Sites": {
"main": [
[
{
"node": "Get Devices at each site",
"type": "main",
"index": 0
}
]
]
},
"Get Devices at each site": {
"main": [
[
{
"node": "Lookup device in Hudu by MAC",
"type": "main",
"index": 0
}
]
]
},
"Lookup device in Hudu by MAC": {
"main": [
[
{
"node": "Get detailed device information",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Get all UniFi Sites",
"type": "main",
"index": 0
}
]
]
},
"Get detailed device information": {
"main": [
[
{
"node": "Update device with information from UniFi",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "156e3f3b-348b-4a22-9144-1ca1116d487b",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "1f2b4bd62ce90bd9dd40220cee751e22176a769bde0a126f7f448925735bac46"
},
"id": "Ns4XzfwxAeWvCzsR",
"tags": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment