Matthew,
Thanks, I thought that the database section was different than the others,
I copied it from the as3935 driver. I have changed it and now the database
is being created. I assume I need to move the call to as3935 in the engine
section to "process" instead of "data" as well.
Ultimately since lightning doesn't occur very much where I live, I would
like to have it displayed in a separate page like cmon. I also have the
hobbyboards lightning detector which is why I have lightning as well as
lightning_strikes.
As Steve2Q suggested I need to get the extended schema working instead of
modifying the wview schema. cmon refers to its schema in the driver where
as3935 doesn't. I have added the schema information to extensions.py but
since it is not using the additional info, I must have something wrong.
Since I want to use two databases, should the "schema =
user.extensions.extended_schema" statement be in the [[lightning_binding]]
instead of the [[wx_binding]]?
[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_sqlite
# 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 = user.extensions.extended_schema
[[lightning_binding]]
database = lightning_sqlite
[[cmon_binding]]
manager = weewx.manager.DaySummaryManager
schema = user.cmon.schema
table_name = archive
database = cmon_sqlite
import locale
# This will use the locale specified by the environment variable 'LANG'
# Other options are possible. See:
# http://docs.python.org/2/library/locale.html#locale.setlocale
locale.setlocale(locale.LC_ALL, '')
# extend the default schema to include lightning
import weewx.units
weewx.units.USUnits['group_distance'] = 'mile'
weewx.units.MetricUnits['group_distance'] = 'kilometer'
weewx.units.MetricWXUnits['group_distance'] = 'kilometer'
weewx.units.obs_group_dict['lightning_strikes'] = 'group_count'
weewx.units.obs_group_dict['avg_distance'] = 'group_distance'
import schemas.wview
extended_schema = schemas.wview.schema + [('lightning', 'REAL')]
extended_schema = schemas.wview.schema + [('lightning_strikes', 'REAL')]
extended_schema = schemas.wview.schema + [('avg_distance', 'REAL')]
# ensure that lightning uses the right units
from weewx.units import obs_group_dict
obs_group_dict['lightning'] = 'group_count'
from weewx.units import obs_group_dict
obs_group_dict['lightning_strikes'] = 'group_count'
On Friday, September 9, 2016 at 8:46:24 PM UTC-4, mwall wrote:
>
>
>
> On Thursday, September 8, 2016 at 7:29:33 PM UTC-4, Steve Sykes wrote:
>>
>> Lightning detection doesn't seem to work properly yet but if a database
>> isn't created I will never see it.
>>
>>
> steve,
>
> you don't need a second database - that is an optional feature of the
> as3935 extension.
>
> the reason your second database is not working is because of how you
> defined it. in your weewx.conf, this:
>
> [[lightning_sqlite]]
> root = %(WEEWX_ROOT)s
> database_name = archive/lightning.sdb
> driver = weedb.sqlite
>
> is incorrect - that is how databases were specified in weewx 2. you want
> this:
>
> [[lightning_sqlite]]
> database_type = SQLite
> database_name = lightning.sdb
>
> but you should walk before you run.
>
> remove the data_binding = lightning_binding from the [AS3935] section so
> that lightning data are saved only to the wx database.
>
> run weewx directly to be sure that lightning data are actually being
> captured.
>
> sudo weewxd /etc/weewx/weewx.conf
>
> you should see LOOP data with the lightning fields.
>
> then make sure the data are getting into your wx database:
>
> sqlite3 /var/lib/weewx.sdb
> sqlite> select dateTime, avg_distance, lightning_strikes from archive;
>
> note that the two fields are avg_distance and lightning_strikes. you
> need to modify your schema, since you are using lightning and
> lightning_strikes. you can also eliminate the lightning references in
> your extensions.py.
>
> after all of that is working properly, add the lightning data
> (avg_distance and lightning_strikes) to your reports.
>
> the separate lightning database records the distance to and time of each
> strike. it has its own schema and is completely independent of the weewx
> wx database.
>
> m
>
>
--
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].
For more options, visit https://groups.google.com/d/optout.