First I try to multiply the hourly electricity rate with the consumption.
At the changeover node-red changes the rate by changing the data
So, for example, at 8:00 a.m. I’ll have the changeover to a type 2 schedule that won’t change for several hours.
This is the value I’d like to multiply all my consumption data with.
the chronological reference is potentially problematic and I hope it can be resolved
But for the moment I can’t.
In a second phase, I’d like to add up these values according to a window (hour, day, month), maybe do some cumulation, etc.
@Yohan This one is going to be a bit tricky. I think you’re going to have to define a function that, based on a time value, looks up the tarif to apply. Joining on time won’t work here because you the timestamps in your data don’t match the timestamp in your tarif data.
How consistent is the tarif data? Does it follow a set schedule every day? Does the tarif amount change each day? For example from 8am - 8pm on Monday, the tarif is .25, but on Tuesdays it’s .30?
@scott
There’s a difference between weekends and weekdays, and there’s also a difference in working hours during the week. Nighttime is not the same as daytime, for example.
edit :
Can we create If functions in the Flux script?
For example, this is what I want to do with occupancy. If present then taken into account, otherwise not.
The same goes for rates. If it’s an off-peak rate, then we calculate the cost, otherwise not.
Bucket → Category (Energy, Temperatures, etc) → Load concerned/Location → Tags (Like “Tarif” (in this tag you can find off-peak time, peak time), or “Occupancy” (in this one : Presence, Absence).