Got it, thank you.
I'm testing my driver right now and I noticed some strange behavior.

*My driver works like this:*
It queries an external MySQL database and selects all datasets (rows, and 
one row contains a timestamp, the value of sensor1, sensor2 etc.) that have 
not been processed by WeeWx yet.
The driver yields data once every 5 minutes. Everytime the driver runs, it 
has to yield about 60 packets.
*My question:*
Is this too much for WeeWx to handle?
Yielding about 60 data packets at once in a loop in the *genLoopPackets(self) 
*method?

I'm asking because when I run WeeWx (using: sudo ./bin/weewxd weewx.conf), 
only about 16 LOOP messages appear in the console window while I'm 
expecting about 60.
Hope you can point me into the right direction again, thank you very much! 
:)

Kind regards, Henry.

On Friday, February 15, 2019 at 11:23:00 PM UTC+1, Tom Keffer wrote:
>
> If you're going to all the trouble of creating a custom database schema, 
> you can certainly make additional changes to suit your needs. Just be 
> careful not to drop something you'll need for your reports.
>
> However, you'll find removing unused observation types does not save as 
> much space as you think. A major part of the database is the index, which 
> will still be there.
>
> As far as what's the best practice? I'd say, do what Google does: save 
> everything. Storage is cheap.
>
> -tk
>
> On Fri, Feb 15, 2019 at 11:50 AM Henry Denston <h.de...@web.de 
> <javascript:>> wrote:
>
>> Hi Tom,
>>
>> thank you very much for your great reply! :)
>> I do not have an existing database yet.
>>
>> I already read the  *Adding a new type to the database 
>> <http://weewx.com/docs/customizing.htm#add_archive_type> *section in the 
>> Customizing Guide, however was confused as I thought this only applies in 
>> case one wants to add a new observation type that is not present in weewx 
>> yet (as in the example electricity).
>> I wanted to add additional radiation sources (and there is already the 
>> radiation observation type implemented in weewx), so I thought by using an 
>> already existing observation type I might not need to adjust the database 
>> structure.
>> Your answer however, clearly shows how to make the required changes, 
>> thank you very much! (Maybe add this little example to the docs, right next 
>> to the electricity eample? :))
>>
>> *Another question:*
>> By using the file user/extensions.py additional sensors can be added to 
>> weewx as you have presented.
>> Is it best practice to just append additionally required sensors to 
>> the standard weewx database structure or should I (make some additional 
>> changes to) 'rebuild' the used database structure for my system?
>> For example in case I intend to use only about 8 sensors/values in my 
>> current system (e.g.: dateTime, usUnits, windSpeed, outTemp, radiation, 
>> radiation1, radiation2, radiation3) I could remove all additional values in 
>> the database that I will not use (e.g. barometer, pressure, altimeter, 
>> inTemp, etc....) ? Would love to hear your opinion on that.
>>
>> Thank you very much, Henry.
>>
>>
>> On Friday, February 15, 2019 at 7:51:13 PM UTC+1, Tom Keffer wrote:
>>>
>>> Yes, your strategy would work, and your names (radiation1, radiation2, 
>>> and radiation3) are sensible names to give the extra sensors.
>>>
>>> You would have to change the database schema to accommodate the extra 
>>> sensors. 
>>>
>>> Do you have an existing database, to which you want to add the new 
>>> observation types? If so, then follow the instructions in the Customizing 
>>> Guide, section *Adding a new type to the database 
>>> <http://weewx.com/docs/customizing.htm#add_archive_type>*. If there is 
>>> something that is confusing about the instructions, let us know what the 
>>> problem is so we can clarify and, perhaps, update the documents and make it 
>>> clearer.
>>>
>>> If you do not have an existing database, then it is slightly easier. To 
>>> the bottom of the file user/extensions.py, add the following: 
>>>
>>> import schemas.wview
>>> radiation_schema = schemas.wview.schema + [
>>>     ('radiation1'', 'REAL'),
>>>     ('radiation2'', 'REAL'),
>>>     ('radiation3'', 'REAL'),
>>> ]
>>>
>>> Then go into your weewx.conf and change the [DataBindings] and 
>>> [Databases] section so they look like this:
>>>
>>> [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.radiation_schema
>>>
>>> ##############################################################################
>>>
>>> #   This section defines various databases.
>>>
>>> [Databases]
>>>
>>>     # A SQLite database is simply a single file
>>>     [[archive_sqlite]]
>>>         database_name = radiation.sdb
>>>         database_type = SQLite
>>>
>>>     # MySQL
>>>     [[archive_mysql]]
>>>         database_name = weewx
>>>         database_type = MySQL
>>>
>>> Restart WeeWX.
>>>
>>> WeeWX will now use the new database radiation.sdb, which will have the 
>>> new SQL columns.
>>>
>>> -tk
>>>
>>>
>>>
>>> On Fri, Feb 15, 2019 at 8:51 AM Henry Denston <h.de...@web.de> wrote:
>>>
>>>> Hello everyone!
>>>>
>>>> I'm currently developing a custom weather station (a microcontroller 
>>>> collecting data from custom sensors and forwarding it to a RaspberryPi).
>>>> I already read the customization guide multiple times and started to 
>>>> develop a custom weewx-driver for my custom weather station.
>>>> The customization guide offers some very valuable insights. However, I 
>>>> still have some questions and misunderstandings I guess, so I hope some 
>>>> experienced users/developers can help me out. :)
>>>>
>>>> As already stated I started developing my own driver, I also edited the 
>>>> weewx.conf and my custom driver is loaded when I start weewx with: sudo 
>>>> ./bin/weewxd weewx.conf (it yields/prints packets)
>>>> I checked the sql table structures in the documentation and now I'm not 
>>>> sure how to save my custom sensors values.
>>>> For example: I have a windsensor (measuring windspeed only), a 
>>>> temperature sensor and 4 pyranometer sensors of different kind measuring 
>>>> the sun irradiation.
>>>> Now in my custon driver I know that I can store/assign the windspeed 
>>>> and temperature like this for example:
>>>>
>>>> data = dict()
>>>>
>>>>
>>>> data['dateTime'] = int(data_array[0])  # unix timestamp
>>>> data['usUnits'] = weewx.METRIC
>>>> data['windSpeed'] = float(data_array[1])  # Anemometer measuring windspeed 
>>>> only
>>>> data['outTemp'] = float(data_array[0])  # PT100 measuring temperature 
>>>> outside
>>>>
>>>>
>>>> yield data  
>>>>
>>>>
>>>> So this should be straight forward if I understand correctly.
>>>> But how do I store my irradiation values from the various pyranomerters?
>>>>
>>>> It seems that in the expected database structure there is only one 
>>>> column for irradiation available.
>>>> How can I store it so WeeWx can use it in its reports and archives?
>>>> I have smth. like this in mind:
>>>>
>>>> data['radiation'] = float(dataset_array_sensor[2])  # pyranometer 1
>>>> data['radiation1'] = float(dataset_array_sensor[3])  # pyranometer 2
>>>> data['radiation2'] = float(dataset_array_sensor[4])  # pyranometer 3
>>>> data['radiation3'] = float(dataset_array_sensor[5])  # pyranometer 4
>>>>
>>>>
>>>> Would this work?
>>>> Do I have to change the sql database structure for it to work? (I plan 
>>>> to use sqlite for it as its easier to use it out of the box)
>>>> If so, how would I do it?
>>>>
>>>> I did read the customization guide multiple times but I'm really 
>>>> confused regarding this.
>>>> I hope you can give me a hint into the right direction (I think I'm 
>>>> probably way overthinking this and just missing a small detail)
>>>> Thank you very much in advance! :)
>>>>
>>>> Best regards, Henry.
>>>>
>>>

Reply via email to