Sorry for the wrong answer!

On Fri, Apr 9, 2021 at 3:05 PM Tom Keffer <[email protected]> wrote:

> You had the right idea, but we have to be careful about values that are
> encoded in only two bytes.
>
> Try this version.
>
> -tk
>
> On Fri, Apr 9, 2021 at 8:50 AM Chris Thompstone <
> [email protected]> wrote:
>
>> Don't worry, I think I may have patched it.  I'm not really much of a
>> coder (although can do some stuff)...
>> Modded your file.  see line 345 onwards.
>> See attached
>>
>> On Friday, 9 April 2021 at 16:36:35 UTC+1 [email protected] wrote:
>>
>>> Sorry. I’ll try to get an update out later today.
>>>
>>> On Fri, Apr 9, 2021 at 8:18 AM Chris Thompstone <[email protected]>
>>> wrote:
>>>
>>>>
>>>> just tried that and get:
>>>> Apr  9 16:17:18 weewx weewx[1719] DEBUG weewx.drivers.ultimeter: Close
>>>> serial port /dev/ttyUSB0
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__: Caught
>>>> unrecoverable exception:
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****
>>>> startswith first arg must be bytes or a tuple of bytes, not str
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****
>>>> Traceback (most recent call last):
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****    File
>>>> "/home/weewx/bin/weewx/drivers/ultimeter.py", line 346, in _decode
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****      v =
>>>> int(s, 16)
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****
>>>> ValueError: invalid literal for int() with base 16: b'----'
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****  During
>>>> handling of the above exception, another exception occurred:
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****
>>>> Traceback (most recent call last):
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****    File
>>>> "/home/weewx/bin/weewxd", line 157, in main
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****
>>>> engine.run()
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****    File
>>>> "/home/weewx/bin/weewx/engine.py", line 208, in run
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****      for
>>>> packet in self.console.genLoopPackets():
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****    File
>>>> "/home/weewx/bin/weewx/drivers/ultimeter.py", line 132, in genLoopPackets
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****      data
>>>> = Station.parse_readings(readings)
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****    File
>>>> "/home/weewx/bin/weewx/drivers/ultimeter.py", line 317, in parse_readings
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****
>>>> data['inHumidity'] = Station._decode(buf[28:32], 0.1)  # percent
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****    File
>>>> "/home/weewx/bin/weewx/drivers/ultimeter.py", line 354, in _decode
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****      if
>>>> not s. startswith('--'):
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****
>>>> TypeError: startswith first arg must be bytes or a tuple of bytes, not str
>>>> Apr  9 16:17:19 weewx weewx[1719] CRITICAL __main__:     ****  Exiting.
>>>>
>>>> On Friday, 9 April 2021 at 16:03:24 UTC+1 [email protected] wrote:
>>>>
>>>>> The driver should work fine with Python 3.
>>>>>
>>>>> However, the driver has a small, non-functional bug that causes it to
>>>>> emit that error message when it encounters a "dash" value. It's
>>>>> non-functional because it emits the right value ("None"). It just 
>>>>> shouldn't
>>>>> log an error.
>>>>>
>>>>> Try this version. I've taken the occasion of having a real, live
>>>>> Ultimeter user to also fix some ambiguities around byte array types. Let 
>>>>> me
>>>>> know if it works.
>>>>>
>>>>> -tk
>>>>>
>>>>> On Fri, Apr 9, 2021 at 7:26 AM Chris Thompstone <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Oh, the ultimeter isn't supported on Python 3 and ver 4 weewx ?
>>>>>> Is that what your saying?
>>>>>> Oh, had not planned on that.
>>>>>> I found some sort of error in my template, which I've kind of
>>>>>> resolved.
>>>>>> But the Ultimeter driver... not sure on this one.
>>>>>> Thanks
>>>>>> Chris
>>>>>>
>>>>>> On Friday, 9 April 2021 at 15:20:41 UTC+1 [email protected] wrote:
>>>>>>
>>>>>>> Looks like you switched to Python 3 from Python 2.7 and the driver
>>>>>>> isn't compatible, based on the error message.
>>>>>>>
>>>>>>> On Fri, Apr 9, 2021 at 6:56 AM Chris Thompstone <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> Hi Guys,
>>>>>>>> I have been trying to upgrade to version 4 since my Pi decided to
>>>>>>>> throw a strop.
>>>>>>>> Anyway, it's been fairly hardwork.
>>>>>>>>
>>>>>>>> I have this message continuous in the logs:
>>>>>>>> DEBUG weewx.drivers.ultimeter: Decode failed for '----': invalid
>>>>>>>> literal for int() with base 16: '----'
>>>>>>>> just coming every 1s or so.
>>>>>>>>
>>>>>>>> I also have some other issue which I can't seem to find:
>>>>>>>> ERROR weewx.cheetahgenerator: Generate failed with exception
>>>>>>>> '<class 'TypeError'>'
>>>>>>>> Apr  9 14:45:16 weewx weewx[868] ERROR weewx.cheetahgenerator: ****
>>>>>>>> Ignoring template /home/weewx/skins/Standard/index.html.tmpl
>>>>>>>> Apr  9 14:45:16 weewx weewx[868] ERROR weewx.cheetahgenerator: ****
>>>>>>>> Reason: '>' not supported between instances of 'NoneType' and 'float'
>>>>>>>> Apr  9 14:45:16 weewx weewx[868] ERROR weewx.cheetahgenerator:
>>>>>>>> ****  Traceback (most recent call last):
>>>>>>>> Apr  9 14:45:16 weewx weewx[868] ERROR weewx.cheetahgenerator:
>>>>>>>> ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 326, in
>>>>>>>> generate
>>>>>>>> Apr  9 14:45:16 weewx weewx[868] ERROR weewx.cheetahgenerator:
>>>>>>>> ****      unicode_string = compiled_template.respond()
>>>>>>>> Apr  9 14:45:16 weewx weewx[868] ERROR weewx.cheetahgenerator:
>>>>>>>> ****    File "_home_weewx_skins_Standard_index_html_tmpl.py", line 
>>>>>>>> 1378, in
>>>>>>>> respond
>>>>>>>> Apr  9 14:45:16 weewx weewx[868] ERROR weewx.cheetahgenerator:
>>>>>>>> ****  TypeError: '>' not supported between instances of 'NoneType' and
>>>>>>>> 'float'
>>>>>>>>
>>>>>>>> My wind vein has blown off the roof, so wind direction and speed
>>>>>>>> are probably both None.
>>>>>>>> Whether this is something to do with it I don't know, but I can't
>>>>>>>> get the index template generated.
>>>>>>>> Thanks
>>>>>>>> Chris
>>>>>>>>
>>>>>>>> --
>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>> Groups "weewx-user" 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-user/dd2cd2fd-515b-47b3-a8c5-cb1692508eb8n%40googlegroups.com
>>>>>>>> <https://groups.google.com/d/msgid/weewx-user/dd2cd2fd-515b-47b3-a8c5-cb1692508eb8n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>> .
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Peter Quinn
>>>>>>> (415)794-2264 <(415)%20794-2264>
>>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "weewx-user" 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-user/c4ef6c55-ddee-4c9e-a7d6-23cc1f5beb2an%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/weewx-user/c4ef6c55-ddee-4c9e-a7d6-23cc1f5beb2an%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "weewx-user" 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-user/1d9b03d2-037f-4519-88db-292d0dff8d76n%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/weewx-user/1d9b03d2-037f-4519-88db-292d0dff8d76n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> -tk
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "weewx-user" 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-user/cfde7b17-3890-467f-a3ab-e612ae625facn%40googlegroups.com
>> <https://groups.google.com/d/msgid/weewx-user/cfde7b17-3890-467f-a3ab-e612ae625facn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" 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-user/CAPq0zEAMTAmoZG8q-9G%2BPihcU_Yz-W-BvK66akAsJR6uJrs21Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/weewx-user/CAPq0zEAMTAmoZG8q-9G%2BPihcU_Yz-W-BvK66akAsJR6uJrs21Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Peter Quinn
(415)794-2264

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" 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-user/CAA1SM21mxv1PVJT5XQ6JhZ1Mufe7533dSgwjADqB7RfOYmpOvg%40mail.gmail.com.

Reply via email to