@ Tom,

Tested, approved. Great thanks !

Attached, the schema after drop-daily, add column and rebuild-daily

pyb

Le mardi 10 octobre 2023 à 09:01:16 UTC+2, Pierre-Yves a écrit :

> Thanks Tom, I'll make a backup and give a try. I keep you in touch.
>
> Regarding the provenance of the base, if I remember well, I installed 
> Weewx in 2018, starting with an empty database. Previously I was using 
> WsWin32. Some months after, I decided to import from WU the about 8 years 
> data I had, and I merged them to the Weewx SDB. Maybe the base was altered 
> (corrupted) at that time...
>
> pyb
>
> Le lundi 9 octobre 2023 à 19:52:06 UTC+2, Tom Keffer a écrit :
>
>> I don't know how it happened, but your database has multiple entries in 
>> the daily summaries, including extraHumid3, that are not in the main 
>> archive table.
>>
>> I've never seen this before, so I'm not quite sure how to recover. Do you 
>> remember the provenance of the database?
>>
>> You could try dropping all the daily summaries, then add the missing 
>> columns to the archive table, then rebuilding the database. I don't know 
>> how facile you are with SQL, but the workflow would look something like 
>> this (NOT TESTED):
>>
>> *cd /var/lib/weewx*
>> *sudo wee_database --drop-daily*
>>
>> *sudo cp weewx.sdb weewx.sdb.backup*
>> *sudo sqlite3 weewx.sdb*
>> sqlite>* ALTER TABLE archive ADD COLUMN extraHumid3;*
>> sqlite>*  (add any other missing columns)*
>> sqlite>* .quit*
>> *sudo wee_database --rebuild-daily*
>>
>> Or, perhaps you have a backup that has the missing columns.
>>
>> -tk
>>
>> On Mon, Oct 9, 2023 at 10:00 AM Pierre-Yves <[email protected]> wrote:
>>
>>> Thanks Tom for the feedback.
>>>
>>> I don't think I have a problem of typo or aggregate type, as I use a 
>>> copy/past of the extraTemp2/extraHumid2 that works fine
>>> [[extra]]
>>>         title = Température/humidité ch.Vincent
>>>         [[[extraTemp2]]]
>>>     yAxis_tickInterval = 1
>>>     connectNulls = true
>>>     name = T_ch_Vincent
>>> [[[extraHumid2]]]
>>>             yAxis = 1
>>>             yAxis_min = 25
>>>             yAxis_max = 75
>>>             y_label = "Hrel"
>>>     connectNulls = true
>>>             name = Humidité relative
>>>             color = "#90ed7d"
>>> [[extra2]]
>>>         title = Température/humidité cave
>>>         [[[extraTemp3]]]
>>>     yAxis_tickInterval = 1
>>>     connectNulls = true
>>>     name = T_cave
>>> [[[extraHumid3]]]
>>>             yAxis = 1
>>>             yAxis_min = 25
>>>             yAxis_max = 90
>>>             y_label = "Hrel"
>>>     connectNulls = true
>>>             name = Humidité relative
>>>             color = "#90ed7d"
>>>
>>> Attached, the result of *echo ".schema" | sqlite3 
>>> /var/lib/weewx/weewx.sdb*
>>>
>>> Pierre-Yves
>>> Le lundi 9 octobre 2023 à 17:03:47 UTC+2, Tom Keffer a écrit :
>>>
>>>> We should also look at the schema in your database. Please post the 
>>>> results of
>>>>
>>>> *echo ".schema" | sqlite3 /var/lib/weewx/weewx.sdb*
>>>>
>>>>
>>>> On Mon, Oct 9, 2023 at 7:59 AM Tom Keffer <[email protected]> wrote:
>>>>
>>>>> This error can be misleading. The problem could also be caused by an 
>>>>> unknown aggregation type. Look through your [ImageGenerator] section of 
>>>>> the 
>>>>> Belchertown skin and make sure there isn't a typo or something for 
>>>>> "aggregate_type".
>>>>>
>>>>> On Mon, Oct 9, 2023 at 6:29 AM Pierre-Yves <[email protected]> wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I am running Weewx 4.10.2, catching data from various sensors (433 
>>>>>> MHz and 868 MHz), via the user.SDR driver.
>>>>>> All was perfectly working till I decide to add a new 
>>>>>> temperature/humidity sensor to the sensor map (extraTemp3 and 
>>>>>> extraHumid3). 
>>>>>> See below the sensor map.
>>>>>>
>>>>>> [SDR]
>>>>>>     # This section is for the software-defined radio driver.
>>>>>>
>>>>>>     # The station model, e.g., 'Meade TE923W' or 'TFA Nexus'
>>>>>>     model = Bresser WSX3001
>>>>>>     
>>>>>>     # The driver to use
>>>>>>     driver = user.sdr
>>>>>>     
>>>>>>     cmd = sudo /usr/local/bin/rtl_433 -f 868.3M -f 433.92M -H 90 -Y 
>>>>>> autolevel -s 1024k -R 173 -R 172 -R 42 -M utc -F json
>>>>>>     
>>>>>>     [[sensor_map]]
>>>>>>         
>>>>>>         iroxwindDir = wind_dir.4:None.HidekiWindPacket
>>>>>>         iroxwindGust = wind_gust.4:None.HidekiWindPacket
>>>>>>         iroxwindSpeed = wind_speed.4:None.HidekiWindPacket
>>>>>>         iroxwindBatteryStatus = battery.4:None.HidekiWindPacket
>>>>>>         iroxoutTemp = temperature.1:12.HidekiTS04Packet  
>>>>>>         iroxoutHumidity = humidity.1:12.HidekiTS04Packet
>>>>>>         iroxoutBatteryStatus = battery.1:12.HidekiTS04Packet
>>>>>>         extraTemp2 = temperature.5:1.HidekiTS04Packet    
>>>>>>         extraHumid2 = humidity.5:1.HidekiTS04Packet   
>>>>>>         *extraTemp3 = temperature.2:15.HidekiTS04Packet    *# 
>>>>>> Temp_Cave
>>>>>> *        extraHumid3 = humidity.2:15.HidekiTS04Packet*    # Hum_Cave
>>>>>>         extraBatteryStatus2 = battery.5:1.HidekiTS04Packet
>>>>>>         # rain_total = rain_total.4:None.HidekiRainPacket
>>>>>>         # rainBatteryStatus = battery.4:None.HidekiRainPacket
>>>>>>         
>>>>>>         outTemp = temperature.43576.Bresser7in1Packet
>>>>>>         outHumidity = humidity.43576.Bresser7in1Packet
>>>>>>         rain_total = rain_total.43576.Bresser7in1Packet
>>>>>>         windDir = wind_dir.43576.Bresser7in1Packet
>>>>>>         windSpeed = wind_speed.43576.Bresser7in1Packet
>>>>>>         windGust = wind_gust.43576.Bresser7in1Packet
>>>>>>         UV = uv.43576.Bresser7in1Packet
>>>>>>         radiation = light.43576.Bresser7in1Packet
>>>>>>         windBatteryStatus = battery.43576.Bresser7in1Packet
>>>>>>         inTemp = temperature.-1859570394.Bresser6in1Packet    # 
>>>>>> capteur thermo-hygro externe
>>>>>>         inHumidity = humidity.-1859570394.Bresser6in1Packet
>>>>>>         inTempBatteryStatus = battery.-1859570394.Bresser6in1Packet
>>>>>>         
>>>>>> I actually succeeded to add a graph of extraTemp3 but I failed to add 
>>>>>> extraHumid3. weewx.reportengine gets an "weewx.UnknownType: extraHumid3" 
>>>>>> error.
>>>>>>
>>>>>> Oct  9 12:35:26 raspberrypi weewx[2125] INFO weewx.manager: Added 
>>>>>> record 2023-10-09 12:35:00 CEST (1696847700) to database 'weewx.sdb'
>>>>>> Oct  9 12:35:26 raspberrypi weewx[2125] INFO weewx.manager: Added 
>>>>>> record 2023-10-09 12:35:00 CEST (1696847700) to daily summary in 
>>>>>> 'weewx.sdb'
>>>>>> Oct  9 12:35:28 raspberrypi weewx[2125] INFO weewx.cheetahgenerator: 
>>>>>> Generated 8 files for report SeasonsReport in 2.01 seconds
>>>>>> Oct  9 12:35:29 raspberrypi weewx[2125] ERROR weewx.reportengine: 
>>>>>> Caught unrecoverable exception in generator 
>>>>>> 'weewx.imagegenerator.ImageGenerator'
>>>>>> Oct  9 12:35:29 raspberrypi weewx[2125] ERROR weewx.reportengine:     
>>>>>>     ****  extraHumid3
>>>>>> Oct  9 12:35:29 raspberrypi weewx[2125] ERROR weewx.reportengine:     
>>>>>>     ****  Traceback (most recent call last):
>>>>>> Oct  9 12:35:29 raspberrypi weewx[2125] ERROR weewx.reportengine:     
>>>>>>     ****    File "/usr/share/weewx/weewx/reportengine.py", line 197, in 
>>>>>> run
>>>>>> Oct  9 12:35:29 raspberrypi weewx[2125] ERROR weewx.reportengine:     
>>>>>>     ****      obj.start()
>>>>>> Oct  9 12:35:29 raspberrypi weewx[2125] ERROR weewx.reportengine:     
>>>>>>     ****    File "/usr/share/weewx/weewx/reportengine.py", line 385, in 
>>>>>> start
>>>>>> Oct  9 12:35:29 raspberrypi weewx[2125] ERROR weewx.reportengine:     
>>>>>>     ****      self.run()
>>>>>> Oct  9 12:35:29 raspberrypi weewx[2125] ERROR weewx.reportengine:     
>>>>>>     ****    File "/usr/share/weewx/weewx/imagegenerator.py", line 42, in 
>>>>>> run
>>>>>> Oct  9 12:35:29 raspberrypi weewx[2125] ERROR weewx.reportengine:     
>>>>>>     ****      self.gen_images(self.gen_ts)
>>>>>> Oct  9 12:35:29 raspberrypi weewx[2125] ERROR weewx.reportengine:     
>>>>>>     ****    File "/usr/share/weewx/weewx/imagegenerator.py", line 109, 
>>>>>> in 
>>>>>> gen_images
>>>>>> Oct  9 12:35:29 raspberrypi weewx[2125] ERROR weewx.reportengine:     
>>>>>>     ****      self.image_dict[timespan][plotname])
>>>>>> Oct  9 12:35:29 raspberrypi weewx[2125] ERROR weewx.reportengine:     
>>>>>>     ****    File "/usr/share/weewx/weewx/imagegenerator.py", line 249, 
>>>>>> in 
>>>>>> gen_plot
>>>>>> Oct  9 12:35:29 raspberrypi weewx[2125] ERROR weewx.reportengine:     
>>>>>>     ****      **option_dict)
>>>>>> Oct  9 12:35:29 raspberrypi weewx[2125] ERROR weewx.reportengine:     
>>>>>>     ****    File "/usr/share/weewx/weewx/xtypes.py", line 116, in 
>>>>>> get_series
>>>>>> Oct  9 12:35:29 raspberrypi weewx[2125] ERROR weewx.reportengine:     
>>>>>>     ****      raise weewx.UnknownType(msg)
>>>>>> Oct  9 12:35:29 raspberrypi weewx[2125] ERROR *weewx.reportengine:   
>>>>>>       ****  weewx.UnknownType: extraHumid3*
>>>>>> Oct  9 12:35:29 raspberrypi weewx[2125] ERROR weewx.reportengine:     
>>>>>>     ****  Generator terminated
>>>>>> Oct  9 12:35:29 raspberrypi weewx[2125] INFO weewx.reportengine: 
>>>>>> Copied 0 files to /var/www/html/weewx
>>>>>> Oct  9 12:35:32 raspberrypi weewx[2125] INFO weewx.cheetahgenerator: 
>>>>>> Generated 11 files for report Belchertown in 3.30 seconds
>>>>>> Oct  9 12:35:32 raspberrypi weewx[2125] INFO weewx.reportengine: 
>>>>>> Copied 2 files to /var/www/html/weewx/belchertown
>>>>>>
>>>>>> I tried to add a column to the database but I got this error : 
>>>>>> "weedb.TableExistsError: table archive_day_extraHumid3 already exists" 
>>>>>> (see 
>>>>>> below)
>>>>>>
>>>>>> pi@raspberrypi:~ $ wee_database --add-column=extraHumid3
>>>>>> Using configuration file /etc/weewx/weewx.conf
>>>>>> Using database binding 'wx_binding', which is bound to database 
>>>>>> 'archive_sqlite'
>>>>>> Add new column 'extraHumid3' of type 'REAL' to database (y/n)? y
>>>>>> Traceback (most recent call last):
>>>>>>   File "/usr/share/weewx/weedb/sqlite.py", line 39, in guarded_fn
>>>>>>     return fn(*args, **kwargs)
>>>>>>   File "/usr/share/weewx/weedb/sqlite.py", line 233, in execute
>>>>>>     return sqlite3.Cursor.execute(self, *args, **kwargs)
>>>>>> *sqlite3.OperationalError: table archive_day_extraHumid3 already 
>>>>>> exists*
>>>>>>
>>>>>> During handling of the above exception, another exception occurred:
>>>>>>
>>>>>> Traceback (most recent call last):
>>>>>>   File "/usr/share/weewx/wee_database", line 1168, in <module>
>>>>>>     main()
>>>>>>   File "/usr/share/weewx/wee_database", line 220, in main
>>>>>>     addColumn(config_dict, db_binding, options.add_column, 
>>>>>> options.type)
>>>>>>   File "/usr/share/weewx/wee_database", line 632, in addColumn
>>>>>>     dbm.add_column(column_name, column_type)
>>>>>>   File "/usr/share/weewx/weewx/manager.py", line 623, in add_column
>>>>>>     self._add_column(column_name, column_type, cursor)
>>>>>>   File "/usr/share/weewx/weewx/manager.py", line 1136, in _add_column
>>>>>>     self._initialize_day_table(column_name, 'scalar', cursor)
>>>>>>   File "/usr/share/weewx/weewx/manager.py", line 1130, in 
>>>>>> _initialize_day_table
>>>>>>     cursor.execute(sql_create_str)
>>>>>>   File "/usr/share/weewx/weedb/sqlite.py", line 49, in guarded_fn
>>>>>>     raise weedb.TableExistsError(e)
>>>>>>
>>>>>> *weedb.TableExistsError: table archive_day_extraHumid3 already exists*
>>>>>> At the opposite, if I try to drop a possible extraHumid3 column, i 
>>>>>> get the following :
>>>>>>
>>>>>> pi@raspberrypi:~ $ wee_database --drop-column=extraHumid3
>>>>>> Using configuration file /etc/weewx/weewx.conf
>>>>>> Using database binding 'wx_binding', which is bound to database 
>>>>>> 'archive_sqlite'
>>>>>> Drop column(s) 'extraHumid3' from the database (y/n)? y
>>>>>> This may take a while...
>>>>>> *Cannot DROP 'extraHumid3'; column does not exist.*
>>>>>> Nothing done.
>>>>>>
>>>>>> Now, even if I comment the extraTemp3 and extraHumid3 lines in the 
>>>>>> sensor map, I still get the same syslog errors.
>>>>>>
>>>>>> At that point I am a bit stuck.
>>>>>>
>>>>>> Any clue ?
>>>>>>
>>>>>> Have a nice day
>>>>>>
>>>>>> Pierre-Yves
>>>>>>
>>>>>> -- 
>>>>>> 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/31697f77-feca-4821-bcb9-40f7f5cca562n%40googlegroups.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/weewx-user/31697f77-feca-4821-bcb9-40f7f5cca562n%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/1fe8e786-6f6d-46aa-8672-fa584d0b4518n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/weewx-user/1fe8e786-6f6d-46aa-8672-fa584d0b4518n%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/e28b7fdb-1f88-4995-af01-1b1912f83100n%40googlegroups.com.

Attachment: Schema-new
Description: Binary data

Reply via email to