neoground / neowx-material

Revamp WeeWX with Neowx-Material, a modern Material Design skin offering a sleek, responsive UI, captivating graphs & advanced features.
https://neoground.com/projects/neowx-material
MIT License
53 stars 30 forks source link

Adding data from a second database #51

Open zagamuffin opened 2 years ago

zagamuffin commented 2 years ago

What is the correct syntax for adding in data from a second database to charts in this skin? I had a look around this area - https://neoground.com/docs/neowx-material/dev.index - but don't see a reference to using additional databases.

Thanks, David


The second database is defined in the config file (wmr88.conf in this case, not weewx.conf) as follows -

[DataBindings]
    [[bresser_binding]]
        database = bresser_sqlite
        table_name = archive
        manager = weewx.manager.DaySummaryManager
        schema = schemas.wview_extended.schema
    [[wx_binding]]
        database = archive_sqlite
        table_name = archive
        manager = weewx.manager.DaySummaryManager
        schema = schemas.wview_extended.schema

[Databases]
    [[bresser_sqlite]]
        database_name = bresser.sdb
        database_type = SQLite
    [[archive_sqlite]]
        database_name = wmr100.sdb
        database_type = SQLite

I tried including a chart in index.html.tmpl as follows based on the syntax for the standard Weewx -

 //  $getChartJsCode("bresserTemp", "bresserTempchart", "area", "($data_binding='bresser_binding').inTemp", "($data_binding='bresser_binding').outTemp")

But it failed with this, indicating that the syntax I used was incorrect -

Mar 21 15:00:30 raspberrypi weewx-wmr88[658] ERROR weewx.cheetahgenerator: Evaluation of template /etc/weewx/skins/neowx-material/index.html.tmpl failed.
Mar 21 15:00:30 raspberrypi weewx-wmr88[658] ERROR weewx.cheetahgenerator: **** Ignoring template /etc/weewx/skins/neowx-material/index.html.tmpl
Mar 21 15:00:30 raspberrypi weewx-wmr88[658] ERROR weewx.cheetahgenerator: **** Reason: cannot find 'has_data' while searching for 'day.(data_binding='bresser_binding').inTemp.has_data'
thzzlan commented 1 year ago

I tried to add a second database to neowx-material too, and sadly it also did not work for me. The error I got is a different one though: Oct 21 15:31:18 raspberrypiweewx wee_reports[6721] ERROR weewx.cheetahgenerator: Evaluation of template /etc/weewx/skins/neowx-material/index.html.tmpl failed. Oct 21 15:31:18 raspberrypiweewx wee_reports[6721] ERROR weewx.cheetahgenerator: **** Ignoring template /etc/weewx/skins/neowx-material/index.html.tmpl Oct 21 15:31:18 raspberrypiweewx wee_reports[6721] ERROR weewx.cheetahgenerator: **** Reason: cannot find 'clear' while searching for 'obs.label.(data_binding='bewoelkung_binding').clear' Oct 21 15:31:18 raspberrypiweewx wee_reports[6721] ERROR weewx.cheetahgenerator: **** To debug, try inserting '#errorCatcher Echo' at top of template

I tried adding a label too, but I kept getting this error. Is there any way to use a second database with this skin?

zagamuffin commented 1 year ago

Hi thzzlan - I was never able to get it working, which is a pity. I'm just starting to work with weewx again after a break of a good few months so I may have another crack at it.

I see there is some discussion of it here - https://groups.google.com/g/weewx-user/c/b_2UsXGKKjQ - but it doesn't get any further than confirming what we have seen with our own efforts - unable to use data from two databases.

I think our two errors are related in as much as Cheetah is trying to reference something (a property I think in this case) that doesn't exist or else is referenced incorrectly. Mine can't find or determine whether inTemp "has data" today and yours can't find or determine whether obs.label "is clear".

Yours - Reason: cannot find 'clear' while searching for 'obs.label.(data_binding='bewoelkung_binding').clear' Mine - Reason: cannot find 'has_data' while searching for 'day.(data_binding='bresser_binding').inTemp.has_data'