It appears that you have a null value for mintime in your database. Most
likely the problem is that you have no data for 2019-12-15 and 2019-12-17.

I suspect the older query worked because MIN(value) ignores values, while
ordering by value does not.

This is a bug: the query should check for non null values. I've created
issue 635 <https://github.com/weewx/weewx/issues/635> to track, and
(hopefully) fixed in commit 5fbe0d5
<https://github.com/weewx/weewx/commit/5fbe0d51e88cfb126543e5309a970be220e7dcc0>
.

Could you please try this version of xtypes.py
<https://raw.githubusercontent.com/weewx/weewx/master/bin/weewx/xtypes.py>?

Thanks for your help.

On Fri, Jan 8, 2021 at 12:49 PM Arend <arendheng...@gmail.com> wrote:

> SELECT mintime, from_unixtime(dateTime), min from archive_day_outTemp
> order by min asc, mintime asc limit 20;
>
> Database weewx
>
>  mintime              from_unixtime(dateTime)          min
>
> NULL     2019-12-15 00:00:00       NULL
>
> NULL     2019-12-17 00:00:00       NULL
>
> 1606706235        2020-11-30 00:00:00       26.24
>
> 1585551900        2020-03-30 00:00:00       27.32
>
> 1606689987        2020-11-29 00:00:00       27.5
>
> 1575188400        2019-12-01 00:00:00       27.86
>
> 1585724700        2020-04-01 00:00:00       28.94
>
> 1575533700        2019-12-05 00:00:00       29.66
>
> 1585639200        2020-03-31 00:00:00       30.02
>
> 1574240700        2019-11-20 00:00:00       30.56
>
> 1580890500        2020-02-05 00:00:00       30.92
>
> 1607632800        2020-12-10 00:00:00       31.27999999999998
>
> 1575153900        2019-11-30 00:00:00       31.28
>
> 1579598100        2020-01-21 00:00:00       31.28
>
> 1585029900        2020-03-24 00:00:00       31.46
>
> 1609479829        2021-01-01 00:00:00       31.46
>
> 1575255300        2019-12-02 00:00:00       31.82
>
> 1584945300        2020-03-23 00:00:00       31.82
>
> 1585116900        2020-03-25 00:00:00       31.82
>
> 1607641210        2020-12-11 00:00:00       31.82
> Op vrijdag 8 januari 2021 om 21:18:54 UTC+1 schreef tke...@gmail.com:
>
>> Then adapt as necessary. Use from_unixtime() instead of datetime() in the
>> select statement.
>>
>> On Fri, Jan 8, 2021 at 11:49 AM Arend <arendh...@gmail.com> wrote:
>>
>>> Hello Tom,
>>>
>>> I am using MySQL database.
>>>
>>> Arend
>>>
>>> Op vrijdag 8 januari 2021 om 20:18:20 UTC+1 schreef tke...@gmail.com:
>>>
>>>> Thanks. Not sure what is happening, but let's take a look at your
>>>> database. I'm assuming you are using SQLite, and that you used a package
>>>> installer. You may have to install the tool sqlite3 first
>>>>
>>>> sudo apt-get install sqlite3
>>>>
>>>> Then
>>>>
>>>> *sqlite3 /var/lib/weewx/weewx.sdb*
>>>> sqlite> *select mintime, datetime(dateTime,'unixepoch','localtime'),
>>>> min from archive_day_outTemp order by min asc, mintime asc limit 20;*
>>>> sqlite> *.quit*
>>>>
>>>> Let me know what you get.
>>>>
>>>> -tk
>>>>
>>>>
>>>>
>>>> On Fri, Jan 8, 2021 at 10:01 AM Arend <arendh...@gmail.com> wrote:
>>>>
>>>>> After upgrading from WeeWX 4.1.1 to 4.3.0 Invalid dates started to
>>>>> show up for mintime.
>>>>>
>>>>> In this Belchertown thread the issue is reported by multiple users.
>>>>>
>>>>> https://github.com/poblabs/weewx-belchertown/issues/517
>>>>>
>>>>> After replacing the SQL optimizations with the previous "mintime" SQL
>>>>> strings from WeeWX 4.1.1 the problem was solved.
>>>>>
>>>>> Screenshot using optimized (4.3.0) SQL showing invalid dates using
>>>>> "mintime":
>>>>>
>>>>> [image: weewx_belchertown_records_invalid_dates.png]
>>>>>
>>>>> Replacing the relevant "mintime" code in xtypes.py with SQL strings
>>>>> from 4.1.1:
>>>>>
>>>>> [image: agg_sql_dict.png]
>>>>> [image: daily_sql_dict.png]
>>>>>
>>>>> Now the previous invalid dates are displayed correctly:
>>>>>
>>>>> [image: Records Belchertown na herstel SQL strings.png]
>>>>>
>>>>> Haven't tested other SQL optimizations.
>>>>>
>>>>> --
>>>>> 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 weewx-user+...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/weewx-user/3c48aa67-0850-4f19-af9e-a08527ef8b1cn%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/weewx-user/3c48aa67-0850-4f19-af9e-a08527ef8b1cn%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 weewx-user+...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/weewx-user/d4d920a7-1bd9-4fa7-91d5-d187a6cda3cfn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/weewx-user/d4d920a7-1bd9-4fa7-91d5-d187a6cda3cfn%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 weewx-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/80807b3d-0797-4bc8-b582-013a4e40eacdn%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/80807b3d-0797-4bc8-b582-013a4e40eacdn%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 weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zEBhJxRfhj458YSBj6NAa4SjAtGw3wPPtakLsSxaim96DQ%40mail.gmail.com.

Reply via email to