I am having the same issue. I have read the mqtt sensor documentation but my mqtt message is more complex than the examples. I would like to create a sensor that reports the confidence value of a match in the attached message.
{
"id": "1661617146.021728-agmwcn",
"duration": 0.6,
"timestamp": "2022-08-27T16:19:32.873Z",
"attempts": 17,
"camera": "tv_cam",
"zones": [
"main"
],
"misses": [
{
"name": "kate",
"confidence": 94.15,
"match": false,
"box": {
"top": 118,
"left": 187,
"width": 25,
"height": 33
},
"checks": [
"box area too low: 825 < 10000"
],
"type": "latest",
"duration": 0.61,
"detector": "compreface",
"filename": "a11d36d5-7670-4435-94f1-ec52234e607d.jpg",
"base64": null
},
{
"name": "jane",
"confidence": 95.74,
"match": false,
"box": {
"top": 119,
"left": 185,
"width": 29,
"height": 33
},
"checks": [
"box area too low: 957 < 10000"
],
"type": "latest",
"duration": 0.67,
"detector": "compreface",
"filename": "cffa9055-41c9-400f-a039-3409af38d6e6.jpg",
"base64": null
},
{
"name": "raiden",
"confidence": 41.86,
"match": false,
"box": {
"top": 101,
"left": 186,
"width": 29,
"height": 28
},
"checks": [
"confidence too low: 41.86 < 75",
"box area too low: 812 < 10000"
],
"type": "latest",
"duration": 0.67,
"detector": "compreface",
"filename": "cffa9055-41c9-400f-a039-3409af38d6e6.jpg",
"base64": null
},
{
"name": "joe",
"confidence": 95.36,
"match": false,
"box": {
"top": 45,
"left": 113,
"width": 75,
"height": 86
},
"checks": [
"box area too low: 6450 < 10000"
],
"type": "snapshot",
"duration": 0.75,
"detector": "compreface",
"filename": "fe6b0044-8478-45d6-881f-7b141676de35.jpg",
"base64": null
}
],
"match": {
"name": "joe",
"confidence": 97.06,
"match": true,
"box": {
"top": 52,
"left": 131,
"width": 93,
"height": 112
},
"type": "snapshot",
"duration": 0.18,
"detector": "compreface",
"filename": "29141dd6-8d09-4660-a955-6dec80093b6e.jpg",
"base64": null
}
}
My attempt that doesn’t work is
mqtt:
sensor:
- name: "joe_face"
state_topic: 'double-take/matches/joe'
json_attributes_topic: 'double-take/matches/joe'
value_template: '{{ value_json.confidence }}'