Skip to content

Release v5.0

Choose a tag to compare

@chaunceygardiner chaunceygardiner released this 19 Jul 21:56

weewx-loopdata 5.0

A major release: loop-data.txt can now carry almanac values. Any WeeWX
report almanac tag can be listed in the fields line — written exactly as
it appears in a Cheetah template, minus the $ — and loopdata computes it
on every loop cycle with whatever almanac WeeWX has registered
(weewx-skyfield, PyEphem, or WeeWX's built-in fallback), converted and
formatted per the target report, exactly as the report tag would render.
This is a drop-in upgrade: no weewx.conf changes are required, existing
fields behave identically, and the new capability costs nothing until you
list an almanac.* field.

What's new

  • Almanac fields. almanac.sunrise, almanac.sunrise.raw,
    almanac.moon_phase, almanac.sun.az, almanac.sun.visible.raw
    (length of daylight), almanac.moon.rise.raw,
    almanac.next_solstice.raw, almanac.mars.earth_distance,
    almanac(horizon=-6).sun(use_center=1).rise.raw (civil dawn; -12
    nautical, -18 astronomical) — if it works as a report tag, it works
    here, including the .raw/.formatted/.ordinal_compass suffixes.
    Element ids can match the json keys as usual, so page javascript drops
    the values straight into HTML. See the new "Almanac fields" section of
    the README for the full tour.
  • almanac(days=±N). One loopdata extension to the report grammar:
    evaluate the almanac at the same wall-clock time N local calendar
    days away — almanac(days=1).sunrise.raw is tomorrow's sunrise,
    almanac(days=-1).sun.visible.raw is yesterday's length of day.
    (Reports express this with $almanac(almanac_time=$time_ts+86400),
    which needs Cheetah variables a config line doesn't have; days= is
    also DST-correct where ±86400 is not.)
  • Cost is managed automatically. Positions and distances recompute
    every loop packet; rise/set/transit/daylight once per local day;
    next_*/previous_* events are computed once and kept until the local
    day advances past the event, so a page can show today's event for the
    rest of its day. All almanac work runs on loopdata's processor thread,
    never the WeeWX engine thread.
  • weewx-celestial's loop fields are no longer needed. Every loop
    field that extension injects has an almanac equivalent (e.g.,
    current.sunrise.rawalmanac.sunrise.raw,
    current.daylightDur.rawalmanac.sun.visible.raw,
    current.tomorrowSunrise.rawalmanac(days=1).sunrise.raw,
    current.civilTwilightStart.raw
    almanac(horizon=-6).sun(use_center=1).rise.raw). The README has the
    migration mapping, and weewx-celestial 6.0 — released alongside — ships
    a utility that rewrites your fields line automatically. Two notes for
    migrating pages: distances arrive in AU (as reports show them) rather
    than miles/km, and waxing/waning is a one-line derivation (the moon is
    waxing when almanac.next_full_moon.raw < almanac.next_new_moon.raw).

Requirements

  • Python 3.7 or later
  • WeeWX 4 or 5
  • For almanac fields: whatever almanac you want serving them. With
    weewx-skyfield
    (WeeWX 5.2+) or PyEphem installed you get the full tag set; WeeWX's
    built-in fallback serves sunrise, sunset and moon phase only. No
    almanac fields listed, no requirement at all.

Installing/upgrading

Download weewx-loopdata.zip from this release, then:

weectl extension install weewx-loopdata.zip

Restart WeeWX. No weewx.conf changes are needed when upgrading; to use
the new capability, add almanac.* entries to
[LoopData] [[Include]] fields and restart.