neoground / neowx-material

Revamp WeeWX with Neowx-Material, a modern Material Design skin offering a sleek, responsive UI, captivating graphs & advanced features.
https://neoground.com/projects/neowx-material
MIT License
53 stars 30 forks source link

Feature/history report #54

Open seehase opened 2 years ago

seehase commented 2 years ago

Added the history report from https://github.com/ngulden/niculskin/ and took also some version updates from dependabot

seehase commented 2 years ago

Example can be seen here https://solar.seehausen.org/weewx/history.html

uktricky commented 2 years ago

Nice add on - how about wind? Average and max speeds?

seehase commented 2 years ago

Nice add on - how about wind? Average and max speeds?

Hi @uktricky I added wind tables... please have a look https://solar.seehausen.org/weewx/history.html grafik

uktricky commented 2 years ago

Looks good, I've just gotten around to looking this again, work always getting in the way! I've created a dev version of my current NeoWX-Material installation so I can have a play in dev before I risk breaking my live site.

Might be a daft question but I am not an expert when using GitHub by any means! How do I get your history pages into my version? Would you mind sending me some guidance? Thanks in advance...

seehase commented 2 years ago

Looks good, I've just gotten around to looking this again, work always getting in the way! I've created a dev version of my current NeoWX-Material installation so I can have a play in dev before I risk breaking my live site.

Might be a daft question but I am not an expert when using GitHub by any means! How do I get your history pages into my version? Would you mind sending me some guidance? Thanks in advance...

How to get History Reports download the files from https://github.com/seehase/neowx-material/archive/refs/heads/feature/history-report.zip

Extract ZIP file and copy these files

src/footer.inc
src/header.inc
src/history.html.tmpl
src/skin.conf

to folder /etc/weewx/skins/neowx-material

Copy bin/user/historygenerator.py

to /usr/share/weewx/user

then restart weewx and you should see the History Report after the next generation run

cbirkenbeul commented 2 years ago

@seehase Is this a render issue on Safari? Or a small bug?

Bildschirmfoto 2022-07-25 um 12 30 54
seehausen commented 2 years ago

@seehase Is this a render issue on Safari? Or a small bug? This depends on the screen resolution I'm not a Frontend expert, probably this can be optimised ;-), maybe you can help? but the colors looks different to what I have

cbirkenbeul commented 2 years ago

Yeah, it seems it like a resolution thing. I'm on a newer MacBook with pretty big resolution. If I shrink the browser window, it seems ok.

uktricky commented 2 years ago

Looks good, I've just gotten around to looking this again, work always getting in the way! I've created a dev version of my current NeoWX-Material installation so I can have a play in dev before I risk breaking my live site. Might be a daft question but I am not an expert when using GitHub by any means! How do I get your history pages into my version? Would you mind sending me some guidance? Thanks in advance...

How to get History Reports download the files from https://github.com/seehase/neowx-material/archive/refs/heads/feature/history-report.zip

Extract ZIP file and copy these files

src/footer.inc
src/header.inc
src/history.html.tmpl
src/skin.conf

to folder /etc/weewx/skins/neowx-material

Copy bin/user/historygenerator.py

to /usr/share/weewx/user

then restart weewx and you should see the History Report after the next generation run

Many thanks - I did find the files you'd changed and hacked around so got it working, had to amend the skin.conf as I'd changed the original from the original release. Thanks again for pulling this feature together be good to see it merged into the release version.

Re. the other posts on this thread, I'm running on Safari also but again larger resolution.

Screenshot 2022-07-26 at 19 52 50
cbirkenbeul commented 2 years ago

So I tried it a third time. This time I deleted the "old" neowx-material folder and used it from the uploaded zip file.

Still the same issues. Rendering is off and just the first value got a css background. The rendering is on @seehase Site off too. So this does not seems a problem on my side directly.

There is also a thread on the wetterstationsforum.info forum with a small manual bit with slightly other instructions. I also tried this, but without success.

seehausen commented 2 years ago

So I tried it a third time. This time I deleted the "old" neowx-material folder and used it from the uploaded zip file.

Still the same issues. Rendering is off and just the first value got a css background. The rendering is on @seehase Site off too. So this does not seems a problem on my side directly.

There is also a thread on the wetterstationsforum.info forum with a small manual bit with slightly other instructions. I also tried this, but without success.

I know, it's because of the responsive design, and breakpoints for specific screen resolutions. I'll try to fix it, or just prevent switching

seehase commented 2 years ago

So I tried it a third time. This time I deleted the "old" neowx-material folder and used it from the uploaded zip file.

Still the same issues. Rendering is off and just the first value got a css background. The rendering is on @seehase Site off too. So this does not seems a problem on my side directly.

There is also a thread on the wetterstationsforum.info forum with a small manual bit with slightly other instructions. I also tried this, but without success.

I fixed it somehow. not yet perfect but it does not break anymore

just take the history.html.tmpl file from last commit... Maybe we find some Bootstrap guru who can solve it finally

ferretstew commented 2 years ago

Thank you @seehase for this improvement. My use of US units seems to be causing trouble, particularly with parsing rainfall data which is stored in the the non-integer #.## format. When I first merged your code and added the [HistoryReport] section to skins conf, I used #.## formatted values for minvalues and maxvalues under the [[rain]] subsection. For example:

`#minvalues = 0.00, 0.10, 0.25, 0.50, 0.75, 1.00 # Override default temperature colour scheme with rain specific scale 360

maxvalues = 0.10, 0.25, 0.50, 0.70, 1.00, 10.00`

When I ran wee_reports using those values, I received this error:

