It looks like you are using an older version of Seasons (before it was
parameterized). The variable $archive[1] is the result of evaluating $day,
which makes it an instance of weewx.tags.TimespanBinder, built using
default values in the initializer. At this point, it's too late to ask it
to be built using a custom value for data_binding.

What to do? You could introduce a new set of timespans, this time including
your custom binding. It would look like (NOT TESTED):

#set $archive_data = [('day', $day, $day(data_binding='rpi24-binding')),
('week', $week, $week(data_binding='rpi24-binding')), ('month', $month,
$month(data_binding='rpi24-binding')), ('year', $year,
$year(data_binding='rpi24-binding')), ('rainyear', $rainyear,
$rainyear(data_binding='rpi24-binding'))]

then use that when necessary:

    <td class="data new_row hilo_$archive[0]">
      <span title="$archive[1].rainRate.maxtime">
        $archive[2].rainRate.max.format(add_label=False)</span>
     </td>

Another approach would be to update to the parameterized version of
Seasons, which does its evaluation of TimespanBinder later, allowing it to
be modified in a more straightforward way:

     <td class="data new_row hilo_$timespan">
       <span title="$getVar('%s.%s' % ($timespan, $x)).maxtime">
       $getVar('%s.%s(data_binding='rpi24-binding')' % ($timespan,
$x)).max.format(add_label=False)</span>
     </td>

-tk


On Tue, Jul 5, 2022 at 2:57 PM 'Rainer Lang' via weewx-user <
weewx-user@googlegroups.com> wrote:

