1. This may be resulting from confusion of what the timestamps represent.
In weeWX, all data in a time period is timestamped by the *end* of that
period. As an example, data for a 5 minute archive period with a timestamp
0950 Tuesday, is the data from (but not including) 0945 up to *and
including* 0950.

That's for a single archive record. Now think about aggregations over a
day. Take a day like Tuesday. The tag $day.outTemp.avg is the average
temperature for Tuesday, which is the average temperature for times *greater
than* midnight Tuesday through times less than *or equal to *midnight
Wednesday. So, $day.outTemp.last is the temperature for the very last
record in that aggregation interval, which is going to be timestamped
midnight Wednesday. That is, it represents the temperature from 2355
Tuesday to 0000 Wednesday. By contrast, $day.dateTime is the time of the
*beginning* of that period, which is midnight Tuesday.

If $day.electric_ed.last is the data for the following day (Wednesday, in
our example), then it is being timestamped wrong.

2. There is no tag for something like that. You would have to keep your own
running total, or write a search list extension.

3. Documented in the Customizing Guide
<http://weewx.com/docs/customizing.htm#formatting_options>. Timestamps
use strftime
formatting
<https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior>
.

Putting it all together, and it should look something like (NOT TESTED):

#set $week_total=0
#for $day in $week.days
     <p>The energy production for $day.dateTime.format("%A") is
$day.electric_ed.last</p>
#set $week_total += $day.electric_ed.last.raw
#end for
<p>Energy production for the week: $week_total</p>

Note that $week_total will be just a raw number. It would be up to you to
provide any formatting.

-tk

On Sat, Mar 31, 2018 at 5:31 AM, Marco Biner <marco.bi...@rhone.ch> wrote:

> Hi Tom
> thank you for the fast reply.
> I added your code to my report, but it summarisez all stored values from a
> day, not the last value.
> I have to clarify that the logger of the solar panel gives everytime it is
> polled the sum of the daily solar production.
> The modification of your code, like this:
>
> #for $day in $week.days
> <p>The energy production for $day.dateTime is $day.electric_ed.sum</p>
>
>      <p>The energy production for $day.dateTime is
> $day.electric_ed.last</p>
>
> #end for
>
> gives the following output:
>
> The energy production for 00:00 is 2777070.68 Wh
>
> The energy production for 00:00 is 4105.47 Wh
>
> The energy production for 00:00 is 1814408.75 Wh
>
> The energy production for 00:00 is 2380.86 Wh
>
> The energy production for 00:00 is 2188879.96 Wh
>
> The energy production for 00:00 is 3105.47 Wh
>
> The energy production for 00:00 is 2349953.71 Wh
>
> The energy production for 00:00 is 3298.83 Wh
>
> The energy production for 00:00 is 3153128.84 Wh
>
> The energy production for 00:00 is 4515.62 Wh
>
> The energy production for 00:00 is 112733.52 Wh
>
> The energy production for 00:00 is 1305.66 Wh
>
> The energy production for 00:00 is N/A
>
> The energy production for 00:00 is N/A
>
>
> there I have two issues:
>
> 1. for today I get N/A and all other results are one day shiftet, means
> the value of 1305.66 is actual production of today,  4515.62 is from
> yesterday
>
> 2. I need the sum for the last seven days, which is the sum of
> $day.electric_ed.last
>
> 3. Question by the way, why is $day.dateTime alway 00:00
>
> Kind regards
> Marco
>
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to weewx-user+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to