Power consumption over one day via a REST sensor

I have got two servers, where I can get the current power consumption of them by a REST request.

I want to know, the power consumption of it over one day. My naive approach would be to do a REST request every minute and build the average value over the 24x60 requests. This should be the power consumption of the server over this given day.

how I would set up the REST sensor:

  - scan_interval: 60
    resource: !secret server_address_with_user_n_pwd
      - name: "power hungry server stats"
        json_attributes_path: "$.data.stats"
        value_template: "OK"
          - "power_draw"
          - "workers_total"
          - "workers_online"
          - "workers_offline"

This will collect the power consumption data and a bit more info.

But how can I do an average of all the values requested the current day?

If it’s actually Power (typically in Watts), you don’t need to average.
If you want to deduce Energy, i.e. the consumption (typically in kWh), from it, you’d use the Riemann integration

I just wanted to came back and complain about my own google foo, as I have found the statistics sensor later on, but this seems to be a much better fit!