Flow Details
About
This flows uses the Emby Server API to scrape the Sessions endpoint and parse for active users. App only shows if Current Streams is at least 1.
Requirements
- ICON 4597 (https://developer.lametric.com/icons)
- Emby Server + Emby API Token
Within the flow replace the following:
-
<YOUR EMBY SERVER>
-
<YOUR AWTRIX IP>
-
<YOUR EMBY API TOKEN>
{
"name": "emby streams",
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"field": "seconds"
}
]
}
},
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [
0,
0
],
"id": "f824b32d-ec75-424d-b853-812cc545c62f",
"name": "Schedule Trigger"
},
{
"parameters": {
"url": "http://<YOUR EMBY SERVER>/emby/Sessions/?api_key=<YOUR EMBY API TOKEN>",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
220,
0
],
"id": "8d1eba58-17fa-426e-beb1-435693c01802",
"name": "HTTP Request"
},
{
"parameters": {
"language": "python",
"pythonCode": "total_streams = 0\nfor item in _input.all():\n if \"json\" in item:\n if \"PlayState\" in item[\"json\"]:\n if \"PlayMethod\" in item[\"json\"][\"PlayState\"]:\n total_streams += 1\nreturn {'total_streams': total_streams}"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
440,
0
],
"id": "21982400-a5d1-4096-8fd8-9bfef17ae5cc",
"name": "Code"
},
{
"parameters": {
"method": "POST",
"url": "http://<YOUR AWTRIX IP>/api/custom",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "name",
"value": "emby"
}
]
},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "text",
"value": "={{ $json.total_streams }}"
},
{
"name": "icon",
"value": "4597"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1040,
100
],
"id": "8f017a36-eeac-4e69-b313-2207570d6fd1",
"name": "Send to AWTRIX"
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json.total_streams }}",
"value2": "={{ num = 0; num.toString(0) }}"
}
]
},
"combineOperation": "any"
},
"id": "0692fcb7-2f1f-4abf-9e4d-8dd079883280",
"name": "IF",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
640,
0
]
},
{
"parameters": {
"method": "POST",
"url": "http://<YOUR AWTRIX IP>/api/custom",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "name",
"value": "emby"
}
]
},
"options": {}
},
"id": "d6091c1f-9cf6-42fa-a4c3-c9246174b723",
"name": "Remove App",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 3,
"position": [
1020,
-140
]
}
],
"pinData": {},
"connections": {
"Schedule Trigger": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "IF",
"type": "main",
"index": 0
}
]
]
},
"IF": {
"main": [
[
{
"node": "Remove App",
"type": "main",
"index": 0
}
],
[
{
"node": "Send to AWTRIX",
"type": "main",
"index": 0
}
]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1"
},
"versionId": "4ff27965-4d9a-40b0-9847-b35965d89b53",
"meta": {
"instanceId": "8b81ea78d527d12a34957ca03d49d26818777373c0787c47a3785e6b80081365"
},
"id": "YiiCn9G2CcbuJgIl",
"tags": []
}
-- Flow first published on February 15, 2025, last updated on February 16, 2025 at 11:27.