That is, how it is now (install.py not tested by now): 
https://github.com/roe-dl/weewx-GTS

Karen K schrieb am Donnerstag, 18. Februar 2021 um 22:31:27 UTC+1:

> I filed an issue for the record-is-None-problem there: #583 
> <https://github.com/poblabs/weewx-belchertown/issues/583>
>
> Karen K schrieb am Donnerstag, 18. Februar 2021 um 21:42:24 UTC+1:
>
>> Hi Tom, you are right. I changed the code that it returns the last value 
>> if record is None, and immediately Belchertown skin shows the value.
>>
>> I considered your comments about dangers by comparing the timestamp of 
>> the last value with the actual time time.time(). If the value is too old 
>> an error is raised rather than a value returned. And I let the program 
>> complain to the log, that record is None.
>>
>> Skin with included GTS value <https://www.woellsdorf-wetter.de>
>> Tom Keffer schrieb am Donnerstag, 18. Februar 2021 um 19:25:48 UTC+1:
>>
>>> That's one solution, but it has lots of dangers. The record could be 
>>> hours old.
>>>
>>> NB: if you want to do that, it's easy enough to code up a custom version 
>>> of get_scalar() that does this. If it detects a record of None, it gets the 
>>> latest record from the database, then calls weewx.xtypes.get_scalar() with 
>>> that.
>>>
>>>
>>> On Thu, Feb 18, 2021 at 10:18 AM Karen K <[email protected]> wrote:
>>>
>>>> Thank you for your extensive support! 
>>>>
>>>> Could it be, that get_scalar() in other classes (especially in the 
>>>> basic ones) simply provide the last available value, if record is None?
>>>>
>>>> I could code it that way, but I am not sure, whether it is a good idea 
>>>> or not.
>>>>
>>>> Tom Keffer schrieb am Donnerstag, 18. Februar 2021 um 17:51:45 UTC+1:
>>>>
>>>>> Hi, Karen. Looks like you are making steady progress.
>>>>>
>>>>> This is a bug in the Belchertown skin that I alluded to in another 
>>>>> thread 
>>>>> <https://groups.google.com/g/weewx-user/c/fKVxr07vMuE/m/I-PdDb7vBgAJ>.
>>>>>
>>>>> In a convoluted way, the skin is asking for a value from xtypes using 
>>>>> the call 
>>>>>
>>>>> xtype.get_scalar(obs_type, record, db_manager)
>>>>>
>>>>>
>>>>> (Side note: the actual request is done through a getattr() query of a 
>>>>> weewx.tags.CurrentObj object). 
>>>>>
>>>>> Unfortunately, the value for record as provided by the Belchertown 
>>>>> skin is None. In theory, the xtypes extension could look up the values it 
>>>>> needs from the database, but that would require knowing the time, but 
>>>>> with 
>>>>> record equal to None, that's not possible either.
>>>>>
>>>>> The Belchertown skin needs to provide the current record.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Thu, Feb 18, 2021 at 8:39 AM Karen K <[email protected]> wrote:
>>>>>
>>>>>> My XType extension is working in principle now. It calculates, and it 
>>>>>> delivers values, if there is $current.GTS, $latest.GTS, $day.GTS or 
>>>>>> $yesterday.GTS included in the skin definition. Also, images are 
>>>>>> generated showing the value over time. All is fine so far.
>>>>>>
>>>>>> Then I included the value in the Belchertown skin observation list. 
>>>>>> And I got an error message. It turned out, that it is possible that 
>>>>>> get_scalar() is called with *record is None*. From documentation I 
>>>>>> thought otherwise. That was confusing.
>>>>>>
>>>>>> As I included "if record is None: raise 
>>>>>> weewx.CannotCalculate(obs_type)" into get_scalar() no error message 
>>>>>> was logged any more. But no value was displayed in Belchertown skin. 
>>>>>> Again: 
>>>>>> if I include "$current.GTS" into the skin, the value is displayed. 
>>>>>> If I include the value in the observation list in skin.conf, it is not. 
>>>>>> I 
>>>>>> looked around and found out that Belchertown skin gets the value from 
>>>>>> calling weewx.tags.CurrentObj()within their special extension 
>>>>>> "belchertown.py" That seems to not include GTS value.
>>>>>>
>>>>>> So I am not sure what to do next.
>>>>>>
>>>>>> -- 
>>>>>>
>>>>> 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/bf89f27d-abb4-4943-a2a9-e3ffbf1a8606n%40googlegroups.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/weewx-development/bf89f27d-abb4-4943-a2a9-e3ffbf1a8606n%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/4caf593c-5f43-4c21-bb44-37867f803e52n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/weewx-development/4caf593c-5f43-4c21-bb44-37867f803e52n%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/bf07b4ef-6ebf-4559-9bb1-d253c934151dn%40googlegroups.com.

Reply via email to