Thanks for the really helpful tutorial and tester! I’m having trouble getting my response template to work. When I don’t use a response template, my photon receives the webhook response data, but in up to 10 chunks that are difficult to parse. I only want a little bit of the data, so I created a template, but now my photon gets no data from the subscription to the webhook.
Here is the template that I’m using
{{#.}} {{name}}~{{state}} {{/.}}
Here is the JSON that I get back from the webhook without a template:
[
{
"id": "33084",
"name": "A-7",
"type": "Ultimaker 2 Extended",
"workgroups": [
24
],
"state": "idle",
"temps": [
24.6,
25.3
],
"target_temps": [
0,
0
],
"percent": 0
},
{
"id": "33330",
"name": "A-6",
"type": "Ultimaker 2 Extended",
"workgroups": [
24
],
"state": "idle",
"temps": [
24.3,
26.9
],
"target_temps": [
0,
0
],
"percent": 0
},
{
"id": "34246",
"name": "A-8",
"type": "Ultimaker 2 Extended",
"workgroups": [
24
],
"state": "connecting",
"temps": [
36.9,
26.18
],
"target_temps": [
70,
0
],
"percent": 0
},
{
"id": "34274",
"name": "A-9",
"type": "Ultimaker 2 Extended",
"workgroups": [
24
],
"state": "idle",
"temps": [
28.8,
28.7
],
"target_temps": [
0,
0
],
"percent": 0
},
{
"id": "34275",
"name": "A-11",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "idle",
"temps": [
26.5,
27.8
],
"target_temps": [
0,
0
],
"percent": 0
},
{
"id": "34276",
"name": "B-2",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
69.1,
229.8
],
"target_temps": [
70,
230
],
"percent": 97
},
{
"id": "34277",
"name": "B-3",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
70,
239.7
],
"target_temps": [
70,
240
],
"percent": 0
},
{
"id": "34278",
"name": "B-4",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
70.9,
237.2
],
"target_temps": [
70,
237
],
"percent": 20
},
{
"id": "34281",
"name": "C-2",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
70.2,
227.8
],
"target_temps": [
70,
230
],
"percent": 90
},
{
"id": "34282",
"name": "C-3",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "idle",
"temps": [
22.2,
24.6
],
"target_temps": [
0,
0
],
"percent": 0
},
{
"id": "34283",
"name": "C-4",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
71.4,
239.3
],
"target_temps": [
70,
240
],
"percent": 6
},
{
"id": "34284",
"name": "C-5 ",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
69.8,
237.2
],
"target_temps": [
70,
237
],
"percent": 11
},
{
"id": "34285",
"name": "A-5",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "idle",
"temps": [
26.5,
78.1
],
"target_temps": [
0,
0
],
"percent": 0
},
{
"id": "34286",
"name": "A-14",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
89.7,
249.5
],
"target_temps": [
90,
250
],
"percent": 0
},
{
"id": "34287",
"name": "A-13",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
69.7,
230.5
],
"target_temps": [
70,
230
],
"percent": 56
},
{
"id": "34288",
"name": "A-12",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "idle",
"temps": [
49.6,
39.6
],
"target_temps": [
0,
0
],
"percent": 0
},
{
"id": "34313",
"name": "A-10",
"type": "Ultimaker 2 Extended",
"workgroups": [
24
],
"state": "printing",
"temps": [
69.8,
237
],
"target_temps": [
70,
237
],
"percent": 72
},
{
"id": "37198",
"name": "B-10",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
69.7,
230.7
],
"target_temps": [
70,
230
],
"percent": 87
},
{
"id": "37199",
"name": "B-9",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
69.7,
229
],
"target_temps": [
70,
230
],
"percent": 48
},
{
"id": "37200",
"name": "A-4",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "idle",
"temps": [
17.5,
35.6
],
"target_temps": [
0,
0
],
"percent": 0
},
{
"id": "37201",
"name": "A-3",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
72.2,
239.2
],
"target_temps": [
70,
240
],
"percent": 14
},
{
"id": "37202",
"name": "A-1",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
71.7,
235.8
],
"target_temps": [
70,
237
],
"percent": 71
},
{
"id": "37203",
"name": "B-1",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
69.8,
230.2
],
"target_temps": [
70,
230
],
"percent": 81
},
{
"id": "37204",
"name": "B-5",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
70.6,
229.7
],
"target_temps": [
70,
230
],
"percent": 12
},
{
"id": "37205",
"name": "A-2",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "offline",
"temps": [
63.9,
129.5
],
"target_temps": [
0,
260
],
"percent": 0
},
{
"id": "37211",
"name": "B-13",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
70.2,
230
],
"target_temps": [
70,
230
],
"percent": 12
},
{
"id": "37212",
"name": "B-12",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
69.7,
230
],
"target_temps": [
70,
230
],
"percent": 53
},
{
"id": "37220",
"name": "B-11",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
69.1,
229.7
],
"target_temps": [
70,
230
],
"percent": 51
},
{
"id": "37222",
"name": "C-11",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
68.8,
229.2
],
"target_temps": [
70,
230
],
"percent": 13
},
{
"id": "37223",
"name": "C-12",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
68.3,
231
],
"target_temps": [
70,
230
],
"percent": 18
},
{
"id": "37225",
"name": "C-14",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
71.1,
230.3
],
"target_temps": [
70,
230
],
"percent": 78
},
{
"id": "37262",
"name": "B-8",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
68.4,
229.5
],
"target_temps": [
70,
230
],
"percent": 3
},
{
"id": "37303",
"name": "B-7",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
69.5,
229.8
],
"target_temps": [
70,
230
],
"percent": 52
},
{
"id": "37304",
"name": "B-6",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
69.4,
230.5
],
"target_temps": [
70,
230
],
"percent": 89
},
{
"id": "38742",
"name": "C-15",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "printing",
"temps": [
69.1,
240.5
],
"target_temps": [
70,
240
],
"percent": 76
},
{
"id": "39875",
"name": "B-14",
"type": "Ultimaker 2",
"workgroups": [
24
],
"state": "idle",
"temps": [
50.9,
37.2
],
"target_temps": [
0,
0
],
"percent": 0
}
]
Where am I going wrong here? This template returns exactly what I want in the mustache template.