update the upgrading guid

This commit is contained in:
Matthew Wall
2019-01-13 11:00:55 -05:00
parent 1acbf9f27d
commit b755dae69a

View File

@@ -204,198 +204,17 @@ sudo apt-get install weewx</pre>
<h2>From V3.8 or earlier</h2>
<h3>Skin defaults</h3>
<p class="note">
A new <span class="code">[Defaults]</span> section has been introduced to <span class="code">weewx.conf</span>.
To change the unit system, and many other things used by your skins, just change <span class="code">[Defaults].</span>
</p>
<p>With version 3.9, the way defaults propogate through skins has changed. Before this version, a value
specified in a skin's configuration file <span class="code">skin.conf</span> could be "overridden" by a
corresponding value in <span class="code">weewx.conf</span>. There were several problems with this approach:
</p>
<ul>
<li>
This is opposite to the way most things work in WeeWX. Usually, things near the root of a hierarchy
(that is, top level sections in <span class="code">weewx.conf</span>) can get overridden by something
near a leaf (a subsection, such as <span class="code">[StdReport]</span>, or, even deeper, something in
<span class="code">skin.conf</span>). This is the way <span class="code">StdRESTful</span> services
work.
</li>
<li>There is no way to specify "overall" defaults, such as what unit system to use, that should apply to
<em>all</em> skins. Instead, you must individually override each report.
</li>
</ul>
<p>Version 3.9 introduces a <span class="code">[Defaults]</span> section that applies to <em>all</em>
skins, unless overridden for individual reports in <span class="code">weewx.conf</span>, or by the report's
<span class="code">skin.conf</span>. This means that <span class="code">skin.conf</span> has the final say
in what value to use.
</p>
<p>Because this is different from how the old "override" method worked, skins will display unexpected results
unless they are patched. In particular, the unit system used by the skin will mysteriously change after an
upgrade.
</p>
<p>The V3.9 installer will automatically patch older versions of <span class="code">weew.conf</span> and <span
class="code">skin.conf</span> to bring them up-to-date. It primarily does four things:
</p>
<ol>
<li>Add a <span class="code">[Defaults]</span> section to <span class="code">weewx.conf</span>
</li>
<li>For each scalar override in <span class="code">[StdReport]</span>, it will comment out or delete the
corresponding scalar in <span class="code">skin.conf</span>. This allows the <span class="code">[StdReport]</span>
override to continue to have an affect.
</li>
<li>For each scalar left over in <span class="code">skin.conf</span>, if its value is the same as in <span
class="code">[Defaults]</span>, it will comment out or delete the scalar from <span
class="code">skin.conf</span>. This means that changing a value in <span class="code">[Defaults]</span>
will have an affect.
</li>
<li>As a final step, it adds a scalar, <span class="code">skin_semantics</span>, to <span class="code">skin.conf</span>
to indicate that the skin now adheres to the new skin semantics.
</li>
</ol>
<p>Here's a before and after example of what the patch process does.</p>
<table>
<caption>File <span class="code">weewx.conf</span></caption>
<tr class="first_row">
<td style='width:50%'>3.8 or earlier</td>
<td>3.9</td>
</tr>
<tr>
<td>
<pre class="tty">
[StdReport]
SKIN_ROOT = skins
HTML_ROOT = public_html
data_binding = wx_binding
[[StandardReport]]
skin = Standard
[[[Units]]]
[[[[Groups]]]]
group_altitude = meter
group_speed2 = meter_per_second2
group_pressure = mbar
group_rain = mm
group_rainrate = mm_per_hour
group_temperature = degree_C
group_degree_day = degree_C_day
group_speed = meter_per_second
</pre>
</td>
<td>
<pre class="tty">
[StdReport]
SKIN_ROOT = skins
HTML_ROOT = public_html
data_binding = wx_binding
[[StandardReport]]
skin = Standard
[[[Units]]]
[[[[Groups]]]]
group_altitude = meter
group_speed2 = meter_per_second2
group_pressure = mbar
group_rain = mm
group_rainrate = mm_per_hour
group_temperature = degree_C
group_degree_day = degree_C_day
group_speed = meter_per_second
</pre>
<pre class="tty added"><span class="">[Defaults]
[[Units]]
[[[Groups]]]
group_altitude = foot
group_degree_day = degree_F_day
group_direction = degree_compass
group_moisture = centibar
group_percent = percent
group_pressure = inHg
group_radiation = watt_per_meter_squared
group_rain = inch
group_rainrate = inch_per_hour
group_speed = mile_per_hour
group_speed2 = mile_per_hour2
group_temperature = degree_F
group_uv = uv_index
group_volt = volt
group_count = count
group_interval = minute
group_time = unix_epoch
group_elapsed = second</span>
</pre>
</td>
</tr>
</table>
<table>
<caption>File <span class="code">skins/Standard/skin.conf</span></caption>
<tr class="first_row">
<td style='width:50%'>3.8 or earlier</td>
<td>3.9</td>
</tr>
<tr>
<td>
<pre class='tty'>
[Units]
[[Groups]]
group_altitude = foot
group_degree_day = degree_F_day
group_direction = degree_compass
group_moisture = centibar
group_percent = percent
group_pressure = inHg
group_radiation = watt_per_meter_squared
group_rain = inch
group_rainrate = inch_per_hour
group_speed = mile_per_hour
group_speed2 = mile_per_hour2
group_temperature = degree_F
group_uv = uv_index
group_volt = volt
group_count = count
group_interval = minute
group_time = unix_epoch
group_elapsed = second
</pre>
</td>
<td>
<pre class="tty"><span class="added">skin_semantics = 2</span>
[Units]
[[Groups]]<span class="removed">
group_altitude = foot
group_degree_day = degree_F_day
group_direction = degree_compass
group_moisture = centibar
group_percent = percent
group_pressure = inHg
group_radiation = watt_per_meter_squared
group_rain = inch
group_rainrate = inch_per_hour
group_speed = mile_per_hour
group_speed2 = mile_per_hour2
group_temperature = degree_F
group_uv = uv_index
group_volt = volt
group_count = count
group_interval = minute
group_time = unix_epoch
group_elapsed = second</span>
</pre>
</td>
</tr>
</table>
<h3>Skin extensions</h3>
<h3>New skins</h3>
<p>
Third party skins, which expect the old semantics, could possibly show the wrong units if they were just
blindly installed. To get around this, the extension installer <span class="code">wee_extension</span>
automatically patches incoming skins in a manner similar to what's described above.
Version 3.9 introduces a new skin, <em>Seasons</em>, and separates <em>Mobile</em> and <em>Smartphone</em> from the old <em>StandardReport</em>.
</p>
<h3>Skin defaults</h3>
<p>
Version 3.9 introduces a new section, <span class="code">[StdReport][[Defaults]]</span>. Parameters in this section apply to <em>all</em> reports. This makes it easy to set the units across all reports, or to ensure that the labels for observations are the same in every report.
</p>
<p>
It also adds a file <span class="code">defaults.py</span> in which the fallback values for every report parameter are specified. Although the defaults file is currently only useful to developers, it may be extended to facilitate translations and localization.
</p>
<h2>From V3.6 or earlier</h2>