Hey all! I have a sensor coming from a third party integration in HACS, the sensor gives current price in the state and also has a very heavy attributes list, current_day, next_day and previous_day and inside of each day there is a date, time (hourly) and price in cents/kwh. My aim is to extract the price data from current_day and be able to calculate min, max and mean to that I can dynamically have a peak, non-peak and valley price ranges to activate certain automation. The prices vary a lot from day to day to just to put a hard number is not a solution, also the times of the day of those peak, non-peak and valley values change from day to day depends on the market. Here below is an extract of the sensor:
sensor.greenely_prices
Greenely Prices
0.9557 current_day:
- date: '2022-09-27'
time: '00:00'
price: 0.1903
- date: '2022-09-27'
time: '01:00'
price: 0.1776
- date: '2022-09-27'
time: '02:00'
price: 0.173
- date: '2022-09-27'
time: '03:00'
price: 0.1772
- date: '2022-09-27'
time: '04:00'
price: 0.1956
- date: '2022-09-27'
time: '05:00'
price: 0.2213
- date: '2022-09-27'
time: '06:00'
price: 0.3377
- date: '2022-09-27'
time: '07:00'
price: 0.8117
- date: '2022-09-27'
time: '08:00'
price: 1.2318
- date: '2022-09-27'
time: '09:00'
price: 0.9557
- date: '2022-09-27'
time: '10:00'
price: 0.9467
- date: '2022-09-27'
time: '11:00'
price: 0.9394
- date: '2022-09-27'
time: '12:00'
price: 0.8479
- date: '2022-09-27'
time: '13:00'
price: 0.8315
- date: '2022-09-27'
time: '14:00'
price: 0.799
- date: '2022-09-27'
time: '15:00'
price: 0.7845
- date: '2022-09-27'
time: '16:00'
price: 0.7931
- date: '2022-09-27'
time: '17:00'
price: 0.8477
- date: '2022-09-27'
time: '18:00'
price: 0.9062
- date: '2022-09-27'
time: '19:00'
price: 0.8902
- date: '2022-09-27'
time: '20:00'
price: 0.8251
- date: '2022-09-27'
time: '21:00'
price: 0.7155
- date: '2022-09-27'
time: '22:00'
price: 0.6298
- date: '2022-09-27'
time: '23:00'
price: 0.4745
next_day:
previous_day:
- date: '2022-09-26'
time: '00:00'
price: 1.7081
- date: '2022-09-26'
time: '01:00'
price: 0.8278
- date: '2022-09-26'
time: '02:00'
price: 0.7292
- date: '2022-09-26'
time: '03:00'
price: 0.7662
- date: '2022-09-26'
time: '04:00'
price: 1.0803
- date: '2022-09-26'
time: '05:00'
price: 1.6392
- date: '2022-09-26'
time: '06:00'
price: 0.8039
- date: '2022-09-26'
time: '07:00'
price: 4.4522
- date: '2022-09-26'
time: '08:00'
price: 4.5084
- date: '2022-09-26'
time: '09:00'
price: 3.9825
- date: '2022-09-26'
time: '10:00'
price: 3.5488
- date: '2022-09-26'
time: '11:00'
price: 2.9712
- date: '2022-09-26'
time: '12:00'
price: 2.2267
- date: '2022-09-26'
time: '13:00'
price: 2.3193
- date: '2022-09-26'
time: '14:00'
price: 1.2784
- date: '2022-09-26'
time: '15:00'
price: 0.8442
- date: '2022-09-26'
time: '16:00'
price: 0.7036
- date: '2022-09-26'
time: '17:00'
price: 0.7691
- date: '2022-09-26'
time: '18:00'
price: 0.8726
- date: '2022-09-26'
time: '19:00'
price: 0.8685
- date: '2022-09-26'
time: '20:00'
price: 0.7307
- date: '2022-09-26'
time: '21:00'
price: 0.5791
- date: '2022-09-26'
time: '22:00'
price: 0.4316
- date: '2022-09-26'
time: '23:00'
price: 0.2564
unit_of_measurement: öre/kWh
icon: mdi:account-cash
friendly_name: Greenely Prices
Thank you in advance for any help, I do not code or work with json or yaml, though I try to learn…