images are not plotted using custom binding

47 views
Skip to first unread message

User

unread,
Nov 15, 2024, 8:33:54 AM11/15/24
to weewx-user
Hi all,

trying to add some custom measurement types to my weewx-instance. What I do:

1) weewx is running on Ubuntu 20.04.2 with Davis Vantage Pro for several years without any troubles.

2) weewx was installed using "apt install weewx". By now, after doing again "apt install weewx" it is updated up to 4.9.1 but not fresher... I don't know if it matters... So now my version is 4.9.1

3) I have my custom script that measures some range [meters] and duration [seconds] values each minute, running on the same machine. 

4) At some moment I've copied the weewx.sdb to the folder available to my script, /home/user/, purged it, and made a hard link from /var/lib/weewx/custom.sdb to this file. My script updates this custom.sdb each minute, so I have two databases in /var/lib/weewx/: the native one, weewx.sdb with all Vantage's measurements, and the custom one with my custom measurements starting from some moment.

5) In weewx.conf, a new binding has been added:
[DataBindings]
   [[wx_binding]]
        database = archive_sqlite
        table_name = archive
        manager = weewx.manager.DaySummaryManager
        schema = user.myschema.schema
   [[custom_binding]]
        database = custom_sqlite
        table_name = archive
        manager = weewx.manager.DaySummaryManager
        schema = user.myschema.schema
....
[Databases]
    [[archive_sqlite]]
        database_name = weewx.sdb
        database_type = SQLite
    [[custom_sqlite]]
        database_name = custom.sdb
        database_type = SQLite
...
[Engine]
    [[Services]]
        data_services = user.custom.AddCustom
...

5) To assign units to my data, I've add a new service, custom.py:

import weewx
from weewx.engine import StdService
import weewx.units

weewx.units.obs_group_dict['signal1'] = 'group_altitude'
weewx.units.obs_group_dict['signal2'] = 'group_period'
weewx.units.USUnits['group_period'] = 'second'
weewx.units.MetricUnits['group_period'] = 'second'
weewx.units.MetricWXUnits['group_period'] = 'second'
weewx.units.default_unit_format_dict['second'] = '%.1f'
weewx.units.default_unit_label_dict['second'] = ' s'

class AddCustom(StdService):
    def __init__(self, engine, config_dict):
      super(AddCustom, self).__init__(engine, config_dict)
      self.bind(weewx.NEW_ARCHIVE_RECORD, self.new_archive_record)
    def new_archive_record(self, event):
      pass

6) The skin.conf has been modified:
...
[DisplayOptions]
    plot_groups = signal1, signal2, wind, winddir, barometer,.....
[ImageGenerator]
 [[[daysignal1]]]
       [[[[signal1]]]]
          data_binding = custom_binding
          data_type = signal1
        [[[daysignal2]]]
            [[[[signal2]]]]
          data_binding = custom_binding
          data_type = signal2
### the same for week, month, year...
...


The trouble: images for signal1 and signal2 are not generated.

I can successfully access the custom_binding explicity from templates, e.g:
<td class="stats_data">$latest($data_binding='custom_binding').signal1</td>
works fine for me. The data is displayed correctly with the units specified in custom.py

If I redirect my measurements to, e.g. wind or barometer data type or maybe some else already booked by the Vantage, everything works fine... But not with signal1, signal2,...

But this is not the case for me, because these data types has different units...
I've also tried extraTemp7, extraTemp8 with new units assigned in custom.py, but no success...

What am I doing wrong?













Reply all
Reply to author
Forward
0 new messages