Adapting the Seasons skin to display battery states - gjr80/weewx-gw1000 GitHub Wiki

Adapting the Seasons skin to display GW1000 sensor battery states

Note: The following instructions apply only to the Seasons skin included in WeeWX v4.6.3 and earlier. The Seasons skin included in WeeWX v4.7.0 and later uses an automated configuration of the skin. Users using the Seasons skin from WeeWX v4.7.0 or later should refer to the [DisplayOptions] stanza in the Seasons skin config file skin.conf.

The Seasons skin shipped with WeeWX includes a Sensor State panel on the Seasons home page that displays station sensor state information. The content of the Sensor State panel is produced by the skins/Seasons/sensors.inc Cheetah template; however, the shipped version of skins/Seasons/sensors.inc does not directly support the display of GW1000 sensor battery states.

A modified sensors.inc that includes support for GW1000 sensor battery states is included in the GW1000 driver GitHub repo. Adapting the Seasons skin to use the GW1000 enabled sensors.inc is a straightforward process and involves downloading the modified sensors.inc, updating the list of sensors to be displayed in sensors.inc and adding a number of label settings to the Seasons skin config file.

Note: Users that have already modified skins/Seasons/sensors.inc will likely need to re-apply their modifications to the GW1000 enabled sensors.inc, however, this should be a straightforward process.

To adapt the Seasons skin to use the GW1000 enabled sensors.inc:

Note: Depending on your system configuration some or all of the following commands may need to be prefixed with sudo or otherwise executed by a user account with privileged system access.

  1. Move aside the existing skins/Seasons/sensors.inc by renaming it to sensors_orig.inc. For setup.py installs:

    $ mv /home/weewx/skins/Seasons/sensors.inc /home/weewx/skins/Seasons/sensors_orig.inc
    

    or for package installs:

    $ mv /etc/weewx/skins/Seasons/sensors.inc /etc/weewx/skins/Seasons/sensors_orig.inc
    
  2. Download the GW1000 enabled sensors.inc from the GW1000 driver GitHub repo. For setup.py installs:

    $ wget -P /home/weewx/skins/Seasons https://raw.githubusercontent.com/gjr80/weewx-gw1000/master/supplementary/skins/Seasons/sensors.inc
    

    or for package installs:

    $ wget -P /etc/weewx/skins/Seasons https://raw.githubusercontent.com/gjr80/weewx-gw1000/master/supplementary/skins/Seasons/sensors.inc
    
  3. Edit skins/Seasons/sensors.inc and make the necessary changes to $sensor_batt_data to reflect the sensors connected to your GW1000. $sensor_batt_data lists the sensor battery states to display in the Sensor Status panel. Since different sensors use different values to indicate sensor battery state, $sensor_batt_data also details the function used to generate the Sensor Status panel output for each sensor. Sensors will be displayed in the Sensor Status panel in the order listed.

    Each $sensor_batt_data entry is in the format:

    (WeeWX sensor battery state field name, decode function name)

    where:

    • WeeWX sensor battery state field name is the WeeWX field holding the battery state data
    • decode function name is the function used to generate the Sensor Status panel output for that sensor. decode function name is set as follows according to sensor type:
    Sensor Decode function
    WH24 get_binary_battery_status
    WH25 get_binary_battery_status
    WH26 get_binary_battery_status
    WH31 get_binary_battery_status
    WH32 get_binary_battery_status
    WH40 get_binary_battery_status
    WH41 get_multi_battery_status
    WH51 get_binary_battery_status
    WH55 get_multi_battery_status
    WH57 get_multi_battery_status
    WH65 get_binary_battery_status

    Note: The GW1000 enabled sensors.inc file includes similar setup comments immediately above the $sensor_batt_data entry describing how $sensor_batt_data should be modified.

  4. Edit skins/Seasons/skin.conf and if required add suitable descriptive names for each sensor state field under the [Labels] [Generic](/gjr80/weewx-gw1000/wiki/Generic) stanza. These labels are the text that will appear for each sensor battery state entry in the Sensor Status panel. For example:

    [Labels]
    
        # Override some labels. No need to identify these as a "Battery"
        # or "Voltage", because that is included in the template.
        [Generic](/gjr80/weewx-gw1000/wiki/Generic)
            ....
            wh31_ch1_batt = Garage (WH31)
            wh31_ch2_batt = Kitchen (WH31)
            wh41_ch1_batt = Dining (WH41)
            wh51_ch1_batt = Front Garden (WH51)
            wh51_ch3_batt = Flower Bed (WH51)
            wh57_batt = Lightning (WH57)
    

    Note: You could also place these entries in weewx.conf under [StdReport] [SeasonsReport](/gjr80/weewx-gw1000/wiki/SeasonsReport) [Labels](/gjr80/weewx-gw1000/wiki/Labels)] [[[Generic](/gjr80/weewx-gw1000/wiki/[[Generic)]]. The choice is up to the user, arguably weewx.conf is WeeWX upgrade safe but it is highly unlikely that a WeeWX upgrade will make destructive changes to the skins/Seasons/skin.conf.

  5. Once the changes are saved the next report cycle should see the Sensor Status panel populated provided you have sensor battery state data in your archive record. Note you may have to refresh the page for the updated data to be displayed.

Any problems or errors in the modified sensors.inc should not cause WeeWX to exit; however, it may cause WeeWX to fail to generate the Seasons skin main page. In such cases check the WeeWX log for log entries that may indicate the source of the problem. If the problem cannot be immediately fixed you can revert to the original sensors.inc by deleting the GW1000 enabled sensors.inc and re-instating the original sensors.inc. For setup.py installs:

$ rm /home/weewx/skins/Seasons/sensors.inc
$ mv /home/weewx/skins/Seasons/sensors_orig.inc /home/weewx/skins/Seasons/sensors.inc

or for package installs:

$ rm /etc/weewx/skins/Seasons/sensors.inc
$ mv /etc/weewx/skins/Seasons/sensors_orig.inc /etc/weewx/skins/Seasons/sensors.inc