I'm close, I think, except now I'm getting this every loop or report 
generation.

DEBUG weewx.wxservices: Unknown extensible type 'chillHours'

There are a couple things I'm unsure of that might be causing this

- I used the group type group_elapsed because it seemed like the best fit
- The last line of the python file, modeled after the VaporPressure.py 
example, is not part of either class, so I'm not sure what runs it. 

Here's the 
code: https://github.com/lordratner/weewx_chillHours/blob/main/chill_hours.py

It's been added to weewx.conf engine section in xtypes, and I've confirmed 
the service is loading. 

Thoughts?


On Thursday, January 20, 2022 at 8:26:59 PM UTC-6 [email protected] wrote:

> I'd try it as a pure xtype first, and see what kind of performance I got. 
> If it's slow, put it in the database.
>
> You can query the database directly, but the advantage of using xtypes 
> system to do your queries is that it can automatically optimize whether or 
> not to use the daily summaries. 
>
> There's a brief section 
> <https://github.com/weewx/weewx/wiki/WeeWX-V4-user-defined-types#xtypes-api> 
> in the wiki about the API. It's pretty self-explanatory, except about where 
> db_manager comes from. That's an instance of 
> weewx.manager.DaySummaryManager. Look in weewx/manager.py for how to create 
> one. There are some convenient static methods for doing so.
>
> On Thu, Jan 20, 2022 at 6:15 PM Seth Ratner <[email protected]> wrote:
>
>> Thanks Tom
>>
>> Final questions for the night, I promise 🤣😂
>>
>> Would you put this one the database, or just let WeeWx calculate it using 
>> the xtype each time?
>>
>> Second, is there an API or interface or whatever where another 
>> application can query WeeWX for some sort of weather data? In this case, 
>> I'd like my irrigation software to query WeeWX for the ET, total rain, and 
>> chill hours of a given time frame. 
>>
>> Or do I just have to read the database directly?
>>
>>
>>
>> On Thu, Jan 20, 2022, 19:15 Tom Keffer <[email protected]> wrote:
>>
>>> On Thu, Jan 20, 2022 at 4:01 PM Seth Ratner <[email protected]> wrote:
>>>
>>>> Would you add the step from the xType guide of adding chillHours to 
>>>> [StdWXCalculate] [[Calculations]]? Or would the "synthetic type" concept 
>>>> mean it only exists when it is called on.
>>>>
>>>> As I understand it, adding it to [StdWXCalculate] [[Calculations]] 
>>>> would add chillHours to the loop, but it would not be in the archive 
>>>> unless 
>>>> I also added a column for it with the same type name.
>>>>
>>>
>>> It doesn't hurt to add to StdWXCalculate, but it's really only 
>>> necessary if you want to add the results to the database.  And, yes, it 
>>> will only get added to the database if there's a matching column in the 
>>> schema.
>>>
>>>>
>>>> So on my Belchertown skin, where I want total Chill Hours from Oct - 
>>>> May displayed, if I add it to the archive WeeWX will use the database to 
>>>> calculate the total (just adding them together), whereas if I don't add it 
>>>> to the archive, WeeWX will have to run the (if outTemp < 45 then 
>>>> chillHours 
>>>> = archive_interval) for every archive row in that timespan, then sum that?
>>>>
>>>
>>> Maybe. For the ImageGenerator that comes with WeeWX, if a type is not 
>>> available in the database, it will try to calculate it "on the fly" using 
>>> xtypes. However, I have no idea what the Belchertown skin does. I kind of 
>>> doubt it leverages xtypes.
>>> -tk
>>>
>>> -- 
>>> You received this message because you are subscribed to a topic in the 
>>> Google Groups "weewx-user" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/weewx-user/7ysYvSUMOOo/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-user/CAPq0zEAdDBGTow7i55XfnGPzncQjdmiH%2BSk%3DL9_ZoE85QXKO%3Dw%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/weewx-user/CAPq0zEAdDBGTow7i55XfnGPzncQjdmiH%2BSk%3DL9_ZoE85QXKO%3Dw%40mail.gmail.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/CAHTssjOF_Q65XveoboAwRV%2Br5-oNb8curD7LZTTmuD7Y0-EAjQ%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/weewx-user/CAHTssjOF_Q65XveoboAwRV%2Br5-oNb8curD7LZTTmuD7Y0-EAjQ%40mail.gmail.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/5e505ef0-2ee4-4778-93b4-5f1bcea4b733n%40googlegroups.com.

Reply via email to