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:
rest:
- scan_interval: 60
resource: !secret server_address_with_user_n_pwd
sensor:
- name: "power hungry server stats"
json_attributes_path: "$.data.stats"
value_template: "OK"
json_attributes:
- "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?