Thanks Tom...
Tests fine here with the two updated files dropped into place manually. I
also added a comment above [XDR] in my copy of install.py from
weewx-nmea-xdr and it looks perfect after installing with wee_extension.
All the comments and content made it in ok. Uninstalling cleanly works
fine too.
[...unexpected feature alert...]
I just noticed that you can use wee_extension to set/unset global
key=values by installing/uninstalling a pseudo extension.
Example - save the code below as foo/install.py then install with
'wee_extension --install foo' and you'll see it changed debug=0 to debug=1
and there is a 'enable-debug' extension now installed.
I did note that uninstall indeed uninstalls, so if anything you tweak that
is a mandatory variable in weewx.conf that will cause the restart to fail,
so I dunno if that's a big downside of this approach, but it does get me
thinking about wee_extension as maybe a way for componetizing doing
frequently needed things rather than expecting folks to edit weewx.conf
when they aren't Linux editor fluent.
Something like:
- user has issues
- ask them to run 'sudo wee_extension --install
/usr/share/weewx/extensions/enable-debug' then 'sudo sysctl restart weewx'
and get us the logs
- then tell them to run 'sudo wee_extension --uninstall enable-debug' to
reverse things (assuming lack of a debug= line doesn't blow up weewx of
course)
Example below just sets debug=1
#
# example install.py for setting a global variable
# based on the weewx-nmea-xdr example install.py
#
"""Installer for the demo extension"""
try:
# Python 2
from StringIO import StringIO
except ImportError:
# Python 3
from io import StringIO
import configobj
from weecfg.extension import ExtensionInstaller
extension_config = """
# enable weewx debugging
debug=1
"""
extension_dict = configobj.ConfigObj(StringIO(extension_config))
def loader():
return EnableDebugInstaller()
class EnableDebugInstaller(ExtensionInstaller):
def __init__(self):
super(EnableDebugInstaller, self).__init__(
version="0.01",
name='enable-debug',
description='enable debug in weewx.conf.',
author="your name here",
author_email="[email protected]",
config=extension_dict,
files=[]
)
On Monday, December 28, 2020 at 8:08:15 AM UTC-8 Tom Keffer wrote:
> Phew, that turned out to be a lot more complicated than I thought.
> ConfigObj holds any "initial" comments in a different spot.
>
> In any case, fixed in commit 2cc2d56
> <https://github.com/weewx/weewx/commit/2cc2d56202d9bd676b7d9d0af1e9ca2a0c779173>
> .
>
> On Sun, Dec 27, 2020 at 4:26 PM Tom Keffer <[email protected]> wrote:
>
>> Just saw your second message. OK, I'll take a look at it.
>>
>> -tk
>>
>> On Sun, Dec 27, 2020 at 4:23 PM Vince Skahan <[email protected]> wrote:
>>
>>> Tom - more data for you. I did clean setup.py installs of 4.2.0 and
>>> 4.3.0b3 and then used wee_extension to install the weewx-nmea-xdr
>>> installation. The resulting stanza added to weewx is different. The beta
>>> strips all comments. The 4.2.0 behavior is far better even if it did miss
>>> comments at the root level as you mentioned later in the thread in
>>> weewx-users (link)
>>> <https://groups.google.com/g/weewx-user/c/1-GaFz5jsxE>
>>>
>>> (beta 3)
>>> ======
>>> # Options for extension 'xdr'
>>> [XDR]
>>> port = /dev/ttyACM0
>>> baudrate = 9600
>>> timeout = 5
>>> max_packets = 5
>>> [[sensor_map]]
>>> pressure = P
>>> outTemp = C
>>>
>>> (4.2.0)
>>> =====
>>> # Options for extension 'xdr'
>>> [XDR]
>>> # The port where the NMEA source is located. Default is
>>> '/dev/ttyACM0'
>>> port = /dev/ttyACM0
>>> # Its baudrate. Default is '9600'.
>>> baudrate = 9600
>>> # How long to wait for an XDR packet before giving up. Default is 5
>>> seconds.
>>> timeout = 5
>>> # Max number of NMEA packets to process during a LOOP event. Default
>>> is 5 packets
>>> max_packets = 5
>>>
>>> # Map from weewx names to sensor names. Only these types will be
>>> processed.
>>> # Typical sensor map:
>>> [[sensor_map]]
>>> pressure = P
>>> outTemp = C
>>>
>>>
>>> On Sunday, December 27, 2020 at 2:13:02 PM UTC-8 Vince Skahan wrote:
>>>
>>>> Tom - did that extension installer update to write out all the comments
>>>> from install.py into weewx.conf make it in ?
>>>>
>>>> I'm testing by installing/uninstalling
>>>> https://github.com/tkeffer/weewx-nmea-xdr.git as the extension to use.
>>>> wee_extension seems to be stripping all the comments in xdr_config out
>>>> when
>>>> wee_extension installs the extension. The idea of course was to include
>>>> the comments when adding the stuff to weewx.conf.
>>>>
>>>> On Saturday, December 26, 2020 at 2:10:41 PM UTC-8 Tom Keffer wrote:
>>>>
>>>>> Version 4.3.0b3 is now available. This is likely to be the last beta
>>>>> before general release.
>>>>>
>>>>> On Wed, Dec 23, 2020 at 6:58 AM Andy <[email protected]> wrote:
>>>>>
>>>>>> moved to mariadb today.
>>>>>>
>>>>>> <pre class="prettyprint">
>>>>>> 75002 records transferred from source database 'kcameadow21.sdb' to
>>>>>> destination database 'weewx' in 262.91 seconds.
>>>>>> </pre>
>>>>>> On Tuesday, December 22, 2020 at 12:58:17 PM UTC-8 Andy wrote:
>>>>>>
>>>>>>> I found the guide in the dev branch of the weewx repo.
>>>>>>>
>>>>>>> Andy
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Dec 22, 2020 at 12:23 PM Andy <[email protected]> wrote:
>>>>>>>
>>>>>>>> Changed how various undocumented parameters in [StdWXCalculate] are
>>>>>>>> specified.
>>>>>>>> The only one people are likely to have used is 'ignore_zero_wind'.
>>>>>>>> Its name has
>>>>>>>> changed to 'force_null', and it has been moved. See the Upgrading
>>>>>>>> Guide.
>>>>>>>>
>>>>>>>> Where is the beta Upgrading Guide?
>>>>>>>> On Saturday, December 19, 2020 at 6:20:27 AM UTC-8 Tom Keffer wrote:
>>>>>>>>
>>>>>>>>> Things are mostly under control, but what is undertested is MySQL.
>>>>>>>>> I've tested pretty thoroughly under Debian, but only sporadically
>>>>>>>>> under
>>>>>>>>> CentOS, and not at all under suse.
>>>>>>>>>
>>>>>>>>> -tk
>>>>>>>>>
>>>>>>>>> On Fri, Dec 18, 2020 at 6:45 PM Vince Skahan <[email protected]>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Tom - do you need this one checked on the usual os suspects
>>>>>>>>>> (centos/debian/ubuntu of both systemd+init.d variants) or is it safe
>>>>>>>>>> to
>>>>>>>>>> assume that you guys have already run the usual checks for os
>>>>>>>>>> variances ?
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>>
>>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>>>> Groups "weewx-development" group.
>>>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>>>> send an email to [email protected].
>>>>>>>>>>
>>>>>>>>> To view this discussion on the web visit
>>>>>>>>>> https://groups.google.com/d/msgid/weewx-development/acda9bca-e34f-45fe-a524-7fb0cebfbc83n%40googlegroups.com
>>>>>>>>>>
>>>>>>>>>> <https://groups.google.com/d/msgid/weewx-development/acda9bca-e34f-45fe-a524-7fb0cebfbc83n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>>>> .
>>>>>>>>>>
>>>>>>>>> --
>>>>>>>>
>>>>>>> You received this message because you are subscribed to a topic in
>>>>>>>> the Google Groups "weewx-development" group.
>>>>>>>> To unsubscribe from this topic, visit
>>>>>>>> https://groups.google.com/d/topic/weewx-development/8UbCU0aODJc/unsubscribe
>>>>>>>> .
>>>>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>>>>> [email protected].
>>>>>>>> To view this discussion on the web visit
>>>>>>>> https://groups.google.com/d/msgid/weewx-development/bcef8fa2-4dd5-4ef4-90e6-56792e9b9f8bn%40googlegroups.com
>>>>>>>>
>>>>>>>> <https://groups.google.com/d/msgid/weewx-development/bcef8fa2-4dd5-4ef4-90e6-56792e9b9f8bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>> .
>>>>>>>>
>>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "weewx-development" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>>
>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/weewx-development/e954db00-1c9a-47eb-8006-76d5acb8badan%40googlegroups.com
>>>>>>
>>>>>> <https://groups.google.com/d/msgid/weewx-development/e954db00-1c9a-47eb-8006-76d5acb8badan%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "weewx-development" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/weewx-development/85895566-1040-4cf0-b8e6-8fc0a9c4d0c9n%40googlegroups.com
>>>
>>> <https://groups.google.com/d/msgid/weewx-development/85895566-1040-4cf0-b8e6-8fc0a9c4d0c9n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-development/1b93edec-b131-4e34-8f1f-aa001954a47bn%40googlegroups.com.