Thanks for figuring that one out, Cameron! Nice sleuthing.

Fixed in commit 3f0d80a
<https://github.com/weewx/weewx/commit/3f0d80a5711431084b8a080b36810a1862565236>
.

-tk

On Wed, Jan 1, 2020 at 2:33 AM Cameron D <[email protected]> wrote:

> Hi Tom,
> 1. the failure to read history on DB initialisation was a trivial change,
> so I will submit that at some stage.
>
> 2. KeyError - a bit of background, the WMR300 unit returns date in
> METRICWX the unit set, which is partly why I chose that for my DB.  So wind
> speed is in m/s and as soon as I return the first new set of data from the
> history, it wants to calculate windrun which is group_distance.   If I used
> METRIC then it converts the speed to km/hour, which might be why it is
> happy with that.
>
> I added a convertion from 'meter' to 'km' in conversionDict in units.py
> and it seems to be happy.
>
> I have attached a log from startup to crash, with various debug lines of
> wmr300.py enabled, so you can see the exception happens as soon as it
> returns the first relevant historical record.
>
>
> On Tuesday, 31 December 2019 21:55:24 UTC+10, Tom Keffer wrote:
>>
>> Thanks, Cameron
>>
>> 1. Can you post the log where this happened?
>>
>> 2. Conversion from meter to km was never possible. Meter is a member of
>> group_altitude, and km is a member of group_distance. Can you give me the
>> context where this happened?
>>
>> -tk
>>
>>
>> On Tue, Dec 31, 2019 at 12:53 AM Cameron D <[email protected]>
>> wrote:
>>
>>> I have just started messing around with the beta 4 code.
>>>
>>> 1. the WMR300 driver seems to be basically working, both standalone
>>> under python3 and as part of weewx to a new sqlite db.  There is one small
>>> problem  -  it is not reading the history from the console because there is
>>> no time to which data was previously stored.  It's only a once-off problem
>>> but I'll see if there's an easy fix.  Once the database has a "last time"
>>> then the read history works as expected.  I would expect the bug is also
>>> present in the old version.
>>>
>>> 2. My system was based on METRICWX - If I configure v4 for that then it
>>> raises a KeyError exception:
>>>
>>>
>>>> ...
>>>   File "/home/weewx/_base/bin/weewx/units.py", line 1190, in convert
>>>     conversion_func = conversionDict[val_t[1]][target_unit_type]
>>> KeyError: 'km'
>>>
>>> and the log file reports:
>>>
>>>  DEBUG weewx.units: Unable to convert from meter to km
>>>
>>>
>>> Using METRIC seems to work fine.
>>> Happy to provide more logs if necessary.
>>>
>>> --
>>> 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/df802b4a-2833-4536-8133-797987f5e4cf%40googlegroups.com
>>> <https://groups.google.com/d/msgid/weewx-development/df802b4a-2833-4536-8133-797987f5e4cf%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/9bcb976a-af3e-4cb5-8854-08262a0508b7%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-development/9bcb976a-af3e-4cb5-8854-08262a0508b7%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/CAPq0zEB6OXns_3pWOBJMGtRP2zt60%3DVZNCFcUwz5tJmBLV5ftA%40mail.gmail.com.

Reply via email to