Hello, is it possible to sum up only the last value per day for the whole month?
I would like to sum up the electricity costs per day at the end of the month to save the costs per month in an extra item.
val ZonedDateTime firstDayThisMonth = now.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0).withNano(0)
var MonthlyCosts = Oh_Item_Power_Costs_Daily.sumSince(firstDayThisMonth)/100
However, all values that have been saved for the daily values are totaled. This means, for example, that €17 is calculated instead of €5.
The electricity price is dynamic via Tibber and I cannot simply multiply the consumption by a fixed price.
I have the last value of the day, but how do I retrieve it in the rule or am I on the wrong track here and have to do it differently?
val firstDayThisMonth = now.withDayOfMonth(1).truncatedTo(ChronoUnit::DAYS)
You’d need to save (persist) the actual costs (not just the cost per kwh) as the price changed (multiply price by the energy consumption since last price change).
You could even save the costs per minute or per 30 minute, however granular you’d like.
Then you could total / sum this actual cost as needed
The chart does not do it for the month, but per day. It returns the last value for the respective day. And for the month, I would only have to add up these last values.
The suggestions are okay, but then somehow “shot from behind through the chest into the eye to get to the target”
It would be easier if someone integrated the channel for retrieving the monthly values into the Tibber Binding.