How to get correct kWh/W values from Pulse

Your post is very helpful!

(if you’re referring to the code blocks - I changed a couple of areas. Look OK?)

it does look much better. I have added a bit more info and some pics to make it easier to work with

the scheduler looks like a neat way, but I hit quite a few issues - specifically in case it helps anyone get that working (to help them save the days of pain I went through!)

  1. schedulers not supported by the cloud version (I think you can replicate the input for this cron method from the emonpi to the cloud which is an advantage)
  2. overlap of schedules;initially I setup two schedules peak and offpeak, but there was an overlap on the hour and both sections of processing resulted in a doubling up (vertical line).
  3. Then I changed the schedules to end one minute before, but it misses some data (only one minute, but I didn’t like it)
  4. then I changed to a combination of if schedule zero and if !schedule zero - this was a headache to work with and only worked with one type of schedule (e.g. peak or offpeak) so very complicated for extra schedules
  5. at that point I had two feeds - combining them was a nightmare - I tried virtual feeds but it completely failed (hundreds of errors when attempting to graph)
  6. then I added a bit of logic to at the end of each schedule/!schedule to add the other current running total and log to a combined cost graph. first this added the incremental so I had to add an accumulator- this still resulted in vertical lines at crossover so i abandoned and searched for a better way.
  7. then I tried the cron method which is elegant in its simplicity in providing a feed with the current cost and a method of filtering on/off-peak and it worked first time pb66 is a genius! what I particularly like is that there is no need to add together two feeds as all three are calculated separately and so can be used (if started at the same time) to verify that its working as off-peak + peak should equal the combined peak graph which you can see from the uploaded graph/image.
1 Like

Thx for the write-up. One thing threw me off though. I got an error when rebooting the device and after a closer look at this bit of code… there is a space before “off-peak” which shouldn’t be there :wink:

1 Like