Storing Webhook Data

Hi everyone,

I’m trying to collect data from a sensor that is periodically transmitted via a webhook. I have created an automation to link the webhook to, but I am unsure of the best way to store the data. It feels like I should be using a “Webhook Sensor” rather than an automation, but there isn’t one, as far as I am aware.

My current approach is to use input numbers ( yet to get it working ), but is there a better way to achieve what I am after? Can I use a template sensor somehow?

# in automation.yaml
- alias: brew_brewfather_wh
  trigger:
    platform: webhook
    webhook_id: wh_ispindel
  action:
    - service: input_number.set_value
      data_template:
        entity_id: input_number.brew_ispindel_temp
        value: "{{ trigger.data.temp }}"

Thanks in advance for any help!
Cheers,
Michael.

I’d like to chime in on this one - so far this is also my way of doing it (Sonnenbatterie with APIv2 / Webhook).
As good as it works so far, there might be a better way :slight_smile:
Thanks!

Thanks for the link, great to look over and check it out.
It does seem to work - but I also have to admit that a sensor rather an input_number makes much more sense.

I may have a look at templating a sensor to do it. I’m pretty new to this, but will the rest platform work to receive webhook data? I suspect not.

Did anyone find a better solution to this except for using input variables?

How about use the file notifier to store the sensor values to a text file and the re-read it using the file sensor?

I might give this a try since I would really prefer to get the data from a webhook (also sonnenBatterie) instead of polling the API