Should have spelt out the full path/file:

/usr/share/weewx/user/extensions.py

Didn’t say the WeeWX daemon has anything to do with your issue, was 
pointing out that for WeeWX to pickup the new settings (eg for reports, 
services etc) you need to restart the daemon. This is SOP for changes to 
.py files. For wee_import you do not need to restart. 

Gary
On Saturday, 29 July 2023 at 09:47:31 UTC+1 [email protected] wrote:

> Thanks Gary for your response.
> I added :
>
>
> import weewx.units
> weewx.units.obs_group_dict['wetbulbTemp'] = 'group_temperature'
>
> in file /usr/share/weewx/weecfg/extension.py
>
> It didn't change anything about the problem when using wee_import.py, I 
> still get the same error.
> I specify that I did not create a field ['wetbulbTemp'] in the WeeWX 
> database but simply renamed ['heatindex1'] to ['wetbulbTemp'].
>
> The WeeWX daemon does not enter (in my opinion) into the problem since to 
> use the wee_import.py utility it is strongly advised to stop it... What I 
> do.
>
> I saw in the documentation what you are talking about where it is a 
> question of creating a user/electricity.py service, but unfortunately did 
> not quite understand where this electricity.py file went... :-(
>
> *Rémy LAVABRE*
>
>
> Le sam. 29 juil. 2023 à 10:04, gjr80 <[email protected]> a écrit :
>
>> Your problem is that wee_database --add_column/--rename_column makes all 
>> necessary changes to the database, but it does not make any change to the 
>> WeeWX unit system; in other words WeeWX knows there is a field 
>> wetbulbTemp in the database but does not know if it is a temperature, 
>> wind speed or rainfall. To fix this you need to add wetbulbTemp to the 
>> WeeWX unit system, the usual approach for this is to add a couple of lines 
>> of code to user/extensions.py (refer to Assigning a unit group 
>> <http://weewx.com/docs.html/latest/customizing.htm#Assigning_a_unit_group> 
>> in the Customization Guide 
>> <http://weewx.com/docs.html/latest/customizing.htm>), in your case 
>> something like the following should work (untested):
>>
>> import weewx.units
>> weewx.units.obs_group_dict['wetbulbTemp'] = 'group_temperature'
>>
>> For the WeeWX daemon this will take effect when WeeWX is restarted, but 
>> for the purposes of wee_import it should work straight away.
>>
>> Gary
>> On Saturday, 29 July 2023 at 08:36:33 UTC+1 [email protected] wrote:
>>
>>> *Good morning,*
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *My WeeWX.sdb database works perfectly. I removed all unnecessary fields 
>>> with sudo wee_database --drop-columns=XXX,YYY,ZZZ which worked perfectly.I 
>>> renamed the field "heatindex1", from the base to "wetbulbTemp" with the 
>>> command: sudo wee_database --rename-column=heatindex1 
>>> --to-name=wetbulbTemp. Flawless.The problem is when I try to insert CSV 
>>> data into the database using the wee_import.py utility.All fields work on 
>>> import except the one renamed to "wetbulbTemp"...If I remove the 
>>> wetbulbTemp field from the import configuration file (*.conf), the import 
>>> is done without any problem.With the field renamed "wetbulbTemp", I get the 
>>> following message:*
>>>
>>> Using WeeWX configuration file /etc/weewx/weewx.conf
>>> Starting wee_import...
>>> A CSV import from source file '/home/pi/Documents/Bresser7in1/data5.csv' 
>>> has been requested.
>>> The following options will be used:
>>>       config=/etc/weewx/weewx.conf, 
>>> import-config=/home/pi/Documents/Bresser7in1/csv-Bresser.conf
>>>       source=/home/pi/Documents/Bresser7in1/data5.csv, from=None, to=None
>>>       dry-run=True, calc_missing=True, ignore_invalid_data=True
>>>       slice=250, interval=conf, date/time_string_format=%Y-%m-%d %H:%M:%S
>>>       delimiter=',', rain=cumulative, wind_direction=[0.0, 360.0]
>>>       UV=True, radiation=True
>>> Using database binding 'wx_binding', which is bound to database 
>>> 'weewx.sdb'
>>> Destination table 'archive' unit system is '0x01' (US).
>>> Missing derived observations will be calculated.
>>> This is a dry run, imported data will not be saved to archive.
>>> Starting dry run import ...
>>> Obtaining raw import data for period 1 ...
>>> The following imported field-to-WeeWX field map will be used:
>>>       source field 'dateTime' in units 'unix_epoch' --> WeeWX field 
>>> 'dateTime'
>>>       source field 'barometer' in units 'hPa' --> WeeWX field 'barometer'
>>>       source field 'inTemp' in units 'degree_C' --> WeeWX field 'inTemp'
>>>       source field 'outTemp' in units 'degree_C' --> WeeWX field 
>>> 'outTemp'
>>>       source field 'inHumidity' in units 'percent' --> WeeWX field 
>>> 'inHumidity'
>>>       source field 'outHumidity' in units 'percent' --> WeeWX field 
>>> 'outHumidity'
>>>       source field 'windSpeed' in units 'km_per_hour' --> WeeWX field 
>>> 'windSpeed'
>>>       source field 'windDir' in units 'degree_compass' --> WeeWX field 
>>> 'windDir'
>>>       source field 'windGust' in units 'km_per_hour' --> WeeWX field 
>>> 'windGust'
>>>       source field 'rainRate' in units 'mm_per_hour' --> WeeWX field 
>>> 'rainRate'
>>>       source field 'rain' in units 'mm' --> WeeWX field 'rain'
>>>       source field 'dewpoint' in units 'degree_C' --> WeeWX field 
>>> 'dewpoint'
>>>       source field 'windchill' in units 'degree_C' --> WeeWX field 
>>> 'windchill'
>>>       source field 'radiation' in units 'watt_per_meter_squared' --> 
>>> WeeWX field 'radiation'
>>>       source field 'UV' in units 'uv_index' --> WeeWX field 'UV'
>>>       source field 'extraTemp1' in units 'degree_C' --> WeeWX field 
>>> 'extraTemp1'
>>>       source field 'extraTemp2' in units 'degree_C' --> WeeWX field 
>>> 'extraTemp2'
>>>       source field 'extraTemp3' in units 'degree_C' --> WeeWX field 
>>> 'extraTemp3'
>>>       source field 'extraTemp4' in units 'degree_C' --> WeeWX field 
>>> 'extraTemp4'
>>>       source field 'extraHumid1' in units 'percent' --> WeeWX field 
>>> 'extraHumid1'
>>>       source field 'extraHumid2' in units 'percent' --> WeeWX field 
>>> 'extraHumid2'
>>>       source field 'extraHumid3' in units 'percent' --> WeeWX field 
>>> 'extraHumid3'
>>>       source field 'extraHumid4' in units 'percent' --> WeeWX field 
>>> 'extraHumid4'
>>>       source field 'wetbulbTemp' in units 'degree_C' --> WeeWX field 
>>> 'wetbulbTemp'
>>> Raw import data read successfully for period 1.
>>> Mapping raw import data for period 1 ...
>>> Traceback (most recent call last):
>>>    File "/usr/share/weewx/wee_import", line 900, in <module>
>>>      hand()
>>>    File "/usr/share/weewx/wee_import", line 830, in main
>>>      source_obj.run()
>>>    File "/usr/share/weewx/weeimport/weeimport.py", line 421, in run
>>>      _mapped_data = self.mapRawData(_raw_data, self.archive_unit_sys)
>>>    File "/usr/share/weewx/weeimport/weeimport.py", line 981, in 
>>> mapRawData
>>>      weewx.units.obs_group_dict[_field])
>>>    File "/usr/lib/python3.9/collections/__init__.py", line 941, in 
>>> __getitem__
>>>      return self.__missing__(key) # support subclasses that define 
>>> __missing__
>>>    File "/usr/lib/python3.9/collections/__init__.py", line 933, in 
>>> __missing__
>>>      raiseKeyError(key)
>>> *KeyError: 'wetbulbTemp'*
>>>
>>>
>>>
>>> *I couldn't find any help in the WeeWX documentation on this.What is 
>>> happening with this renamed field and what is the solution to integrate the 
>>> CSV data of this field into my modified weewx.sdb database?*
>>>
>>> Thank you...
>>>
>> -- 
>> 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/dbf90df9-0cee-465d-89b1-86b2c77076ebn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/weewx-user/dbf90df9-0cee-465d-89b1-86b2c77076ebn%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/43f0c3c7-27aa-4f9f-b8bf-d9e9b911b779n%40googlegroups.com.

Reply via email to