> After some more digging I have advanced:
>
> my 2nd issue, that the monthly and weekly data is not shown seems to be
> solved:
> while in the imagegenerator the week/month means 7 days back and 30 days
> back from the current date,
> $week and $month seem to mean the calender week and calender month - a few
> tests with fake rain data in the database confirmed that
>
> remains the issue how to show the values from the remote database in the
> High/Low portion of the High/Low table
>
> at http://www.weewx.com/docs/customizing.htm#Using_multiple_bindings
> the example goes:
>
> <table>
>   <tr>
>     <td class="stats_label">Inside Temperature, Vantage</td>
>     <td class="stats_data">$current.inTemp</td>
>   </tr>
>   <tr>
>     <td class="stats_label">Inside Temperature, WMR100</td>
>     <td 
> class="stats_data">$latest*($data_binding='wmr100_binding')*.inTemp</td>
>   </tr>
> </table>
>
>
> this translated into my hilo.inc code
> <tr>
>         <td class="label">$obs.label.rain</td>
>         #for $archive in $archive_data
>         <td class="data new_row hilo_$archive[0]">
>           $archive[1].rain.sum.format(add_label=False)</td>
>         #end for
>         <td class="units">$unit.label.rain</td>
>  </tr>
>  <tr>
>         <td class="label">$obs.label.rainRate</td>
>         #for $archive in $archive_data
>         <td class="data new_row hilo_$archive[0]">
>           <span title="$archive[1].rainRate.maxtime">
>             $archive[1].rainRate.max.format(add_label=False)</span>
>         </td>
>         #end for
>         <td class="units">$unit.label.rainRate</td>
> </tr>
>
> should in my understanding then be:
>
> <td class="data new_row hilo_$archive[0]">
> $archive[1]*($data_binding='rpi24-binding')*
> .rain.sum.format(add_label=False)</td>
> resp.
>
> <td class="data new_row hilo_$archive[0]">
>   <span title="$archive[1].rainRate.maxtime">
>     $archive[1]*($data_binding='rpi24-binding')*.
> rainRate.max.format(add_label=False)</span>
>  </td>
>
> where "rpi24-binding" is my database binding of the remote database
>
> however, this produces a Cheetah Syntax error
>
> Jul  5 23:26:15 raspberrypi weewx[31166] ERROR weewx.cheetahgenerator:
> Evaluation of template /etc/weewx/skins/Seasons/index.html.tmpl failed with
> exception '<class 'SyntaxError'>'
> Jul  5 23:26:15 raspberrypi weewx[31166] ERROR weewx.cheetahgenerator:
> **** Ignoring template /etc/weewx/skins/Seasons/index.html.tmpl
> Jul  5 23:26:15 raspberrypi weewx[31166] ERROR weewx.cheetahgenerator:
> **** Reason: keyword can't be an expression (<string>, line 1)
> Jul  5 23:26:15 raspberrypi weewx[31166] ERROR weewx.cheetahgenerator:
> ****  Traceback (most recent call last):
> Jul  5 23:26:15 raspberrypi weewx[31166] ERROR weewx.cheetahgenerator:
> ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 348, in
> generate
> Jul  5 23:26:15 raspberrypi weewx[31166] ERROR weewx.cheetahgenerator:
> ****      unicode_string = compiled_template.respond()
> Jul  5 23:26:15 raspberrypi weewx[31166] ERROR weewx.cheetahgenerator:
> ****    File
> "cheetah__etc_weewx_skins_Seasons_index_html_tmpl_1657056374_3328836_74907.py",
> line 287, in respond
> Jul  5 23:26:15 raspberrypi weewx[31166] ERROR weewx.cheetahgenerator:
> ****    File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line
> 1707, in _handleCheetahInclude
> Jul  5 23:26:15 raspberrypi weewx[31166] ERROR weewx.cheetahgenerator:
> ****      self._CHEETAH__cheetahIncludes[_includeID].respond(trans)
> Jul  5 23:26:15 raspberrypi weewx[31166] ERROR weewx.cheetahgenerator:
> ****    File
> "cheetah__etc_weewx_skins_Seasons_hilo_inc_1657056374_7626543_30080.py",
> line 1744, in respond
> Jul  5 23:26:15 raspberrypi weewx[31166] ERROR weewx.cheetahgenerator:
> ****    File
> "cheetah__etc_weewx_skins_Seasons_hilo_inc_1657056374_7626543_30080.py",
> line 386, in __errorCatcher46
> Jul  5 23:26:15 raspberrypi weewx[31166] ERROR weewx.cheetahgenerator:
> ****    File "<string>", line 1
> Jul  5 23:26:15 raspberrypi weewx[31166] ERROR weewx.cheetahgenerator:
> ****  SyntaxError: keyword can't be an expression
>
> what am I missing ?? - it's definitely the
> *($data_binding='rpi24-binding')* which causes the error - when I remove
> it, no error is shown - but then I don't get my data from the remote
> database ...
>
>
> Am 05.07.2022 um 12:32 schrieb Rainer Lang:
>
> the background which made me run into the issue(s) which I couldn't find a
> solution for yet -
> nothing found in the WiKi either
>
> 2 Ecowitt stations - one has the WS90 and a WH40 rain gauge connected, one
> the rain gauge from the WS69 array
> 2 weewx instances - one receiving the WS90/WH40 data, one receiving the
> WS69 data
> the instances run on different servers, but that was only an additional
> challenge to figure out where to put the data_binding information - maybe
> not yet completely solved - we'll see later
>
> running weewx 4.8.0 - but with my old skin.conf - not (yet) with the
> skin.conf which comes with the 4.8.0 install
>
> I have added the following entries to my skin.conf - and the plots of all
> three are properly shown - as desired
> (for that I repurposed the wsview_extended database field "hail" for the
> WS90 piezo rain)
>
> ####### excerpt skin.conf start ##########
>
>         [[[dayrain]]]
>             # Make sure the y-axis increment is at least 0.02 for the rain
> plot
>             yscale = None, None, 0.02
>             plot_type = bar
>             [[[[rain]]]]
>                 aggregate_type = sum
>                 aggregate_interval = 3600
>                 label = Rain (hourly total) (WH40)
>         [[[dayrain2]]]
>             # Make sure the y-axis increment is at least 0.02 for the rain
> plot
>             yscale = None, None, 0.02
>             plot_type = bar
>             fill_color = "#ff4500"
>             [[[[hail]]]]              #WS90 piezo rain
>                 aggregate_type = sum
>                 aggregate_interval = 3600
>                 label = Rain (hourly total) (WS90)
>         [[[dayrain3]]]
>             # Make sure the y-axis increment is at least 0.02 for the rain
> plot
>            data_binding = rpi24-binding
>             yscale = None, None, 0.02
>             plot_type = bar
>             fill_color = "#32cd32"
>             [[[[rain]]]]              #WH65 rain
>                 aggregate_type = sum
>                 aggregate_interval = 3600
>                 label = Rain (hourly total) (WS69)
> ############ excerpt skin.conf end ##############
>
> HOWEVER, I couldn't manage to get the data from the external database
> [[[dayrain3]] into the current data table - nor into the High/Low table
>
> *I couldn't figure out how to address the external database field in
> current.inc and in hilo.inc to be shown in the table here.*
>
> Any advise how to manage that highly appreciated !
>
>
> SECOND ISSUE: into which I ran while experimenting with the hilo.inc file
> to get my values displayed
>
> I found that even though the syntax seems to be correct, I only get the
> current (that's current.inc) data displayed (for "rain" and "hail")
> but *I wouldn't get the weekly and monthly rain sums displayed - only the
> yearly*.😮 - the others simply remain "0.0"
> (it does the same in my other weewx installations too !)
>
> excerpt below - what's wrong here and, also, referring back to the first
> question, how would the code look like for the external database field
> "rain" to be inserted to be displayed in that table ?
>
> ########### excerpt hilo.inc start ###########
>
> #set $archive_data = [('day', $day), ('week', $week), ('month', $month),
> ('year', $year), ('rainyear', $rainyear)]
>
>
> <div id='hilo_widget' class="widget">
>   <div class="widget_title">
>     <a href="statistics.html">High/Low</a>
>     <a class="widget_control"
>       onclick="toggle_widget('hilo')">&diams;</a>
>   </div>
>
>   <div class="widget_contents">
>   <table>
>     <tbody>
> ....................
>
>  <tr>
>         <td class="label">$obs.label.rain</td>
>         #for $archive in $archive_data
>         <td class="data new_row hilo_$archive[0]">
>           $archive[1].rain.sum.format(add_label=False)</td>
>         #end for
>         <td class="units">$unit.label.rain</td>
>       </tr>
>       <tr>
>         <td class="label">$obs.label.rainRate</td>
>         #for $archive in $archive_data
>         <td class="data new_row hilo_$archive[0]">
>           <span title="$archive[1].rainRate.maxtime">
>             $archive[1].rainRate.max.format(add_label=False)</span>
>         </td>
>         #end for
>         <td class="units">$unit.label.rainRate</td>
>       </tr>
>       <tr>
>         <td class="label">$obs.label.piezorain</td>
>         #for $archive in $archive_data
>         <td class="data new_row hilo_$archive[0]">
>           $archive[1].hail.sum.format(add_label=False)</td>
>         #end for
>         <td class="units">$unit.label.rain</td>
>       </tr>
>       <tr>
>         <td class="label">$obs.label.piezorainRate</td>
>         #for $archive in $archive_data
>         <td class="data new_row hilo_$archive[0]">
>           <span title="$archive[1].hailRate.maxtime">
>             $archive[1].hailRate.max.format(add_label=False)</span>
>         </td>
>         #end for
>           <td class="units">$unit.label.rainRate</td>
>       </tr>
> .................
>
> ############ excedrpt hilo.inc end #############
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/d083069b-51b0-7201-2e16-3e7f24422410%40gmail.com
> <https://groups.google.com/d/msgid/weewx-user/d083069b-51b0-7201-2e16-3e7f24422410%40gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zECE0%3D6G%2BaC%3D%3D-6nEVp0k3V1aP4uD6yq-o0m%2BfFRYNE-Rw%40mail.gmail.com.

Reply via email to