Skip to content

Custom data bindings

Daveiano edited this page Apr 13, 2023 · 2 revisions

The skin can show observations from other bindings than the default wx_binding. To show these observations in the stat tiles or tables, you need to define them in [ObservationBindings]. If you only want to show diagrams with a custom data_binding, you can specify this directly.

ObservationBindings

In this section, you can define observations from data_bindings other than the default wx_binding. For example, if you are running a second weewx installation and you want to show the outTemp from that second source, one could define:

[ObservationBindings]
    [[test_station_temp_2]]
        data_binding = wxtest_binding
        observation = outTemp

The second source should be defined like this in weewx.conf:

[DataBindings]
    [[wxtest_binding]]
        database = archivetest_sqlite
        table_name = archive
        manager = weewx.manager.DaySummaryManager
        schema = schemas.wview_extended.schema

[Databases]
    [[archivetest_sqlite]]
        database_name = weewxtest.sdb
        database_type = SQLite

You can then use the newly defined observation test_station_temp_2 everywhere like:

[DisplayOptions]
    table_tile_observations = test_station_temp_2, outTemp, outHumidity, ...
    stat_tile_observations = test_station_temp_2, outTemp, outHumidity, ...

    [[diagrams]]
        [[[combined_observations]]]
            [[[[tempdew]]]]
                label = 'Temperature / Dewpoint'
                [[[[[obs]]]]]
                    [[[[[[temp]]]]]]
                        observation = "outTemp"
                    [[[[[[dew]]]]]]
                        observation = "dewpoint"
                        color = "#5F9EA0"
                    [[[[[[test_station_temp_2]]]]]]
                        observation = "test_station_temp_2"
                        color = green

        ...
        [[[test_station_temp_2]]]
            type = line
            color = "green"

        [[[day]]]
            aggregate_interval = 1800 # 30 minutes
            [[[[observations]]]]
                [[[[[test_station_temp_2]]]]]
                [[[[[tempdew]]]]]
                [[[[[outHumidity]]]]]
                ...

Define section-wise for diagrams

If you only want to use custom data_bindings for diagrams, you can specify them directly.

For combined diagrams per observation:

[[[[tempdew]]]]
    label = 'Temperature / Dewpoint'
    [[[[[obs]]]]]
        [[[[[[temp]]]]]]
            data_binding = wxtest_binding
            observation = "outTemp"
        [[[[[[dew]]]]]]
            observation = "dewpoint"
            color = "#5F9EA0"

Or for the whole diagram:

[[[[tempdew]]]]
    label = 'Temperature / Dewpoint'
    data_binding = wxtest_binding
    [[[[[obs]]]]]
        [[[[[[temp]]]]]]
            observation = "outTemp"
        [[[[[[dew]]]]]]
            observation = "dewpoint"
            color = "#5F9EA0"

Or for a single diagram/context, eg:

[[[day]]]
    data_binding = wxtest_binding
    aggregate_interval = 1800 # 30 minutes
    [[[[observations]]]]
        [[[[[tempdew]]]]]
        [[[[[outHumidity]]]]]
        [[[[[barometer]]]]]
        ...

or

[[[day]]]
    aggregate_interval = 1800 # 30 minutes
    [[[[observations]]]]
        [[[[[tempdew]]]]]
            data_binding = wxtest_binding
        [[[[[outHumidity]]]]]
            data_binding = wxtest_binding
        [[[[[barometer]]]]]
        ...