pi@weewx: /etc/weewx/skins/neowx-material $ sudo wee_reports Using configuration file /etc/weewx/weewx.conf Generating for all time Traceback (most recent call last): File "/usr/share/weewx/weewx/reportengine.py", line 197, in run obj.start() File "/usr/share/weewx/weewx/reportengine.py", line 385, in start self.run() File "/usr/share/weewx/weewx/cheetahgenerator.py", line 169, in run ngen = self.generate(gen_dict[section_name], section_name, self.gen_ts) File "/usr/share/weewx/weewx/cheetahgenerator.py", line 229, in generate ngen += self.generate(section[subsection], subsection, gen_ts) File "/usr/share/weewx/weewx/cheetahgenerator.py", line 229, in generate ngen += self.generate(section[subsection], subsection, gen_ts) File "/usr/share/weewx/weewx/cheetahgenerator.py", line 321, in generate searchList = self._getSearchList(encoding, timespan, File "/usr/share/weewx/weewx/cheetahgenerator.py", line 415, in _getSearchList search_list += obj.get_extension_list(timespan, db_lookup) File "/usr/share/weewx/user/historygenerator.py", line 171, in get_extension_list self.search_list_extension[table_name] = self._statsHTMLTable(table_options, table_stats, table_name, File "/usr/share/weewx/user/historygenerator.py", line 291, in _statsHTMLTable htmlLine += (' ' * 12) + self._colorCell(value[0], format_string, bgColours) File "/usr/share/weewx/user/historygenerator.py", line 317, in _colorCell if (value >= int(c[0])) and (value <= int(c[1])): ValueError: invalid literal for int() with base 10: '0.00'

It seemed the code was not handling the floats, so I modified skins.conf to use integers for minvalues and maxvalues as a temporary workaround and ran wee_reports again. The config file modification addressed the original error, but this time I received a different error:

pi@weewx: /usr/share/weewx/user $ sudo wee_reports Using configuration file /etc/weewx/weewx.conf Generating for all time Traceback (most recent call last): File "/usr/share/weewx/weewx/reportengine.py", line 197, in run obj.start() File "/usr/share/weewx/weewx/reportengine.py", line 385, in start self.run() File "/usr/share/weewx/weewx/cheetahgenerator.py", line 169, in run ngen = self.generate(gen_dict[section_name], section_name, self.gen_ts) File "/usr/share/weewx/weewx/cheetahgenerator.py", line 229, in generate ngen += self.generate(section[subsection], subsection, gen_ts) File "/usr/share/weewx/weewx/cheetahgenerator.py", line 229, in generate ngen += self.generate(section[subsection], subsection, gen_ts) File "/usr/share/weewx/weewx/cheetahgenerator.py", line 321, in generate searchList = self._getSearchList(encoding, timespan, File "/usr/share/weewx/weewx/cheetahgenerator.py", line 415, in _getSearchList search_list += obj.get_extension_list(timespan, db_lookup) File "/usr/share/weewx/user/historygenerator.py", line 171, in get_extension_list self.search_list_extension[table_name] = self._statsHTMLTable(table_options, table_stats, table_name, File "/usr/share/weewx/user/historygenerator.py", line 227, in _statsHTMLTable unit_type = reading.converter.group_unit_dict[reading.value_t[2]] File "/usr/share/weewx/weewx/tags.py", line 488, in getattr vh = self._do_query() File "/usr/share/weewx/weewx/tags.py", line 474, in _do_query result = weewx.xtypes.get_aggregate(self.obs_type, self.timespan, File "/usr/share/weewx/weewx/xtypes.py", line 127, in get_aggregate return xtype.get_aggregate(obs_type, timespan, aggregate_type, db_manager, File "/usr/share/weewx/weewx/xtypes.py", line 455, in get_aggregate target_val = weewx.units.convertStd(val, db_manager.std_unit_system)[0] File "/usr/share/weewx/weewx/units.py", line 1444, in convertStd return StdUnitConverters[target_std_unit_system].convert(val_t) File "/usr/share/weewx/weewx/units.py", line 879, in convert new_unit_type = self.group_unit_dict.get(val_t[2], USUnits[val_t[2]]) IndexError: tuple index out of range

This second error seems to occur during the conversion to US units, and I have never received it before when generating reports. I presume my weewx database contains rain data stored in non-integer format, but I don't have the python knowledge to determine whether that is resulting in this error. I would also like to be able to use appropriate US non-integer units for minunits and maxunits in skins.conf.

Can you help?

seehase commented 2 years ago

HI @ferretstew database values in non-integer is no problem, they are always stored in numeric

To have min/max ranges in numeric you can take my latest version or just change this line https://github.com/neoground/neowx-material/blob/bdf74c433ea8f03fc6622599e7ff2e805b7261bf/bin/user/historygenerator.py#L317 of historygenerator.py to

if (value >= float(c[0])) and (value <= float(c[1])): and restart weewx service

float value can be set in skin.conf like

       minvalues = 0.00, 1.10, 3.25, 7.50, 10.75, 12.10  
       maxvalues = 1.10, 3.25, 7.50, 10.75, 12.10, 100.40

for your problem with us-units, please send me your wewwx.conf and skin.conf, then I can have a look, It will take a while because I will be on vacation

ferretstew commented 2 years ago

I made the recommended change to historygenerator.py and restarted weewx, but I still receive the second error mentioned in my last post ("tuple index out of range" on line 879 of units.py).

I have attached a zipfile of my weewx.conf and skin.conf, modified to obscure passwords. I don't think I've modified skin.conf. I believe all mods I've made the skin configuration are contained in my weewx.conf. Also, you will notice I've reverted to using floats in my rain minvalues and maxvalues (for example, "0.10").

Thank you!

configs.zip

seehase commented 2 years ago

Hi ferretstew US Units should not be a problem see https://solar.seehausen.org/weewx/index.html I currently changed the units to US

I think the problem is your configuration, it is a bit "mixed" Best solution would be start a new configuration from scratch, and configure your driver and parameter have a look into my config files, e.g. HistoryReport config should be in the skin.conf

you can take the attached skin.conf without any changes, only your weewx.conf should be adapted take the default weewx conf and make the changes for your driver, and skin, then it should work

if you have a question please send me a mail to solar@seehausen.org

config-files.zip

Pogs2004 commented 1 year ago

This is great, I have added it manually to my site as I have so many mods to the skin, header and footer files. I don't seem to be seeing colours on all the values, is it because I don't have a full year of data, or is there something amiss?

Screenshot 2022-10-25 at 17 37 16

In the syslog I get this message which may be a clue: No bootstrap specific labels found.

Thanks

seehausen commented 1 year ago

This is great, I have added it manually to my site as I have so many mods to the skin, header and footer files. I don't seem to be seeing colours on all the values, is it because I don't have a full year of data, or is there something amiss?

Hi @Pogs2004

I think it is not a problem of missing values. I could imagine that minvalue/maxvalue/colours do not match. Defaults are defined in

[HistoryReport]
    minvalues = -50, -10, -5, 0, 5, 10, 15, 20, 25, 30, 35
    maxvalues =  -10, -5, 0, 5, 10, 15, 20, 25, 30, 35, 60
    colours =   "#0029E5", "#0186E7", "#02E3EA", "#04EC97", "#05EF3D2", "#2BF207", "#8AF408", "#E9F70A", "#F9A90B", "#FC4D0D", "#FF0F2D"

but they can be overwritten for each section e.g. if you have only small values like "Minimum Temperature" you should use smaller ranges like I see value between -0.8 ... 8.0

[min_temp]
    minvalues = -3, 0, 3,  5, 7,  9
    maxvalues =  0, 3, 5,  7, 9, 11
    colours =   "#0029E5", "#0186E7", "#02E3EA", "#04EC97", "#05EF3D2", "#2BF207"

in your "Rainfall" you have values from 25.2 to 136.5 so here you need to choose bigger interval Just take the hole section of [HistoryReport] and play around with the values

Pogs2004 commented 1 year ago

This is great, I have added it manually to my site as I have so many mods to the skin, header and footer files. I don't seem to be seeing colours on all the values, is it because I don't have a full year of data, or is there something amiss?

Hi @Pogs2004

I think it is not a problem of missing values. I could imagine that minvalue/maxvalue/colours do not match. Defaults are defined in

[HistoryReport]
    minvalues = -50, -10, -5, 0, 5, 10, 15, 20, 25, 30, 35
    maxvalues =  -10, -5, 0, 5, 10, 15, 20, 25, 30, 35, 60
    colours =   "#0029E5", "#0186E7", "#02E3EA", "#04EC97", "#05EF3D2", "#2BF207", "#8AF408", "#E9F70A", "#F9A90B", "#FC4D0D", "#FF0F2D"

but they can be overwritten for each section e.g. if you have only small values like "Minimum Temperature" you should use smaller ranges like I see value between -0.8 ... 8.0

[min_temp]
    minvalues = -3, 0, 3,  5, 7,  9
    maxvalues =  0, 3, 5,  7, 9, 11
    colours =   "#0029E5", "#0186E7", "#02E3EA", "#04EC97", "#05EF3D2", "#2BF207"

in your "Rainfall" you have values from 25.2 to 136.5 so here you need to choose bigger interval Just take the hole section of [HistoryReport] and play around with the values

Thanks @seehase, I have updated the ranges to suit my data but it is still only colouring the first cell in each card. I notice that I get an error in the syslog:

Oct 25 22:10:18 weather weewxd: historygenerator.py: No bootstrap specific labels found
Oct 25 22:10:18 weather weewxd: Generated table min_temp_table
Oct 25 22:10:18 weather weewxd: Generated table max_temp_table
Oct 25 22:10:18 weather weewxd: Generated table avg_temp_table
Oct 25 22:10:18 weather weewxd: Generated table rain_table
Oct 25 22:10:18 weather weewxd: Generated table rain_days_table
Oct 25 22:10:18 weather weewxd: Generated table uv_max_table
Oct 25 22:10:18 weather weewxd: Generated table max_wind_table
Oct 25 22:10:18 weather weewxd: Generated table avg_wind_table
Oct 25 22:10:18 weather weewxd: historygenerator.py: Generated 8 tables in 0.04 seconds

Could the bootstrap labels have anything to do with it? The generated history.html file is a bit broken, the first table data cell in each row (the only cell with colour) has several bgcolor tags and the remaining cells just have the value, no colour tags.

Thanks!

seehausen commented 1 year ago

I don't think it is the missing label. It must be something with the range configuration the method looks straight forward Maybe wrong delimiters? there have to be 3 lists [minvalues], [maxvalues], [html colour code] maybe they are not correctly inititalized? I would expect if there is a problem while cast to flow that you see another exception

def _colorCell(self, value, format_string, bgColours):
        """Returns a '<td> bgcolor = xxx y.yy </td>' html table entry string.

        value: Numeric value for the observation
        format_string: How the numberic value should be represented in the table cell.
        bgColours: An array containing 3 lists. [minvalues], [maxvalues], [html colour code]
        """

        if value is not None:
            cellText = "<td"

            for c in bgColours:
                if (value >= float(c[0])) and (value <= float(c[1])):
                    cellText += " bgcolor = \"%s\"" % c[2]

            formatted_value = format_string % value
            cellText += "> %s </td>" % formatted_value

        else:
            cellText = "<td>-</td>\n"

        return cellText
Pogs2004 commented 1 year ago

@seehase I have checked all the lists and values and they all seem fine, exactly the same number of min values, max values and colours in each series. The history html tables look like this:

<table class="table">    <thead>        <tr>        <th>°C</th>        <th>Jan</th>        <th>Feb</th>        <th>Mar</th>        <th>Apr</th>        <th>May</th>        <th>Jun</th>        <th>Jul</th>        <th>Aug</th>        <th>Sep</th>        <th>Oct</th>        <th>Nov</th>        <th>Dec</th>    </tr>    </thead>    <tbody>        <tr>
            <td>2022</td>
            <td>-</td>
            <td bgcolor = "#0029E5" bgcolor = "#0186E7" bgcolor = "#02E3EA" bgcolor = "#04EC97"> -0.8 </td>            <td> -0.2 </td>            <td> -0.4 </td>            <td> 3.2 </td>            <td> 6.6 </td>            <td> 7.7 </td>            <td> 8.0 </td>            <td> 4.6 </td>            <td> 3.5 </td>            <td>-</td>
            <td>-</td>
        </tr>
        </tr>
    </tbody>
</table>

You can see it the first tag in the row has all the bgcolor values and the remaining tags have no colour - it's like this for all the tables. I'll have a dig around in case I have broken anything but apart from skin.conf and header.inc I have not touched the other files such as history.html.tmpl and history generator.py.

seehausen commented 1 year ago

It should look like this

<td>2018</td>
--
  | <td bgcolor = "#02E3EA"> -1.1 </td>            <td bgcolor = "#0029E5"> -11.5 </td>            <td bgcolor = "#0186E7"> -8.9 </td>            <td bgcolor = "#04EC97"> 2.9 </td>

looks like there is a missing or wrong delimiter in the colourCode list. must be separated by "," and you can try a single quote ' instead of " and also check for tab's or other whitespaces? just a guess?

Pogs2004 commented 1 year ago

It should look like this

<td>2018</td>
--
  | <td bgcolor = "#02E3EA"> -1.1 </td>            <td bgcolor = "#0029E5"> -11.5 </td>            <td bgcolor = "#0186E7"> -8.9 </td>            <td bgcolor = "#04EC97"> 2.9 </td>

looks like there is a missing or wrong delimiter in the colourCode list. must be separated by "," and you can try a single quote ' instead of " and also check for tab's or other whitespaces? just a guess?

Not sure what's going on. I have copied back the original [HistoryReport] section from this branch and still get the same. I edited my version using ' instead of " and made sure all the values are correct but no change. As you say, it's likely a typo somewhere but I can't find it!

@cbirkenbeul I notice you had the same issue with only the first cells coloured, did you ever find out what was causing it?

seehausen commented 1 year ago

you can send my your skin.conf and I can check... maybe the error is somewhere else e.g. wewwx.conf I don't know

Pogs2004 commented 1 year ago

you can send my your skin.conf and I can check... maybe the error is somewhere else e.g. wewwx.conf I don't know

Here's my skin.conf, you can see I have edited the [HistoryGenerator] section, this one I have replaced " with ' and also put the min, max and colour tags in each group rather than default - this made no difference!

skin.conf.zip

The only addition to my weewx.conf is the historygenerator.py line, I can see nothing in there that could be causing this as I keep all the skin configs in their own folder.

W0CHP commented 1 year ago

I def. support this PR. I've had the history reports setup on my own instance since neowx-material was released (https://wx.w0chp.net/stats/); because I had the reports on my prior skin and wanted to retain it.

However, I see folks struggling to get it working. If anyone needs code snippets/configs/etc., I'd be happy to provide them.

seehase commented 1 year ago

Strange ... your skin.conf works for me https://solar.seehausen.org/weewx/history.html grafik

What OS are you using? Linux, Win? Could it be problems with file encoding? UTF8, UNIX/DOS?

try delete the file /usr/share/weewx/user/historygenerator.pyc

and copy latest historygenerator.py from my PR and restart weewx

Pogs2004 commented 1 year ago

Thanks again @seehase, I really appreciate your help. I’ll update the historygenerator.py when I’m back at my laptop. Weewx is running on a Raspberry Pi 4 / Raspberry Pi OS Lite 64bit with UTF8 encoding, as you can see the rest of Neowx-Material is working fine, I have some hard coded config changes in the header and footer.inc files, and most of the *.tmpl files have mods, but not history.html.tmpl, it’s vanilla. The weewx.conf file is fairly standard apart from some changed QC values, some calculate values and it is using an extension driver, weatherlinklive - weewx gets its data from a Davis WLL via ethernet (my weather station sits in its own subnet on my network).

I’ll let you know how I get on, now I know it’s not the skin.conf I can look elsewhere!

Pogs2004 commented 1 year ago

I def. support this PR. I've had the history reports setup on my own instance since neowx-material was released (https://wx.w0chp.net/stats/); because I had the reports on my prior skin and wanted to retain it.

However, I see folks struggling to get it working. If anyone needs code snippets/configs/etc., I'd be happy to provide them.

Thanks @W0CHP, Seehase has been helping out but another pair of eyes on the problem would be good! I have the history page up and running, however only the first cell in each card is coloured: https://www.360shetland.co.uk/weather/history.html

Seehase used my skin.conf on his build and it worked fine, I am using the latest historygenerator.py so not sure what's going on! The rendered history.html has the first tag in each row with all the colour tags, the remaining tags have no colour, maybe you can help?

W0CHP commented 1 year ago

Hi @Pogs2004 , here are the relevant colour (etc.) values of my skin.conf's [HistoryReport] stanza:

[HistoryReport]
    minvalues = -65, -10, 0, 5, 10, 15, 25, 35, 45, 50, 60
    maxvalues =  -5, 0, 10, 20, 35, 45, 60, 75, 90, 100, 120
    colours =   "#0098F6", "#0098F6", "#4FBCFF", "#0bdcd0", "#5EF3D2", "#2BF207", "#8AF408", "#E9F70A", "#F9A90B", "#FC4D0D", "#FF0F2D"
    monthnames = Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec

    [[max_temp]]
        obs_type = outTemp
        aggregate_type = max

    [[avg_temp]]
        obs_type = outTemp
        aggregate_type = avg
        minvalues = -45, -10, 0, 5, 10, 15, 25, 35, 45, 50, 60
        maxvalues =  -5, 0, 10, 20, 35, 45, 60, 70, 85, 100, 120
        colours =   "#0186E7", "#0186E7", "#02E3EA", "#04EC97", "#5EF3D2", "#2BF207", "#8AF408", "#E9F70A", "#F9A90B", "#FC4D0D", "#FF0F2D"

    [[avg_htemp]]
        obs_type = inTemp
        aggregate_type = avg
        minvalues =  50, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80
        maxvalues =  62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 85

    [[temp_count]]
        obs_type = outTemp
        aggregate_type = sum_ge
        aggregate_threshold = -150.0, degree_F
        minvalues =  0, 2, 4, 6, 8, 12, 15, 18, 21, 24, 27
        maxvalues =  2, 4, 6, 8, 12, 15, 18, 21, 24, 27, 32
        colours =   "#0029E5", "#0186E7", "#02E3EA", "#04EC97", "#05EF3D2", "#2BF207", "#8AF408", "#E9F70A", "#F9A90B", "#FC4D0D", "#FFFFFF"

    [[avg_wind]]
        obs_type = wind
        aggregate_type = avg
        minvalues =  0, 1, 2, 3, 4, 5
        maxvalues =  1, 3, 5, 7, 9, 20
        colours =  '#f6e8f5', '#edd1eb', '#e4bae1', '#dba3d7', '#d38ccd', '#ca75c2'

    [[max_wind]]
        obs_type = wind
        aggregate_type = max
        minvalues =  0, 5, 10, 15, 20, 25, 30, 35, 40, 45
        maxvalues = 10, 20, 25, 30, 40, 45, 50, 60, 75, 100
        colours =  '#f6e8f5', '#edd1eb', '#e4bae1', '#dba3d7', '#d38ccd', '#ca75c2', '#c15eb8', '#b847ae', '#af30a4', '#a6199a'
Pogs2004 commented 1 year ago

Hi @Pogs2004 , here are the relevant colour (etc.) values of my skin.conf's [HistoryReport] stanza:

[HistoryReport]
    minvalues = -65, -10, 0, 5, 10, 15, 25, 35, 45, 50, 60
    maxvalues =  -5, 0, 10, 20, 35, 45, 60, 75, 90, 100, 120
    colours =   "#0098F6", "#0098F6", "#4FBCFF", "#0bdcd0", "#5EF3D2", "#2BF207", "#8AF408", "#E9F70A", "#F9A90B", "#FC4D0D", "#FF0F2D"
    monthnames = Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec

    [[max_temp]]
        obs_type = outTemp
        aggregate_type = max

    [[avg_temp]]
        obs_type = outTemp
        aggregate_type = avg
        minvalues = -45, -10, 0, 5, 10, 15, 25, 35, 45, 50, 60
        maxvalues =  -5, 0, 10, 20, 35, 45, 60, 70, 85, 100, 120
        colours =   "#0186E7", "#0186E7", "#02E3EA", "#04EC97", "#5EF3D2", "#2BF207", "#8AF408", "#E9F70A", "#F9A90B", "#FC4D0D", "#FF0F2D"

    [[avg_htemp]]
        obs_type = inTemp
        aggregate_type = avg
        minvalues =  50, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80
        maxvalues =  62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 85

    [[temp_count]]
        obs_type = outTemp
        aggregate_type = sum_ge
        aggregate_threshold = -150.0, degree_F
        minvalues =  0, 2, 4, 6, 8, 12, 15, 18, 21, 24, 27
        maxvalues =  2, 4, 6, 8, 12, 15, 18, 21, 24, 27, 32
        colours =   "#0029E5", "#0186E7", "#02E3EA", "#04EC97", "#05EF3D2", "#2BF207", "#8AF408", "#E9F70A", "#F9A90B", "#FC4D0D", "#FFFFFF"

    [[avg_wind]]
        obs_type = wind
        aggregate_type = avg
        minvalues =  0, 1, 2, 3, 4, 5
        maxvalues =  1, 3, 5, 7, 9, 20
        colours =  '#f6e8f5', '#edd1eb', '#e4bae1', '#dba3d7', '#d38ccd', '#ca75c2'

    [[max_wind]]
        obs_type = wind
        aggregate_type = max
        minvalues =  0, 5, 10, 15, 20, 25, 30, 35, 40, 45
        maxvalues = 10, 20, 25, 30, 40, 45, 50, 60, 75, 100
        colours =  '#f6e8f5', '#edd1eb', '#e4bae1', '#dba3d7', '#d38ccd', '#ca75c2', '#c15eb8', '#b847ae', '#af30a4', '#a6199a'

Hi @W0CHP, thanks for the help. I have downloaded the historygenerator.py from here: https://github.com/brewster76/fuzzy-archer/issues/57

Problem solved!

Pogs2004 commented 1 year ago

Strange ... your skin.conf works for me https://solar.seehausen.org/weewx/history.html grafik

What OS are you using? Linux, Win? Could it be problems with file encoding? UTF8, UNIX/DOS?

try delete the file /usr/share/weewx/user/historygenerator.pyc

and copy latest historygenerator.py from my PR and restart weewx

Hi @seehase, problem solved, see above reply to @W0CHP . Thanks for all the help

seehausen commented 1 year ago

@Pogs2004 nice... but was is the solution, or was the problem? ah I see... I use a very old version, I will update the historygenerator.py in my PR

Anyway I see not much activity in this repo, does it make sense to continue working in a new fork?

Pogs2004 commented 1 year ago

@Pogs2004 nice... but was is the solution, or was the problem? ah I see... I use a very old version, I will update the historygenerator.py in my PR

Anyway I see not much activity in this repo, does it make sense to continue working in a new fork?

This is the one I used (extension changed to txt): historygenerator.txt

It's a shame there's not much activity, it's a great skin and the recent additions like this and the wind direction graph make it a fully loaded front end.

seehase commented 1 year ago

Updated my PR and also added the new winDir feature

W0CHP commented 1 year ago

Hi @seehase, problem solved, see above reply to @W0CHP . Thanks for all the help

My pleasure! Cheers!

W0CHP commented 1 year ago

Updated my PR and also added the new winDir feature

Awesome! Glad my PR was useful. Enjoying the collaboration. :)

W0CHP commented 1 year ago

@seehase per your request, here's my All-Time Records template for history.html.tmpl...

After the last "card" (UV, around line # 94), add the following (and tweak to your desire):


                    <div class="card-body text-center">
                        <h3 class="h4-responsive $Extras.color-text"><i class="fa fa-list-alt" ></i> All-Time Records</h3>
                        <div class="card-body text-center">
                            <div class="card">
                                <table class="table text-left">
                                    <tr>
                                        <th colspan="3" class="text-center"><b>Temperatures</b></td>
                                    </tr>
                                    <tr>
                                        <td>Highest:</td>
                                        <td>$alltime.outTemp.max</td>
                                        <td>$alltime.outTemp.maxtime</td>
                                     </tr>
                                     <tr>
                                        <td>Lowest:</td>
                                        <td>$alltime.outTemp.min</td>
                                        <td>$alltime.outTemp.mintime</td>
                                    </tr>
                                    <tr>
                                        <th colspan="3" class="text-center"><br><b>Heat Index</b></td>
                                    </tr>
                                    <tr>
                                        <td>Highest:</td>
                                        <td>$alltime.heatindex.max</td>
                                        <td>$alltime.heatindex.maxtime</td>
                                    </tr>
                                    <tr>
                                        <th colspan="3" class="text-center"><br><b>Wind Chill</b></td>
                                    </tr>
                                    <tr>
                                        <td>Lowest:</td>
                                        <td>$alltime.windchill.min</td>
                                        <td>$alltime.windchill.mintime</td>
                                    </tr>
                                    <tr>
                                        <th colspan="3" class="text-center"><br><b>Dewpoint</b></td>
                                    </tr>
                                    <tr>
                                        <td>Highest:</td>
                                        <td>$alltime.dewpoint.max</td>
                                        <td>$alltime.dewpoint.maxtime</td>
                                    </tr>
                                    <tr>
                                        <td>Lowest:</td>
                                        <td>$alltime.dewpoint.min</td>
                                        <td>$alltime.dewpoint.mintime</td>
                                    </tr>
                                    <tr>
                                        <th colspan="3" class="text-center"><br><b>Pressure</b></td>
                                    </tr>
                                    <tr>
                                        <td>Highest:</td>
                                        <td>$alltime.barometer.max</td>
                                        <td>$alltime.barometer.maxtime</td>
                                    </tr>
                                    <tr>
                                        <td>Lowest:</td>
                                        <td>$alltime.barometer.min</td>
                                        <td>$alltime.barometer.mintime</td>
                                    </tr>
                                    <tr>
                                        <th colspan="3" class="text-center"><br><b>Wind</b></td>
                                    </tr>
                                    <tr>
                                        <td>Highest Sustained:</td>
                                        <td>$alltime.windSpeed.max.format('%.0f')</td>
                                        <td>$alltime.windSpeed.maxtime</td>
                                    </tr>
                                    <tr>
                                        <td>Highest Gust:</td>
                                        <td>$alltime.windGust.max.format('%.0f')</td>
                                        <td>$alltime.windGust.maxtime</td>
                                    </tr>
                                    <tr>
                                        <th colspan="3" class="text-center"><br><b>Precipitation</b></td>
                                    </tr>
                                    <tr>
                                        <td>Highest Daily Rainfall:</td>
                                        <td>$alltime.rain.maxsum</td>
                                        <td>$alltime.rain.maxsumtime</td>
                                    </tr>
                                    <tr>
                                        <td>Highest Rain Rate:</td>
                                        <td>$alltime.rainRate.max</td>
                                        <td>$alltime.rainRate.maxtime</td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>
seehase commented 1 year ago

@W0CHP Thanks... integrated it into my PR

Pogs2004 commented 1 year ago

Looking good now, I have added the all time records (tweaked a bit): https://www.360shetland.co.uk/weather/history.html

@W0CHP I was looking at your Sun & Moon page, just wondering how you coded the "Today's Total Luminosity 9 hours, 58 minutes, 42 seconds (2 minutes, 32 seconds less than yesterday)"? It would be very useful for my station

seehausen commented 1 year ago

Looking good now, I have added the all time records (tweaked a bit): https://www.360shetland.co.uk/weather/history.html

@W0CHP I was looking at your Sun & Moon page, just wondering how you coded the "Today's Total Luminosity 9 hours, 58 minutes, 42 seconds (2 minutes, 32 seconds less than yesterday)"? It would be very useful for my station

@Pogs2004 I like your tweaks ;-) would like to take them into my PR, can you send them to me?

Pogs2004 commented 1 year ago

@Pogs2004 I like your tweaks ;-) would like to take them into my PR, can you send them to me?

EDIT My history.html.tmpl file, it wasn't working correctly in dark mode and the font size was too small. I haven't set the language translations in the all time records section but it should be easy to do. I split the all time records into a separate card and aligned the headings to the left. I have also added the Erik Flowers WI weather icons which are installed with Neowx rather than the Font Awesome ones which may not be on an end users system.

#encoding UTF-8
#attr $active_nav = 'history'

<!DOCTYPE html>
<html class="no-js">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="profile" href="http://gmpg.org/xfn/11" />

        <title>
           $Extras.Translations[$Extras.language].history | $station.location
        </title>
        #include "head.inc"

         <!-- <style type="text/css">
             .auto-theme .table {color:black !important;}
         </style> -->

    </head>

    <body class="${Extras.Appearance.mode}-theme main-bg" ontouchstart="">
        #attr $active_nav = 'history'
        #include "header.inc"

        <main>
            <div class="container">
            <div class="row my-4 align-content-start">
             <div class="col-12 mb-4 text-center">
                 <h2 class="h2-responsive text-dark"><i class="wi wi-day-cloudy-gusts" ></i> <dfn data-info="Colour coded weather statistics by year and month">Weather Statistics</dfn></h2></br>

                <div class="col-sm">
                    <div class="card">

                            <div class="card card-body">
                                <h4 class="h5-responsive blue-text"><i class="wi wi-thermometer" ></i> $Extras.Translations[$Extras.language].min_temp</h4>
                                $min_temp_table
                            </div>

                            <div class="card card-body">
                                <h4 class="h5-responsive blue-text"><i class="wi wi-thermometer" ></i> $Extras.Translations[$Extras.language].avg_temp</h4>
                                $avg_temp_table
                            </div>

                            <div class="card card-body">
                                <h4 class="h5-responsive blue-text"><i class="wi wi-thermometer" ></i> $Extras.Translations[$Extras.language].max_temp</h4>
                                $max_temp_table
                            </div>

                            <div class="card card-body">
                                <h4 class="h5-responsive blue-text"><i class="wi wi-showers" ></i> $Extras.Translations[$Extras.language].rain</h4>
                                $rain_table
                            </div>

                            <div class="card card-body">
                                <h4 class="h5-responsive blue-text"><i class="wi wi-showers" ></i> $Extras.Translations[$Extras.language].rain_days (> 0.2mm)</h4>
                                $rain_days_table
                            </div>

                            <div class="card card-body">
                                <h4 class="h5-responsive blue-text"><i class="wi wi-strong-wind" ></i> $Extras.Translations[$Extras.language].max_wind</h4>
                                $max_wind_table
                            </div>

                            <div class="card card-body">
                                <h4 class="h5-responsive blue-text"><i class="wi wi-strong-wind" ></i> $Extras.Translations[$Extras.language].avg_wind</h4>
                                $avg_wind_table
                            </div>

                            <div class="card card-body">
                                <h4 class="h5-responsive blue-text"><i class="wi wi-day-sunny" ></i> $Extras.Translations[$Extras.language].uv_max</h4>
                                $uv_max_table
                            </div>
                    </div>
                    </br><h2 class="h2-responsive text-dark text-center"><i class="wi wi-time-2" ></i> <dfn data-info="All time records since September 2021">All Time Records</dfn></h2></br>
                    <div class="card">

                                <div class="card-body text-center" style="text-align:left;width:100%;">
                                <table class="table text-left records" style="width:100%;font-size:19px;">
                                    <tr>
                                        <th colspan="3" class="blue-text" style="text-align:left;font-size:20px;"><i class="wi wi-thermometer" ></i> Temperature</th>
                                    </tr>
                                    <tr>
                                        <td style="font-size:18px;">Highest:</td>
                                        <td style="font-size:18px;">$alltime.outTemp.max</td>
                                        <td style="font-size:18px;">$alltime.outTemp.maxtime</td>
                                     </tr>
                                     <tr>
                                        <td style="font-size:18px;">Lowest:</td>
                                        <td style="font-size:18px;">$alltime.outTemp.min</td>
                                        <td style="font-size:18px;">$alltime.outTemp.mintime</td>
                                    </tr>
                                    <tr>
                                        <th colspan="3" class="blue-text" style="text-align:left;font-size:20px;"><i class="wi wi-day-windy" ></i> Feels Like</th>
                                    </tr>
                                    <tr>
                                        <td style="font-size:18px;">Highest:</td>
                                        <td style="font-size:18px;">$alltime.appTemp.max</td>
                                        <td style="font-size:18px;">$alltime.appTemp.maxtime</td>
                                     </tr>
                                    <tr>
                                        <td style="font-size:18px;">Lowest:</td>
                                        <td style="font-size:18px;">$alltime.appTemp.min</td>
                                        <td style="font-size:18px;">$alltime.appTemp.mintime</td>
                                    </tr>
                                    <tr>
                                         <th colspan="3" class="blue-text" style="text-align:left;font-size:20px;"><i class="wi wi-humidity" ></i> Humidity</th>
                                    </tr>
                                    <tr>
                                        <td style="font-size:18px;">Highest:</td>
                                        <td style="font-size:18px;">$alltime.outHumidity.max</td>
                                        <td style="font-size:18px;">$alltime.outHumidity.maxtime</td>
                                    </tr>
                                    <tr>
                                        <td style="font-size:18px;">Lowest:</td>
                                        <td style="font-size:18px;">$alltime.outHumidity.min</td>
                                        <td style="font-size:18px;">$alltime.outHumidity.mintime</td>
                                    </tr>
                                    <tr>
                                         <th colspan="3" class="blue-text" style="text-align:left;font-size:20px;"><i class="wi wi-barometer" ></i> Pressure</th>
                                    </tr>
                                    <tr>
                                        <td style="font-size:18px;">Highest:</td>
                                        <td style="font-size:18px;">$alltime.barometer.max</td>
                                        <td style="font-size:18px;">$alltime.barometer.maxtime</td>
                                    </tr>
                                    <tr>
                                        <td style="font-size:18px;">Lowest:</td>
                                        <td style="font-size:18px;">$alltime.barometer.min</td>
                                        <td style="font-size:18px;">$alltime.barometer.mintime</td>
                                    </tr>
                                    <tr>
                                         <th colspan="3" class="blue-text" style="text-align:left;font-size:20px;"><i class="wi wi-strong-wind" ></i> Wind</th>
                                    </tr>
                                    <tr>
                                        <td style="font-size:18px;">Highest Sustained:</td>
                                        <td style="font-size:18px;">$alltime.windSpeed.max.format('%.0f')</td>
                                        <td style="font-size:18px;">$alltime.windSpeed.maxtime</td>
                                    </tr>
                                    <tr>
                                        <td style="font-size:18px;">Highest Gust:</td>
                                        <td style="font-size:18px;">$alltime.windGust.max.format('%.0f')</td>
                                        <td style="font-size:18px;">$alltime.windGust.maxtime</td>
                                    </tr>
                                    <tr>
                                        <td style="font-size:18px;">Longest Wind Run:</td>
                                        <td style="font-size:18px;">$alltime.windrun.max</td>
                                        <td style="font-size:18px;">$alltime.windrun.maxtime</td>
                                     </tr>
                                    <tr>
                                         <th colspan="3" class="blue-text" style="text-align:left;font-size:20px;"><i class="wi wi-umbrella" ></i> Precipitation</th>
                                    </tr>
                                    <tr>
                                        <td style="font-size:18px;">Highest Daily Rainfall:</td>
                                        <td style="font-size:18px;">$alltime.rain.maxsum</td>
                                        <td style="font-size:18px;">$alltime.rain.maxsumtime</td>
                                    </tr>
                                    <tr>
                                        <td style="font-size:18px;">Highest Rain Rate:</td>
                                        <td style="font-size:18px;">$alltime.rainRate.max</td>
                                        <td style="font-size:18px;">$alltime.rainRate.maxtime</td>
                                    </tr>
                                    <tr>
                                        <th colspan="3" class="blue-text" style="text-align:left;font-size:20px;"><i class="wi wi-day-sunny" ></i> UV Index</th>
                                    </tr>
                                    <tr>
                                        <td style="font-size:18px;">Highest:</td>
                                        <td style="font-size:18px;">$alltime.UV.max</td>
                                        <td style="font-size:18px;">$alltime.UV.maxtime</td>
                                    </tr>
                                    <tr>
                                        <th colspan="3" class="blue-text" style="text-align:left;font-size:20px;"><i class="wi wi-day-sunny" ></i> Solar Radiation</th>
                                    </tr>
                                    <tr>
                                        <td style="font-size:18px;">Highest:</td>
                                        <td style="font-size:18px;">$alltime.radiation.max</td>
                                        <td style="font-size:18px;">$alltime.radiation.maxtime</td>
                                    </tr>
                                </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>       
        </main>

        #include "footer.inc"
        #include "js.inc"
    </body>
</html>
W0CHP commented 1 year ago

@W0CHP I was looking at your Sun & Moon page, just wondering how you coded the "Today's Total Luminosity 9 hours, 58 minutes, 42 seconds (2 minutes, 32 seconds less than yesterday)"? It would be very useful for my station

Sure @Pogs2004 - in the almanac.html.tmpl file, insert the following at the top, after the #encoding UTF-8 declaration:

#set $now = $current.dateTime.raw
#set $yesterday = $now - 24*3600
#set $today_dayluminosity = $almanac.sun.set.raw -  $almanac.sun.rise.raw                                                                                   
#set $yesterday_dayluminosity = $almanac($almanac_time=$yesterday).sun.set.raw - $almanac($almanac_time=$yesterday).sun.rise.raw                            
#set $difference_pre = $today_dayluminosity - $yesterday_dayluminosity
#set $difference = $difference_pre//60
#set $seconds = $almanac.sun.set.raw - $almanac.sun.rise.raw
#set $hours = $seconds //3600
#set $seconds %= 3600
#set $minutes = $seconds//60
#set $seconds %= 60
#set $dayluminosity_str = "%d hours, %d minutes, %d seconds" % ($hours, $minutes, $seconds)                                                                 
#set $difference = $today_dayluminosity - $yesterday_dayluminosity
#if $difference
    #set $delta = abs($difference)
    #set $amt_str = "%s%d seconds" % (str(int($delta) // 60) + ' minutes, ' if ($delta // 60) > 0 else '', $delta % 60 if ($delta // 60) > 0 else $delta)
    #if $difference > 0
        #set $delta_str = "%s more than yesterday" % $amt_str
    #else
        #set $delta_str = "%s less than yesterday" % $amt_str
    #end if
    #set $dayluminosity_str = "%s" % ($dayluminosity_str)
#end if

Then place something similar to this in the Sun "card" and tweak:

<h6 class="h6-responsive $Extras.color-text"> Today's Total Luminosity</h6>
<div class="row">
    <div class="col">
        $dayluminosity_str ($delta_str)
    </div>
</div>
seehase commented 1 year ago

Thanks @W0CHP took over agin your changes only have some problems with $alltime.windrun.* these values are not calculated correctly in my installation

seehase commented 1 year ago

Question: as there is not much actitity in that repo... do we want to create a fork to continue working on improvements? Either my fork (https://github.com/seehase/neowx-material/tree/master) or any other I like to contribute in this skin

Pogs2004 commented 1 year ago

@W0CHP I was looking at your Sun & Moon page, just wondering how you coded the "Today's Total Luminosity 9 hours, 58 minutes, 42 seconds (2 minutes, 32 seconds less than yesterday)"? It would be very useful for my station

Sure @Pogs2004 - in the almanac.html.tmpl file, insert the following at the top, after the #encoding UTF-8 declaration:

#set $now = $current.dateTime.raw
#set $yesterday = $now - 24*3600
#set $today_dayluminosity = $almanac.sun.set.raw -  $almanac.sun.rise.raw                                                                                   
#set $yesterday_dayluminosity = $almanac($almanac_time=$yesterday).sun.set.raw - $almanac($almanac_time=$yesterday).sun.rise.raw                            
#set $difference_pre = $today_dayluminosity - $yesterday_dayluminosity
#set $difference = $difference_pre//60
#set $seconds = $almanac.sun.set.raw - $almanac.sun.rise.raw
#set $hours = $seconds //3600
#set $seconds %= 3600
#set $minutes = $seconds//60
#set $seconds %= 60
#set $dayluminosity_str = "%d hours, %d minutes, %d seconds" % ($hours, $minutes, $seconds)                                                                 
#set $difference = $today_dayluminosity - $yesterday_dayluminosity
#if $difference
    #set $delta = abs($difference)
    #set $amt_str = "%s%d seconds" % (str(int($delta) // 60) + ' minutes, ' if ($delta // 60) > 0 else '', $delta % 60 if ($delta // 60) > 0 else $delta)
    #if $difference > 0
        #set $delta_str = "%s more than yesterday" % $amt_str
    #else
        #set $delta_str = "%s less than yesterday" % $amt_str
    #end if
    #set $dayluminosity_str = "%s" % ($dayluminosity_str)
#end if

Then place something similar to this in the Sun "card" and tweak:

<h6 class="h6-responsive $Extras.color-text"> Today's Total Luminosity</h6>
<div class="row">
    <div class="col">
        $dayluminosity_str ($delta_str)
    </div>
</div>

Thanks yet again @W0CHP! I’ve added it in and reformatted the sun and moon tables, looks great. Edit re the last new and full moon,, I was using last_new_moon and last_full_moon instead of previous. https://www.360shetland.co.uk/weather/almanac.html

W0CHP commented 1 year ago

Thanks yet again @W0CHP! I’ve added it in and reformatted the sun and moon tables, looks great. Edit re the last new and full moon,, I was using last_new_moon and last_full_moon instead of previous. https://www.360shetland.co.uk/weather/almanac.html

My pleasure. Your site is looking amazing, @Pogs2004!

Q: I noticed your history/stats are leveraging what looks the more modern and responsive flexbox (or grid)? If so, I would recommend either doing a PR or posting the code for someone to do a PR to make the report more responsive by default.

W0CHP commented 1 year ago

Question: as there is not much actitity in that repo... do we want to create a fork to continue working on improvements? Either my fork (https://github.com/seehase/neowx-material/tree/master) or any other I like to contribute in this skin

Yeah @seehase, this repo hasn't moved since 2021 (even PR's). I'd be OK with using and contributing to your (more "living") fork. If @neoground wants to pull all the changes in at a later date, it can always be done.

Pogs2004 commented 1 year ago

My pleasure. Your site is looking amazing, @Pogs2004!

Q: I noticed your history/stats are leveraging what looks the more modern and responsive flexbox (or grid)? If so, I would recommend either doing a PR or posting the code for someone to do a PR to make the report more responsive by default.

Thanks @W0CHP! I am still playing around with the layout for the stats, unfortunately although it looks good on desktop and tablet it is a bit broken on small screens unless they are turned landscape. Even then, the max rain is a bit messy. If I use a fully flex container it looks good on small screens but stretched the full width of the viewport on desktop and tablet.

I'm thinking to use a bit of code to determine the viewport size then use an appropriate container, I have done this for my own business website.

As soon as I'm happy I'll post it up here

W0CHP commented 1 year ago

Thanks @W0CHP! I am still playing around with the layout for the stats, unfortunately although it looks good on desktop and tablet it is a bit broken on small screens unless they are turned landscape. Even then, the max rain is a bit messy. If I use a fully flex container it looks good on small screens but stretched the full width of the viewport on desktop and tablet.

I'm thinking to use a bit of code to determine the viewport size then use an appropriate container, I have done this for my own business website.

As soon as I'm happy I'll post it up here

Sounds good, mate. You got talent, and it would be beneficial for @seehase 's fork! 👍