diff --git a/bin/user/weatherlink_live/__init__.py b/bin/user/weatherlink_live/__init__.py index 911911b..50451ae 100644 --- a/bin/user/weatherlink_live/__init__.py +++ b/bin/user/weatherlink_live/__init__.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bin/user/weatherlink_live/callback.py b/bin/user/weatherlink_live/callback.py index bfc5d31..38723d3 100644 --- a/bin/user/weatherlink_live/callback.py +++ b/bin/user/weatherlink_live/callback.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bin/user/weatherlink_live/config_editor.py b/bin/user/weatherlink_live/config_editor.py index 5010cbc..b678b33 100644 --- a/bin/user/weatherlink_live/config_editor.py +++ b/bin/user/weatherlink_live/config_editor.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -26,27 +26,40 @@ _MAPPER_TEMPLATE_LIST = List[Tuple[str, List[str]]] +WLL_CONFIG = """ +[WeatherLinkLive] + # This section configures the WeatherLink Live driver. + + # Driver module + driver = user.weatherlink_live + + # Host name or IP address of WeatherLink Live + host = weatherlink_live + + # Mapping of transmitter ids to WeeWX records + mapping = th:1, rain:1, wind:1, uv:1, solar:1, windchill:1, thw:1, thsw:1:appTemp, th_indoor, baro, battery:1 +""" + _MAPPINGS_TEMPLATES: _MAPPER_TEMPLATE_LIST = [ ( "Vantage Pro2 or Vantage Vue", - ['th:1', 'rain:1', 'wind:1', 'windchill:1', 'thw:1:appTemp', 'th_indoor', "baro", 'battery:1:outTemp:rain:wind'] + ['th:1', 'rain:1', 'wind:1', 'windchill:1', 'thw:1:appTemp', 'th_indoor', "baro", 'battery:1'] ), ( "Vantage Pro2 Plus", ['th:1', 'rain:1', 'wind:1', 'uv:1', 'solar:1', 'windchill:1', 'thw:1', 'thsw:1:appTemp', 'th_indoor', 'baro', - 'battery:1:outTemp:rain:wind:uv'] + 'battery:1'] ), ( "Vantage Pro2 Plus with additional anemometer transmitter", ['th:1', 'rain:1', 'wind:2', 'uv:1', 'solar:1', 'windchill:1', 'thw:1', 'thsw:1:appTemp', 'th_indoor', 'baro', - 'battery:1:outTemp:rain:uv', 'battery:2:wind'] + 'battery:1', 'battery:2'] ), ( "Vantage Pro2 Plus with soil/leaf station", ['th:1', 'rain:1', 'wind:1', 'uv:1', 'solar:1', 'windchill:1', 'thw:1', 'thsw:1:appTemp', 'soil_temp:2:1', 'soil_temp:2:2', 'soil_temp:2:3', 'soil_temp:2:4', 'soil_moist:2:1', 'soil_moist:2:2', 'soil_moist:2:3', - 'soil_moist:2:4', 'leaf_wet:2:1', 'leaf_wet:2:2', 'th_indoor', 'baro', 'battery:1:outTemp:rain:wind:uv', - 'battery:2:tx'] + 'soil_moist:2:4', 'leaf_wet:2:1', 'leaf_wet:2:2', 'th_indoor', 'baro', 'battery:1', 'battery:2'] ), ] @@ -56,34 +69,33 @@ def _prompt_host(old_host: Optional[str]) -> str: - print("\n") - print("Specify the IP address (e.g. 192.168.1.123) or hostname (e.g. weatherlinklive") - print("or weatherlinklive.localdomain) of the WeatherLink LIVE.)") - print("The device must be reachable via HTTP (TCP port 80) and must be on the same") - print("subnet/VLAN. If this is not the case, 2.5-second live updates will not work") - print("(sent as broadcast packets on UDP port 22222).") + print(""" +Specify the IP address or hostname of the WeatherLink Live. + +The device must be reachable via HTTP (TCP port 80) and must be on the same +subnet/VLAN. +""") return weecfg.prompt_with_options("IP/Hostname", old_host) -def _prompt_mappings() -> List[str]: - print("\n") - print("""WeeWX uses a configurable but fixed database schema to store the recorded data. -WeatherLink LIVE however allows an arbitrary combination of transmitter types -and sensors. There is no way to automatically determine the sensors connected. +def _prompt_mappings(old_mappings: List[str]) -> List[str]: + print(""" +Please choose the mapping template you wish to use. This will determine how +the sensors are mapped to WeeWX values. -Because of this, the mappings from WeatherLink LIVE sensors to WeeWX have to be -manually configured. The following interactive menu allows you to choose from -templates. You can customize them manually later. +Choosing a value here will OVERWRITE the current value! Leave blank to retain +current value. For more details on mappings and how to manually edit them, see the online documentation: -%s""" % _URL_HELP_MAPPING_CONFIGURATION) +%s +""" % _URL_HELP_MAPPING_CONFIGURATION) _print_mapping_templates_menu() template_no = weecfg.prompt_with_options("Use template (blank for none)", "", [*[str(i) for i in range(0, len(_MAPPINGS_TEMPLATES))], ""]) if len(template_no) <= 0: - return [] + return old_mappings template_idx = int(template_no) return _MAPPINGS_TEMPLATES[template_idx][1] @@ -96,26 +108,16 @@ def _print_mapping_templates_menu(): print("%3s: %s" % (str(i), title)) -def _print_mappings_exists() -> None: - print("\n") - print("""There are already some configured mappings. You can customize them manually -by editing the WeeWX configuration file. - -For more details on mappings and how to manually edit them, see the online -documentation: -%s""" % _URL_HELP_MAPPING_CONFIGURATION) - - def _print_mapping_table_info(): - print("\n") - print("""You can display all mappings by running the following command: -$ wee_device --print-mapping""") + print(""" +You can display all mappings by running the following command: + + $ weectl device --print-mapping""") def _print_schema_info(): - print("\n") - print("""In order to utilize the full potential of your WeatherLink LIVE, you should use -the database schema included with this driver. + print(""" +It is recommended that you use the database schema included with this driver. See the installation manual for detailed instructions: %s""" % _URL_HELP_INSTALLATION) @@ -127,25 +129,7 @@ def __init__(self): @property def default_stanza(self): - return """ -# This section configures the WeatherLink Live driver - -[WeatherLinkLive] - # Driver module - driver = user.weatherlink_live - - # Host name or IP address of WeatherLink Live - host = weatherlinklive - - # Mapping of transmitter ids to WeeWX records - mapping = , - - # Whether to log successful operations. Overrides top-level setting. - #log_success = False - - # Whether to log unsuccessful operations. Overrides top-level setting. - #log_failure = True -""" + return WLL_CONFIG def prompt_for_settings(self) -> Dict[str, Any]: settings = self.existing_options @@ -156,21 +140,17 @@ def prompt_for_settings(self) -> Dict[str, Any]: settings['host'] = host mapping_def_cfg_list = to_list(settings.get('mapping', [])) - if len(mapping_def_cfg_list) <= 0: - mapping_def_cfg_list = _prompt_mappings() - settings['mapping'] = mapping_def_cfg_list - else: - _print_mappings_exists() + mapping_def_cfg_list = _prompt_mappings(mapping_def_cfg_list) + settings['mapping'] = mapping_def_cfg_list _print_mapping_table_info() - _print_schema_info() return settings def modify_config(self, config_dict): print("\n") - print("""Configuring accumulators for custom types.""") + print("Configuring accumulators for custom types.") config_dict.setdefault('Accumulator', {}) diff --git a/bin/user/weatherlink_live/configuration.py b/bin/user/weatherlink_live/configuration.py index cdbe119..92e72e5 100644 --- a/bin/user/weatherlink_live/configuration.py +++ b/bin/user/weatherlink_live/configuration.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bin/user/weatherlink_live/configurator.py b/bin/user/weatherlink_live/configurator.py index 82edbcd..0ffac1f 100644 --- a/bin/user/weatherlink_live/configurator.py +++ b/bin/user/weatherlink_live/configurator.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bin/user/weatherlink_live/data_host.py b/bin/user/weatherlink_live/data_host.py index 7dab543..abcc5f4 100644 --- a/bin/user/weatherlink_live/data_host.py +++ b/bin/user/weatherlink_live/data_host.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bin/user/weatherlink_live/davis_broadcast.py b/bin/user/weatherlink_live/davis_broadcast.py index b4044e8..b3fe674 100644 --- a/bin/user/weatherlink_live/davis_broadcast.py +++ b/bin/user/weatherlink_live/davis_broadcast.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bin/user/weatherlink_live/davis_http.py b/bin/user/weatherlink_live/davis_http.py index 2b2af12..5ec30e3 100644 --- a/bin/user/weatherlink_live/davis_http.py +++ b/bin/user/weatherlink_live/davis_http.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bin/user/weatherlink_live/db_schema.py b/bin/user/weatherlink_live/db_schema.py index f540961..9910461 100644 --- a/bin/user/weatherlink_live/db_schema.py +++ b/bin/user/weatherlink_live/db_schema.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bin/user/weatherlink_live/driver.py b/bin/user/weatherlink_live/driver.py index 5cb1e39..d716332 100644 --- a/bin/user/weatherlink_live/driver.py +++ b/bin/user/weatherlink_live/driver.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bin/user/weatherlink_live/mappers.py b/bin/user/weatherlink_live/mappers.py index 8d0dfa8..87ee0f8 100644 --- a/bin/user/weatherlink_live/mappers.py +++ b/bin/user/weatherlink_live/mappers.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bin/user/weatherlink_live/packets.py b/bin/user/weatherlink_live/packets.py index 4bf1b5b..5450ee4 100644 --- a/bin/user/weatherlink_live/packets.py +++ b/bin/user/weatherlink_live/packets.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bin/user/weatherlink_live/scheduler.py b/bin/user/weatherlink_live/scheduler.py index 8237136..d09794f 100644 --- a/bin/user/weatherlink_live/scheduler.py +++ b/bin/user/weatherlink_live/scheduler.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bin/user/weatherlink_live/service.py b/bin/user/weatherlink_live/service.py index 3059dbe..338c6e4 100644 --- a/bin/user/weatherlink_live/service.py +++ b/bin/user/weatherlink_live/service.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bin/user/weatherlink_live/static/__init__.py b/bin/user/weatherlink_live/static/__init__.py index 77a87e9..765c36b 100644 --- a/bin/user/weatherlink_live/static/__init__.py +++ b/bin/user/weatherlink_live/static/__init__.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bin/user/weatherlink_live/static/config.py b/bin/user/weatherlink_live/static/config.py index 77cbc10..6ed98d4 100644 --- a/bin/user/weatherlink_live/static/config.py +++ b/bin/user/weatherlink_live/static/config.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bin/user/weatherlink_live/static/labels.py b/bin/user/weatherlink_live/static/labels.py index aac0d54..3d49ec1 100644 --- a/bin/user/weatherlink_live/static/labels.py +++ b/bin/user/weatherlink_live/static/labels.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bin/user/weatherlink_live/static/packets.py b/bin/user/weatherlink_live/static/packets.py index e67dbc0..999a768 100644 --- a/bin/user/weatherlink_live/static/packets.py +++ b/bin/user/weatherlink_live/static/packets.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bin/user/weatherlink_live/static/targets.py b/bin/user/weatherlink_live/static/targets.py index 5adb9f4..1866fbb 100644 --- a/bin/user/weatherlink_live/static/targets.py +++ b/bin/user/weatherlink_live/static/targets.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bin/user/weatherlink_live/static/version.py b/bin/user/weatherlink_live/static/version.py index 7df321b..c85f093 100644 --- a/bin/user/weatherlink_live/static/version.py +++ b/bin/user/weatherlink_live/static/version.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -20,4 +20,4 @@ DRIVER_NAME = "WeatherLinkLive" -DRIVER_VERSION = "1.1.2" +DRIVER_VERSION = "1.1.3" diff --git a/bin/user/weatherlink_live/utils.py b/bin/user/weatherlink_live/utils.py index a864409..69e75dc 100644 --- a/bin/user/weatherlink_live/utils.py +++ b/bin/user/weatherlink_live/utils.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bin/user/weatherlink_live_driver.py b/bin/user/weatherlink_live_driver.py index 455c651..bf81886 100644 --- a/bin/user/weatherlink_live_driver.py +++ b/bin/user/weatherlink_live_driver.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -17,9 +17,15 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +import logging from . import weatherlink_live +_logger = logging.getLogger(__name__) + +_logger.warning("Using driver \"%s\" is deprecated! Use \"%s\" instead." % ("user.weatherlink_live_driver", + "user.weatherlink_live")) + DRIVER_NAME = weatherlink_live.DRIVER_NAME DRIVER_VERSION = weatherlink_live.DRIVER_VERSION diff --git a/changes.md b/changes.md index 9f06468..a47a14e 100644 --- a/changes.md +++ b/changes.md @@ -182,3 +182,22 @@ Driver is now compatible with **Python 3.7 or later**. ## Version 1.1.2 - **Fix installation issue** on WeeWX 5 beta + +## Version 1.1.3 + +- **Update documentation for WeeWX 5** + +- **Add an [Upgrade guide](docs/upgrading.md)** + +- **Deprecate driver alias module** + + The driver alias module `user.weatherlink_live_driver` is no longer necessary in WeeWX 5 and will be removed in a future release. See [Upgrade guide](docs/upgrading.md) for more information. + +- **Simplify the configuration prompts** + + Some of text was removed to make the process less intimidating ... Also the mapping template prompt now always appears. + +- **The extension installer will now add an example config.** + + The snippet contains sensible defaults for a WeatherLink Live with a standard Vantage Pro II Plus. + diff --git a/docs/configuration.md b/docs/configuration.md index f878d0a..032abf3 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -48,7 +48,7 @@ This document is a reference for all available configuration options. driver = user.weatherlink_live_driver # Host name or IP address of WeatherLink Live - host = weatherlinklive.localdomain + host = weatherlinklive # Mapping of transmitter ids to WeeWX records mapping = th:1, rain:1, wind:1, windchill:1, solar:1, uv:1, thw:1, thsw:1:appTemp, th_indoor, baro, battery:1:outTemp:rain:wind @@ -101,7 +101,7 @@ The interval in seconds to wait between retrieving a full data update from the W Count of iterations without any data to tolerate before raising an error. -The driver checks for the availability of new data at least every 5 secons. If no data is available for the specified number of iterations, an error is raised. +The driver checks for the availability of new data at least every 5 seconds. If no data is available for the specified number of iterations, an error is raised. ### `log_success` @@ -310,7 +310,7 @@ The second option specifies the port to which the sensor is connected (1 or 2). Maps battery status value (`0` or `1`). -Optionally, further mapping options can be specified. These will lead to the status being mapped to additional metrics provided by WeeWX. This is useful for displaying the battery status in the default WeeWX skin. +Optionally, further mapping options can be specified. These will lead to the status being mapped to additional metrics provided by WeeWX. #### Indoor temperature/humidity @@ -335,7 +335,7 @@ Maps sea-level and absolute barometric pressure. If you wish to **inspect the configured mappings**, you can run the following command to display a table of assignments from sensors to WeeWX metrics. ```sh -> wee_device --print-mapping +> weectl device --print-mapping ``` ### Example mappings @@ -347,7 +347,7 @@ _Note:_ These examples correspond to the templates provided by the interactive s This example is a valid mapping for a factory-default Vantage2 Pro. All sensors are connected to the main ISS transmitter set to id 1. ```ini -mapping = th:1, rain:1, wind:1, windchill:1, thw:1:appTemp, battery:1:outTemp:rain:wind, th_indoor, baro +mapping = th:1, rain:1, wind:1, windchill:1, thw:1:appTemp, battery:1, th_indoor, baro ``` #### Vantage Pro2 Plus @@ -355,7 +355,7 @@ mapping = th:1, rain:1, wind:1, windchill:1, thw:1:appTemp, battery:1:outTemp:ra This example is a valid mapping for a factory-default Vantage2 Pro Plus. All sensors are connected to the main ISS transmitter set to id 1. ```ini -mapping = th:1, rain:1, wind:1, uv:1, solar:1, windchill:1, thw:1, thsw:1:appTemp, th_indoor, baro, battery:1:outTemp:rain:wind:uv +mapping = th:1, rain:1, wind:1, uv:1, solar:1, windchill:1, thw:1, thsw:1:appTemp, th_indoor, baro, battery:1 ``` #### Vantage Pro2 Plus with additional anemometer transmitter @@ -365,7 +365,7 @@ Same as above, except the wind sensor is connected to a separate transmitter wit Note that there is a configuration option on WeatherLink.com to import the wind measurement into the measurements of the main transmitter. If you enable this, the wind chill, THW and THSW values will still be calculated. Otherwise they should be removed from the mapping. ```ini -mapping = th:1, rain:1, wind:2, uv:1, solar:1, windchill:1, thw:1, thsw:1:appTemp, th_indoor, baro, battery:1:outTemp:rain:uv, battery:2:wind +mapping = th:1, rain:1, wind:2, uv:1, solar:1, windchill:1, thw:1, thsw:1:appTemp, th_indoor, baro, battery:1, battery:2 ``` #### Vantage Pro2 Plus with soil/leaf station @@ -373,5 +373,5 @@ mapping = th:1, rain:1, wind:2, uv:1, solar:1, windchill:1, thw:1, thsw:1:appTem Same as the second example with an additional (fully equipped) soil/leaf station. The agriculture station has the transmitter id 2. ```ini -mapping = th:1, rain:1, wind:1, uv:1, solar:1, windchill:1, thw:1, thsw:1:appTemp, soil_temp:2:1, soil_temp:2:2, soil_temp:2:3, soil_temp:2:4, soil_moist:2:1, soil_moist:2:2, soil_moist:2:3, soil_moist:2:4, leaf_wet:2:1, leaf_wet:2:2, th_indoor, baro, battery:1:outTemp:wind:uv, battery:2:tx +mapping = th:1, rain:1, wind:1, uv:1, solar:1, windchill:1, thw:1, thsw:1:appTemp, soil_temp:2:1, soil_temp:2:2, soil_temp:2:3, soil_temp:2:4, soil_moist:2:1, soil_moist:2:2, soil_moist:2:3, soil_moist:2:4, leaf_wet:2:1, leaf_wet:2:2, th_indoor, baro, battery:1, battery:2 ``` diff --git a/docs/installation.md b/docs/installation.md index 2d0ba72..bc455f0 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -17,79 +17,81 @@ In order for this driver to work properly, the WeatherLink Live has to be on the If you have simply connected both devices to your home WiFi or router, this is probably the case automatically. -Users that make use of these advanced features have to ensure that WeeWX can connect to the WeatherLink Live via HTTP (TCP port `80`). Additionally, the WeatherLink Live sends real-time updates by broadcasting on UDP port `22222`. +Users of an advanced network setup have to ensure that WeeWX can connect to the WeatherLink Live via HTTP (TCP port `80`). Additionally, the WeatherLink Live sends real-time updates by broadcasting on UDP port `22222`. ## Prerequisites If you haven't done so already, install the following packages: -- **Python 3.7** or later: WeeWX itself can run on either Python 2 or 3. This driver however requires Python 3.7 or later. -- **WeeWX** including all of its dependencies +- **Python 3.7** or later +- **WeeWX 5** including all of its dependencies - **Python module `requests`**: This driver uses the Python `requests` module for communicating with the WeatherLink device. ## Installing the driver -1. Download the newest release of the driver from the [Releases section](https://github.com/michael-slx/weewx-weatherlink-live/releases). - -2. On the WeeWX device, install the extension by running the following command, possibly using `sudo`. - -Replace the file name with the actual name of the file you downloaded in the previous step. +1. Install the extension by running the following command, possibly using `sudo`. ```sh -# Replace file name -> wee_extension --install=weewx-weatherlink-live.tar.xz +> weectl extension install https://github.com/michael-slx/weewx-weatherlink-live/releases/download/v1.1.3/weewx-weatherlink-live-v1.1.3.tar.xz ``` +Answer `y` (Yes), when asked if you want to install the extension. + 3. Reconfigure WeeWX by running the following command, possibly using `sudo`. ```sh -> wee_config --reconfigure +> weectl station reconfigure ``` 4. Answer all promots by providing information about your location, altitude, etc.. -5. When asked to choose a driver, select **WeatherLinkLive (`user.weatherlink_live_driver`)**. +5. When asked to choose a driver, select **WeatherLinkLive (`user.weatherlink_live`)**. + +Please ignore the second WeatherLinkLive entry (ending in `_driver`). It is only there for backwards-compatibility with old configuration from WeeWX 4. If you happen to choose this, you will get a warning in your log file. **Example:** ``` -Installed drivers include: - 0) WeatherLinkLive (user.weatherlink_live_driver) - 1) AcuRite (weewx.drivers.acurite) - 2) CC3000 (weewx.drivers.cc3000) - 3) FineOffsetUSB (weewx.drivers.fousb) - 4) Simulator (weewx.drivers.simulator) - 5) TE923 (weewx.drivers.te923) - 6) Ultimeter (weewx.drivers.ultimeter) - 7) Vantage (weewx.drivers.vantage) - 8) WMR100 (weewx.drivers.wmr100) - 9) WMR300 (weewx.drivers.wmr300) - 10) WMR9x8 (weewx.drivers.wmr9x8) - 11) WS1 (weewx.drivers.ws1) - 12) WS23xx (weewx.drivers.ws23xx) - 13) WS28xx (weewx.drivers.ws28xx) -choose a driver [4]: 0 +Choose a driver. Installed drivers include: + 0) WeatherLinkLive (user.weatherlink_live) + 1) WeatherLinkLive (user.weatherlink_live_driver) + 2) AcuRite (weewx.drivers.acurite) + 3) CC3000 (weewx.drivers.cc3000) + 4) FineOffsetUSB (weewx.drivers.fousb) + 5) Simulator (weewx.drivers.simulator) + 6) TE923 (weewx.drivers.te923) + 7) Ultimeter (weewx.drivers.ultimeter) + 8) Vantage (weewx.drivers.vantage) + 9) WMR100 (weewx.drivers.wmr100) + 10) WMR300 (weewx.drivers.wmr300) + 11) WMR9x8 (weewx.drivers.wmr9x8) + 12) WS1 (weewx.drivers.ws1) + 13) WS23xx (weewx.drivers.ws23xx) + 14) WS28xx (weewx.drivers.ws28xx) +driver [5]: 0 ``` -6. Enter the **IP address or hostname** of your WeatherLink Live. +1. Enter the **IP address or hostname** of your WeatherLink Live. If you do not know this, you can look it up in the WeatherLink app, on WeatherLink.com or on the configuration interface of your router. **Example:** ``` -IP/Hostname: weatherlinklive.localdomain +IP/Hostname: weatherlinklive ``` 7. Choose a mapping template. Unfortunately, there is no way to automatically detect which combination of transmitters and sensors you have connected to your WeatherLink Live. Therefore it is necessary to manually configure the assignment of measurements to WeeWX metrics. -These assignments are combined into logical groups called "mappings". Depending on the type of mapping, each mapping may require additional configuration such as the transmitter id. +These assignments are combined into groups called "mappings". Depending on the type of mapping, additional configuration such as the transmitter id may be required. To ease initial setup, this driver provides mapping templates for the most common sensor configurations. -Choose one of the templates when the respective prompt appears during the configuration process. Enter no answer if you do not wish to use any template. The prompt only appears if there's no mapping configured. +Choose one of the templates when the respective prompt appears during the configuration process. + +The chosen template will overwrite any existing configuration. Enter no answer if you do not wish to use any template. Additional information on how to manually configure mappings can be found in the dedicated [Configuration documentation](configuration.md). @@ -104,10 +106,10 @@ Mapping templates: Use template (blank for none) []: 1 ``` -8. If you wish to **inspect the configured mappings**, you can run the following command to display a table of assignments from sensors to WeeWX metrics. +1. If you wish to **inspect the configured mappings**, you can run the following command to display a table of assignments from sensors to WeeWX metrics. ```sh -> wee_device --print-mapping +> weectl device --print-mapping ``` 9. Switch to custom database schema. @@ -119,4 +121,4 @@ The schema is called ``user.weatherlink_live.schema` ## Further configuration -If you want to further customize your configuration, you can find additional instructions in the [Configuration reference](configuration.md). \ No newline at end of file +If you want to further customize your configuration, you can find additional instructions in the [Configuration reference](configuration.md). diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index e0678af..c54b961 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -14,7 +14,7 @@ If you are unsure which sensor value will be stored in which metric, you can display the mapping table by running the following command: ```sh -> wee_device --print-mapping +> weectl device --print-mapping ``` ## Manually inspecting data diff --git a/docs/upgrading.md b/docs/upgrading.md new file mode 100644 index 0000000..b0aa357 --- /dev/null +++ b/docs/upgrading.md @@ -0,0 +1,34 @@ +# Upgrade guide + +Generally, upgrading this driver only requires downloading and installing the new package using `weectl`. Any additional steps required, will be documented below. If the respective *target* version is not listed, no additional steps are necessary. + +If you are also upgrading WeeWX itself, consult the WeeWX Upgrade guide and follow the instructions there. + +## Contents + +- [Contents](#contents) +- [Upgrading to version 1.1.3 (on WeeWX 5)](#upgrading-to-version-113-on-weewx-5) + +## Upgrading to version 1.1.3 (on WeeWX 5) + +If the `driver` option of the `WeatherLinkLive` section in the configuration file is `user.weatherlink_live_driver`, change it to `user.weatherlink_live`. +No changes are required, if it already is `user.weatherlink_live`. + +```ini +[WeatherLinkLive] + # This section configures the WeatherLink Live driver. + + # Driver module + #driver = user.weatherlink_live_driver # <-- Old line + driver = user.weatherlink_live # <-- New line + + # Host name or IP address of WeatherLink Live + host = weatherlink_live + + # Mapping of transmitter ids to WeeWX records + mapping = th:1, rain:1, wind:1, uv:1, solar:1, windchill:1, thw:1, thsw:1:appTemp, th_indoor, baro, battery:1 + +``` + +The old value is deprecated and will be removed in version 1.2. + diff --git a/install.py b/install.py index 66a9aae..d97e651 100644 --- a/install.py +++ b/install.py @@ -1,4 +1,4 @@ -# Copyright © 2020-2023 Michael Schantl and contributors +# Copyright © 2020-2024 Michael Schantl and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -18,9 +18,13 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -''' +""" WeeWX extension installer -''' +""" + +from io import StringIO + +import configobj from weecfg.extension import ExtensionInstaller @@ -29,11 +33,51 @@ def loader(): return WeatherLinkLiveInstaller() +WLL_CONFIG = """ +[Station] + # This section is for information about the station. + + # Set to type of station hardware. There must be a corresponding stanza + # in this file, which includes a value for the 'driver' option. + station_type = WeatherLinkLive + +############################################################################## + +[WeatherLinkLive] + # This section configures the WeatherLink Live driver. + + # Driver module + driver = user.weatherlink_live + + # Host name or IP address of WeatherLink Live + host = weatherlink_live + + # Mapping of transmitter ids to WeeWX records + mapping = th:1, rain:1, wind:1, uv:1, solar:1, windchill:1, thw:1, thsw:1:appTemp, th_indoor, baro, battery:1 + +############################################################################## + +[Accumulator] + # This section configures how measurements are accumulated. + + # Measurement rainCount: Count of rain spoon trips + # Accumulated by summing all values + [[rainCount]] + extractor = sum + + # Measurement rainSize: Size of rain spoon + # Accumulated by using last value + [[rainSize]] + extractor = last +""" +wll_config_dict = configobj.ConfigObj(StringIO(WLL_CONFIG)) + + class WeatherLinkLiveInstaller(ExtensionInstaller): def __init__(self): super(WeatherLinkLiveInstaller, self).__init__( name='weatherlink-live', - version="1.1.2", + version="1.1.3", description='WeeWX driver for Davis WeatherLink Live.', author="Michael Schantl", author_email="floss@schantl-lx.at", @@ -67,5 +111,5 @@ def __init__(self): 'bin/user/weatherlink_live/static/version.py', ]), ], - config=dict(), + config=wll_config_dict, ) diff --git a/readme.md b/readme.md index 0208d0f..424bc70 100644 --- a/readme.md +++ b/readme.md @@ -8,7 +8,7 @@ Unfortunately the WeatherLink Live currently does not provide a local API to acc An API is available for WeatherLink subscribers. This driver does however not support this interface. You also need to ensure that the WeatherLink Live is on the same LAN subnet as WeeWX, so that UDP broadcasts can be received. -This driver requires **WeeWX 4** or **5**, **Python 3.7** (or later) and the Python **`requests` module**. +This driver requires **WeeWX 5**, **Python 3.7** (or later) and the Python **`requests` module**. ## Contents @@ -21,6 +21,7 @@ This driver requires **WeeWX 4** or **5**, **Python 3.7** (or later) and the Pyt ## Documentation - [**Installation manual**](docs/installation.md) +- [**Upgrade guide**](docs/upgrading.md) - [**Configuration reference**](docs/configuration.md) - [**Troubleshooting**](docs/troubleshooting.md) diff --git a/vm/bin/driver-install-extension.sh b/vm/bin/driver-install-extension.sh index 1f2bd7c..7a41eb9 100644 --- a/vm/bin/driver-install-extension.sh +++ b/vm/bin/driver-install-extension.sh @@ -1,21 +1,17 @@ #!/usr/bin/env bash set -e -DRV_TMP_DIR="/tmp/weewx-weatherlink-live-drv" +SRC_DIR="/vagrant" -[[ ! -e "$DRV_TMP_DIR" ]] || sudo rm -fR "$DRV_TMP_DIR" -mkdir -p "$DRV_TMP_DIR" - -cp -R /vagrant/* "$DRV_TMP_DIR" - -if [[ -d "/usr/lib/weewx/user" ]]; then - sudo wee_extension --install="$DRV_TMP_DIR" +declare sudo_cmd +if [[ -d "/usr/lib/weewx/bin/user" ]]; then + sudo_cmd="sudo" elif [[ -d "$HOME/weewx-data/bin/user" ]]; then - weectl extension install "$DRV_TMP_DIR" + sudo_cmd="" else - echo "Could not determine target WeeWX version" + echo "Could not determine target directory" echo "Have you installed WeeWX?" exit 2 fi -[[ -e "$DRV_TMP_DIR" ]] && sudo rm -fR "$DRV_TMP_DIR" +$sudo_cmd weectl extension install "$SRC_DIR" --yes diff --git a/vm/bin/driver-install-files.sh b/vm/bin/driver-install-files.sh index 7ccbf60..694812a 100644 --- a/vm/bin/driver-install-files.sh +++ b/vm/bin/driver-install-files.sh @@ -1,21 +1,16 @@ #!/usr/bin/env bash set -e -SOURCE_FILES=( - "weatherlink_live_driver.py" - "weatherlink_live" -) - SOURCE_DIR="/vagrant/bin/user" +SOURCE_FILES=("weatherlink_live" "weatherlink_live_driver.py") -declare use_sudo=0 +declare sudo_cmd declare target_dir - -if [[ -d "/usr/lib/weewx/user" ]]; then - use_sudo=1 - target_dir="/usr/lib/weewx/user" +if [[ -d "/usr/lib/weewx/bin/user" ]]; then + sudo_cmd="sudo" + target_dir="/usr/lib/weewx/bin/user" elif [[ -d "$HOME/weewx-data/bin/user" ]]; then - use_sudo=0 + sudo_cmd="" target_dir="$HOME/weewx-data/bin/user" else echo "Could not determine target directory" @@ -23,19 +18,19 @@ else exit 2 fi -echo "Target directory: $target_dir" - for file in "${SOURCE_FILES[@]}"; do source_path="${SOURCE_DIR}/${file}" - target_path="${TARGET_DIR}/${file}" + target_path="${target_dir}/${file}" + echo "$source_path -> $target_path" if [[ -e "$target_path" ]]; then - rm -fR "$target_path" + $sudo_cmd rm -fR "$target_path" fi - if [[ $use_sudo -eq 1 ]]; then - sudo cp -R "$source_path" "$target_dir" + if [[ -d "$source_path" ]]; then + $sudo_cmd mkdir -p "$target_path" + $sudo_cmd cp -R "$source_path"/* "$target_path" else - cp -R "$source_path" "$target_dir" + $sudo_cmd cp -R "$source_path" "$target_path" fi done diff --git a/vm/bin/weewx-install-aur.sh b/vm/bin/weewx-install-aur.sh new file mode 100644 index 0000000..9287aa2 --- /dev/null +++ b/vm/bin/weewx-install-aur.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -e + +yay -S --noconfirm weewx diff --git a/vm/bin/weewx-5-install.sh b/vm/bin/weewx-install-github.sh similarity index 84% rename from vm/bin/weewx-5-install.sh rename to vm/bin/weewx-install-github.sh index 58933e0..b266126 100644 --- a/vm/bin/weewx-5-install.sh +++ b/vm/bin/weewx-install-github.sh @@ -4,7 +4,7 @@ set -e SRC_DIR="$HOME/weewx" REPO_URL="https://github.com/weewx/weewx.git" -REPO_BRANCH="V5" +REPO_BRANCH="master" if [[ ! -d "$SRC_DIR" ]]; then git clone "$REPO_URL" "$SRC_DIR" -b "$REPO_BRANCH" @@ -18,9 +18,10 @@ fi python -m venv ./venv . ./venv/bin/activate -pip install poetry mkdocs mkdocs-material pymdown-extensions make pypi-package deactivate pipx install $SRC_DIR/dist/weewx-5.*.whl pipx inject weewx requests + +weectl station create $HOME/weewx-data --no-prompt diff --git a/vm/bin/weewx-install.sh b/vm/bin/weewx-install.sh deleted file mode 100644 index a69dad5..0000000 --- a/vm/bin/weewx-install.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -e - -PACKAGES=( - "weewx" - "python-pyephem" - "python-requests" -) - -yay -S --noconfirm "${PACKAGES[@]}" diff --git a/vm/provision.sh b/vm/provision.sh index 991d6e0..cf3303b 100644 --- a/vm/provision.sh +++ b/vm/provision.sh @@ -3,15 +3,27 @@ set -e PACKAGES=( + "mkdocs" + "mkdocs-material" + "mkdocs-material-extensions" + "poetry" "python" + "python-cheetah3" + "python-configobj" "python-pip" "python-pipx" + "python-pyephem" + "python-pymysql" + "python-pyserial" + "python-pyusb" + "python-requests" ) PATH_ENTRIES=( "$HOME/.local/bin" "/vagrant/vm/bin" ) +yay -Syy --noconfirm pacman-mirrorlist archlinux-keyring yay -Syyuu --noconfirm "${PACKAGES[@]}" for path_entry in "${PATH_ENTRIES[@]}"; do @@ -31,15 +43,11 @@ cat <