Thanks for the explanation Gary. I'm most definitely a noob here so I
guess I needed a bit more explanation. From what you just wrote, this
sounds exactly what I did. I added the new schema heading and added it to
the end of the fileparse.py file and then added the corresponding
information into the weewx.conf and then performed the wee_database
reconfig. I can't seem to attach any files here so I'll just put in the
portions I modified:
In fileparse.py:
# Adding SOC (state of charge) of battery
#import schemas.wview
#schema_with_soc = schemas.wview.schema + [('soc', 'REAL')]
In weewx.conf:
[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 = schemas.wview.schema
#schema = user.soc.schema_with_soc
On Saturday, 28 January 2017 23:19:03 UTC-5, gjr80 wrote:
>
> If you wish to have weeWX store a new observation in the archive there are
> two key steps you need to take. First you need to get the observation
> 'into' weewx and second you need to get weewx to store the value in the
> archive. Getting the observation 'into' weeWX typically involves some sort
> of driver adding the observation to loop packets or archive records. From
> what I can understand of your posts so far, you appear to be using a
> modified version of the fileparse driver to do this. That is what Matthew
> meant by "you already have the observations".You can see this by running
> weeWX directly, you shoudl see you abs appearing in loop packets and/or
> archive records.
>
> The second step, having weeWX save the observation, requires some action
> with a database. WeeWX stores archive data whenever an archive record is
> produced. Once any conversions, corrections etc have been done weeWX looks
> at each observation in the archive record and each field in the in-use
> schema and stores archive record observations that have a matching database
> field in the database; so if there is an observation 'outTemp' in the
> archive record and there is a field 'outTemp' in the archive table schema,
> the 'outTemp' value from the archive record will be saved in the 'outTemp'
> field in the archive table, and so on. If there is an observation called,
> say, 'SOC' in the archive record but there is no 'SOC' field in the in-use
> schema then the 'SOC' value in the archive record is effectively discarded,
> it will not be saved to archive.
>
> So one of the approaches to storing additional observations in the archive
> is to 'extend the default schema' to include the new observation. The
> beauty of this approach is that it is fairly simple and does not really
> involve writing any code to manipulate the database, you put a few lines of
> code in a file extend the schema, a change of setting in weewx.conf and
> then a bit of database shuffling with wee_database. You now have a
> database whose archive table includes fields for the new observation(s).
> WeewWX takes care of getting data into the new field(s) as part of its
> normal operation. This is what is meant by Matthew when he said 'just
> extend the schema'. The section of the Customization Guide you need is the
> section Matthew provided as a link in response to your original post. You
> will defintely need to follow steps 1 and 2, changing files/obs/fields to
> suit your system. Step 3 may not be required, especially if using SQLite,
> but steps 4 onwards will be required.
>
> Gary
>
> On Sunday, 29 January 2017 12:56:22 UTC+10, Robert Mantel wrote:
>>
>> Ok, so there is no soc.py because I thought that extending the schema
>> meant just adding the schema extension to the filelparse.py and then
>> reconfiguring the database. I didn't understand from mwall's comments what
>> exactly was meant by "just extend the schema you already have the
>> observations"...I can gather the soc value from fileparse.py so I'm not
>> sure if I need an soc.py? I guess what I'm asking is do I need a new
>> service for just gathering the soc? If someone can clarify what section of
>> the customization guide I need to do I'll go from there. I can pretty much
>> gather anything from my Particle P1 (basically and arduino with wifi) front
>> end and feed it into fileparse, with the right sensors attached.
>>
>> On Friday, 27 January 2017 17:46:08 UTC-5, gjr80 wrote:
>>>
>>> Hi,
>>>
>>> Think we will need to see the contents of weewx.conf, the contents of
>>> soc.py and what is the location of soc.py.
>>>
>>> Gary
>>>
>>>
--
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.