You haven't said what your use case is. It might be quite simple.

For example, here is how you would calculate total heating degree-days for
this month in Python, using xtype. Most of the complexity is in calculating
the starting and stopping times:

import time
import weewx.manager
import weewx.xtypes
import weeutil.weeutil

archive_sqlite = {
    'database_name': '/home/weewx/archive/weewx.sdb',
    'driver': 'weedb.sqlite'
}

start_tt = (2022, 5, 1, 0, 0, 0, 0, 0, -1)
end_tt = (2022, 6, 1, 0, 0, 0, 0, 0, -1)
start_ts = time.mktime(start_tt)
end_ts = time.mktime(end_tt)
timespan = weeutil.weeutil.TimeSpan(start_ts, end_ts)

with weewx.manager.DaySummaryManager.open(archive_sqlite) as db_manager:
    result = weewx.xtypes.get_aggregate('heatdeg', timespan, 'sum',
db_manager)

print(result)

On Wed, May 18, 2022 at 9:29 AM PC <[email protected]> wrote:

> Yes,
> I just looked at, it's really too complicated to implement for what I want
> to do.
> It would even be easier to calculate him himself!
> Besides, in French, we say "why make it simple when you can make it
> complicated!?"
> It is not complicated to calculate it once a day and store it in a small
> table.
>
> Le mercredi 18 mai 2022 à 18:11:34 UTC+2, PC a écrit :
>
>> Okay,
>>
>> I don't know this "xtype", I'm going to watch.
>> I already have the difficulty of "binding" 2 tables (see my previous post)
>> One more challenge, it's pleasant!
>>
>> Le mercredi 18 mai 2022 à 18:01:45 UTC+2, [email protected] a écrit :
>>
>>> Degree-days are calculated on the fly as an xtype
>>> <https://github.com/weewx/weewx/wiki/WeeWX-V4-user-defined-types>
>>> variable.
>>>
>>> Where do you need them? For example, for a template, the total
>>> degree-days for a month could be calculated as $month.heatdeg.sum.
>>>
>>> If you need access from an outside application, then you'd have to use
>>> the xtype's Python interface.
>>>
>>> On Wed, May 18, 2022 at 8:48 AM PC <[email protected]> wrote:
>>>
>>>> Hello,
>>>>
>>>> It seems to me that DegreeDays are not stored in the table (MySQL)
>>>> archive.
>>>> Are they elsewhere? How can I get it through a third-party application?
>>>>
>>>> Thank you !
>>>>
>>>> --
>>>> 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/2bb706a9-dcb5-4773-8f15-80df8fceafccn%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/weewx-user/2bb706a9-dcb5-4773-8f15-80df8fceafccn%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/208e0c7c-4936-4342-99d6-6270f17bb4e6n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/208e0c7c-4936-4342-99d6-6270f17bb4e6n%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/CAPq0zEAFZ2W1dnn9ptj74Qi%3D8cnvTUKb-MnbMExck6eYr1eM_g%40mail.gmail.com.

Reply via email to