Hi, The first thing you need to do is forget about target_units = XXX, it has nothing to do with how or what your sensors (via respective driver/services) feed weeWX nor does it have any real effect of the unit formatting in reports. target_units merely sets the unit system that weeWX uses to store obs in the database - you could equally use apples for temperature and oranges for humidity, as long as weeWX knows how to convert apples to C/F and oranges to % :)
The secret to getting weeWX unit conversion working error free is to follow a few simple rules: 1. weeWX recognises 3 different unit systems; US customary, Metric and MetricWx. The units used for individual obs in these unit systems are covered in the Units appendix <http://weewx.com/docs/customizing.htm#units> to the Customization guide. 2. Each loop packet or archive record either generated by a driver or in use within weeWX must have a field usUnits that is set to either weewx.US (value 0x01), weewx.METRIC (value 0x10) or weewx.METRICWX (value 0x11). 3. The obs fields in loop packets/archive records must be in the applicable units specified by the usUnits field in the loop packet/archive record concerned. 4. Any services that add fields to loop packets/archive records must ensure any added fields are in the respective units defined by the usUnits field in the packet/record concerned. A driver can emit packets/records using whatever unit system you want; US customary, Metric or MetricWX. When it comes time so save that data to the database the weeWX internals will do the necessary conversion (if required) to save to the target_units. If you have a service that pulls data from an external sensor and adds it to a loop or archive record then your service must check the usUnits field of the packet/record to which the data is to be added and the service needs to do the conversion, if required, before adding the data to the packet/record. This is easily done with the through a weeWX API call, you don't have to reinvent unit conversions. If you don't make sure that the obs you add are in the correct units then chances are somewhere along the line (storing to db, converting for display/reports) your data will be assumed to be in particular units when it is not and incorrectly converted. If you follow this approach report unit conversion/formatting should work without issue. If you get your units mixed up internally no amount of unit conversion in reports will resolve the issue. The above being said, if you are using the OWFS Service you should be able to set I up appropriately, of course if you are using something else or have modified its operation you will need to make sure that it is respecting the usUnits value in of any packets/records it modifies. Gary On Friday, 13 April 2018 06:34:22 UTC+10, vigilancewx wrote: > > hi > > I normally run weewx with a vantage and a few 1 wire sensors > > standardreport units are set to metric > > but the target units in weewx.conf set to US > # DO NOT MODIFY THIS VALUE UNLESS YOU KNOW WHAT YOU ARE DOING! > target_unit = US # Options are 'US', 'METRICWX', or 'METRIC' > > > > all temperatures and other readings displayed on the html pages as they > should be > > I have tried to create my own extension to read my electricity meter and > it should work (this version is in simulator mode just now) > > the current sensor collects the power and temp readings to a txt file and > my extension imports it in to weewx.sdb > the imported power readings are in watts however the temperature is in C' > > Checking the weewxsdb all the temp readings are stored in F and then > displayed on the html pages in C' > > this particular reading cctemp is being parsed and stored in weewx.sdb as > deg C so when its shown on the html pages its incorrect > > i have tried to convert it back to 'C under stdcalibrate/corrections but > it has no effect? > > > is it possible to display this temperature back to 'C > > Unit conversion options > > The tag optional_unit_conversion can be used with either current > observations or aggregations. If supplied, the results will be converted to > the specified units. For example, if you have set group_pressure to > inches of mercury (inHg), then the tag > > Today's average pressure=$day.barometer.avg > > would normally give a result such as > > Today's average pressure=30.05 inHg > > However, if you add mbar to the end, > > $day.barometer.avg.mbar > > then the results will be in millibars: > > > i have tried to convert with the above but unsure how to implement it > > > thanks for any advice > -- 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. For more options, visit https://groups.google.com/d/optout.