Queries for time spans that are multiples of a day or done on the daily
summary. Otherwise, on the main archive table. So $day uses the daily
summary, and $hour uses the main archive table.

$hour.outTemp.avg could give you N/A either because outTemp does not
appear in the schema, or because there are no data.

What do these give you?

    <p>\$hour.outTemp.has_data = $hour.outTemp.has_data</p>
    <p>\$hour.outTemp.avg = $hour.outTemp.avg</p>
    <p>\$hour.pm2_5.has_data = $hour.pm2_5.has_data</p>
    <p>\$hour.pm2_5.avg = $hour.pm2_5.avg</p>

-tk


On Tue, Apr 13, 2021 at 12:56 PM [email protected] <[email protected]>
wrote:

> Hi,
>
> I tried to get $hour.outTemp.avg, and just got N/A
>
> but $day.pm2_5.avg does work and give me the average over the last 24h. So
> it seems my setup is only messing up the "hourly" summary. Any idea where I
> should look to try figure this one out?
>
> Regards,
>
> On Monday, April 12, 2021 at 11:52:53 PM UTC+2 [email protected] wrote:
>
>> Sorry again, but I am unable to reproduce this. It works fine on my test
>> setup.
>>
>> Do all variables exhibit this? For example, $hour.outTemp.has_data?
>>
>> On Mon, Apr 12, 2021 at 1:28 PM [email protected] <[email protected]>
>> wrote:
>>
>>> Sure,
>>>
>>> Sorry for this.
>>>
>>> So I am using the archive_mysql binding. It holds the archive database
>>> filled by my driver loop (which is SDR).
>>> I have an additional SDS011 service that fills in the pm2_5 and pm10
>>> columns. This 2 columns have been added to the archive table.
>>>
>>> So despite the complicated conf, this is just one binding for my 'live
>>> data'.(Maybe I should clean this up.)
>>>
>>> On Monday, April 12, 2021 at 10:15:16 PM UTC+2 [email protected] wrote:
>>>
>>>> That's a lot of bindings and databases. Which one are you using for
>>>> your $hour.pm2_5.has_data query? In fact, maybe you should tell us the
>>>> exact tag you are using.
>>>>
>>>> -tk
>>>>
>>>> On Mon, Apr 12, 2021 at 1:07 PM [email protected] <[email protected]>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Here are the requested sections :
>>>>>
>>>>> ##############################################################################
>>>>>
>>>>> #   This section binds a data store to a database.
>>>>>
>>>>> [DataBindings]
>>>>>
>>>>>     [[wx_binding]]
>>>>>         # The database must match one of the sections in [Databases].
>>>>>         # This is likely to be the only option you would want to
>>>>> change.
>>>>>         database = archive_mysql
>>>>>         # The name of the table within the database
>>>>>         table_name = archive
>>>>>         # The manager handles aggregation of data for historical
>>>>> summaries
>>>>>         manager = weewx.wxmanager.WXDaySummaryManager
>>>>>         # The schema defines the structure of the database.
>>>>>         # It is *only* used when the database is created.
>>>>>         schema = schemas.wview.schema
>>>>>     [[wd_binding]]
>>>>>         manager = weewx.manager.DaySummaryManager
>>>>>         schema = user.wdschema.weewxwd_schema
>>>>>         table_name = archive
>>>>>         database = weewxwd_mysql
>>>>>     [[forecast_binding]]
>>>>>         database = forecast_mysql
>>>>>         manager = weewx.manager.Manager
>>>>>         schema = user.forecast.schema
>>>>>         table_name = archive
>>>>>     [[wdsupp_binding]]
>>>>>         database = wd_supp_mysql
>>>>>         table_name = supp
>>>>>         manager = weewx.manager.Manager
>>>>>         schema = user.wdschema.wdsupp_schema
>>>>>     [[pm_binding]]
>>>>>         database = archive_mysql
>>>>>         table_name = archive
>>>>>         manager = weewx.wxmanager.WXDaySummaryManager
>>>>>         schema = user.sds011.schema
>>>>>
>>>>>
>>>>> ##############################################################################
>>>>>
>>>>> #   This section defines various databases.
>>>>> [Databases]
>>>>>
>>>>>     # A SQLite database is simply a single file
>>>>>     [[archive_sqlite]]
>>>>>         database_name = weewx.sdb
>>>>>         database_type = SQLite
>>>>>
>>>>>     # MySQL
>>>>>     [[archive_mysql]]
>>>>>         database_type = MySQL
>>>>>         database_name = weewx
>>>>>         host =
>>>>>         user =
>>>>>         password =
>>>>>     [[weewxwd_mysql]]
>>>>>         database_name = weewxwd
>>>>>         database_type = MySQL
>>>>>         host =
>>>>>         user =
>>>>>         password =
>>>>>     [[weewxwd_sqlite]]
>>>>>         database_name = weewxwd.sdb
>>>>>         root = %(WEEWX_ROOT)s
>>>>>         database_type = SQLite
>>>>>     [[forecast_sqlite]]
>>>>>         database_name = forecast.sdb
>>>>>         database_type = SQLite
>>>>>     [[forecast_mysql]]
>>>>>         database_name = forecast
>>>>>         database_type = MySQL
>>>>>         host =
>>>>>         user =
>>>>>         password =
>>>>>     [[wd_supp_sqlite]]
>>>>>         database_type = SQLite
>>>>>         database_name = wdsupp.sdb
>>>>>     [[wd_supp_mysql]]
>>>>>         database_name = weewxwd
>>>>>         database_type = MySQL
>>>>>         host =
>>>>>         user =
>>>>>         password =
>>>>>     [[pm_sqlite]]
>>>>>         database_name = pm.sdb
>>>>>         database_type = SQLite
>>>>>
>>>>>
>>>>> ##############################################################################
>>>>>
>>>>> #   This section defines defaults for the different types of databases.
>>>>>
>>>>> [DatabaseTypes]
>>>>>
>>>>>     # Defaults for SQLite databases
>>>>>     [[SQLite]]
>>>>>         driver = weedb.sqlite
>>>>>         # Directory in which the database files are located
>>>>>         SQLITE_ROOT = %(WEEWX_ROOT)s/archive
>>>>>
>>>>>     # Defaults for MySQL databases
>>>>>     [[MySQL]]
>>>>>         driver = weedb.mysql
>>>>>         # The host where the database is located
>>>>>         host = localhost
>>>>>         # The user name for logging in to the host
>>>>>         user =
>>>>>         # The password for the user name (quotes guard against parsing
>>>>> errors)
>>>>>         password =
>>>>>
>>>>>
>>>>> ##############################################################################
>>>>>
>>>>> While reviewing this, I noticed the manager line in the PM_Binding.
>>>>> Could this be the issue?
>>>>>
>>>>>
>>>>>
>>>>> On Monday, April 12, 2021 at 5:10:19 PM UTC+2 [email protected] wrote:
>>>>>
>>>>>> Sorry, I don't have an explanation.
>>>>>>
>>>>>> Can we see the [DataBindings], [Databases], and [DatabaseTypes]
>>>>>> sections of weewx.conf? You can obfuscate any passwords.
>>>>>>
>>>>>> On Sat, Apr 10, 2021 at 7:58 AM [email protected] <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> I checked, (I adjusted the query a bit since I am on mysql), but it
>>>>>>> confirmed there are 31 rows in the last 1 hour.
>>>>>>>
>>>>>>> I ran :
>>>>>>> select
>>>>>>> <http://diskstation/phpMyAdmin/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/select.html>
>>>>>>>  count
>>>>>>> <http://diskstation/phpMyAdmin/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html#function_count>
>>>>>>> (*),avg
>>>>>>> <http://diskstation/phpMyAdmin/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html#function_avg>
>>>>>>> (pm2_5),max
>>>>>>> <http://diskstation/phpMyAdmin/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html#function_max>
>>>>>>> (pm2_5) from archive where dateTime
>>>>>>> <http://diskstation/phpMyAdmin/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/date-and-time-types.html>
>>>>>>> >=(select
>>>>>>> <http://diskstation/phpMyAdmin/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/select.html>
>>>>>>>  max
>>>>>>> <http://diskstation/phpMyAdmin/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/group-by-functions.html#function_max>
>>>>>>> (dateTime
>>>>>>> <http://diskstation/phpMyAdmin/url.php?url=https://dev.mysql.com/doc/refman/5.5/en/date-and-time-types.html>
>>>>>>> )-3600 from archive);
>>>>>>>
>>>>>>> and got :
>>>>>>> count(*) avg(pm2_5) max(pm2_5)
>>>>>>>
>>>>>>> 31   1.0897849462365594  1.2
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Saturday, April 10, 2021 at 4:49:26 PM UTC+2 [email protected]
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Well, you can check what's in the database for the last hour.
>>>>>>>> Adjust the path to the database as necessary.
>>>>>>>>
>>>>>>>> *sqlite3 /var/lib/weewx/weewx.sdb*
>>>>>>>> sqlite> *select datetime(dateTime,'unixepoch','localtime'),pm2_5
>>>>>>>> from archive where dateTime>=(select max(dateTime)-3600 from archive);*
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Sat, Apr 10, 2021 at 5:50 AM [email protected] <
>>>>>>>> [email protected]> wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I am trying to improve my station sking with a proper AQI
>>>>>>>>> computation/display. however when using $hour.pm2_5.has_data it is 
>>>>>>>>> always
>>>>>>>>> false.
>>>>>>>>>
>>>>>>>>> Data is stored in the pm2_5 column of weewx archive database.
>>>>>>>>> Gauges show the current values, and history plot show prior data.
>>>>>>>>>
>>>>>>>>> Is there a setting I need to add somewhere so that hourly average
>>>>>>>>> can be computed on this column as well?
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> 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/6110a7ae-2012-47b9-9ffe-0cc7c8c67837n%40googlegroups.com
>>>>>>>>> <https://groups.google.com/d/msgid/weewx-user/6110a7ae-2012-47b9-9ffe-0cc7c8c67837n%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/28c7fca2-6552-4c19-9c51-8db602b9a416n%40googlegroups.com
>>>>>>> <https://groups.google.com/d/msgid/weewx-user/28c7fca2-6552-4c19-9c51-8db602b9a416n%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/d3533f18-e001-48a4-b73a-aeab9b844644n%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/weewx-user/d3533f18-e001-48a4-b73a-aeab9b844644n%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/654fcbf1-6e30-471e-9e95-430802ab84d2n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/weewx-user/654fcbf1-6e30-471e-9e95-430802ab84d2n%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/f8d1f8bc-d2f3-4e3c-9c65-4ef4873f39b6n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/f8d1f8bc-d2f3-4e3c-9c65-4ef4873f39b6n%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/CAPq0zEBv1y%2B40EgbJkOkd-85TsTCEhUghQGfj5n5cALAH1j90g%40mail.gmail.com.

Reply via email to