Webhooks - entity update help

Hello community,
I really need some help/advice on this problem. I have a Webhook call from platerecognizer containing the following data:

{"hook": {"target": "XXX", "id": 906, "event": "image.done"}, "data": {"processing_time": 28.196, "results": [{"box": {"xmin": 176, "ymin": 245, "xmax": 251, "ymax": 273}, "plate": "as6772", "region": {"code": "dk", "score": 0.046}, "score": 0.773, "candidates": [{"score": 0.773, "plate": "as6772"}, {"score": 0.705, "plate": "as67721"}, {"score": 0.676, "plate": "as3772"}, {"score": 0.65, "plate": "as6722"}, {"score": 0.622, "plate": "as37721"}, {"score": 0.6, "plate": "as67221"}, {"score": 0.553, "plate": "as3722"}, {"score": 0.517, "plate": "as37221"}], "dscore": 0.748, "vehicle": {"score": 0.605, "type": "Sedan", "box": {"xmin": 12, "ymin": 29, "xmax": 313, "ymax": 323}}}], "filename": "0702_MTBVi_upload.jpg", "version": 1, "camera_id": null, "timestamp": "2023-11-14T07:02:01.213Z"}}

I am attempting to extract information from the first spotted license plate and subsequently update a sensor with the information “plate”: “XXX”.

Next, I am attempting to save the image attached in the webhooks locally to a folder in Home Assistant.

I can successfully get Home Assistant to update an input_text sensor with a pre-defined value using the following automation. However, I am encountering difficulties in adapting it to work with the plate data received from the webhook:

  alias: "Opdater Anpr Sensor med Webhook"
    platform: webhook
    webhook_id: "XXX"
    - service: input_text.set_value
        entity_id: input_text.plate_value
        value: "XXXX"

Your guidance on how to incorporate the dynamic plate data into this automation would be greatly appreciated.

I’ve not worked with webhook triggers before, but looking at the docs, you should be able to do something like this:

         value: "{{ trigger.json['data']['results'][0]['plate'] }}"

Thank you it actually did work. Thank you so much! :slight_smile: Do you have any idea on how to process the attached image in the call?

I’m trying to do something similar but sending the plate number as a push notification. Doesn’t seem to be working though…

  - service: notify.mobile_app_adams_iphone
     value: "{{ trigger.json['data']['results'][0]['plate'] }}"