Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending json output with new values #9

Open
trodemaster opened this issue Oct 9, 2022 · 2 comments
Open

Extending json output with new values #9

trodemaster opened this issue Oct 9, 2022 · 2 comments

Comments

@trodemaster
Copy link

I'm investigating how to add additional values to the json output. Specifically, I'm looking at air quality-related values from the extended schema. Seems I would add values to https://github.com/teeks99/weewx-json/blob/main/skins/JSON/weewx.json.tmpl and they should start showing up?

I see the tests if $current.windDir.has_data commented out is that for performance or any other reason?
Are PRs that add data from extended_schema welcome?
What about optional plugins with the tests for values enabled?

Thanks for this useful plugin!
Blake

@teeks99
Copy link
Owner

teeks99 commented Oct 10, 2022

Honestly it has been a while since I've worked on this, so not sure why those tests are commented out...I suspect there was an issue with using them, but not sure.

If we can get checks per-line working, I wouldn't be opposed to adding additional items, provided there is a graceful failure mode when they aren't there.

I wish I had a better way to test this than hooking it up to my live instance. Do you know if there is a test input stream/instance I could run, maybe in a docker container?

@mfraser
Copy link

mfraser commented Feb 27, 2023

I'm investigating how to add additional values to the json output. Specifically, I'm looking at air quality-related values from the extended schema. Seems I would add values to https://github.com/teeks99/weewx-json/blob/main/skins/JSON/weewx.json.tmpl and they should start showing up?

I see the tests if $current.windDir.has_data commented out is that for performance or any other reason? Are PRs that add data from extended_schema welcome? What about optional plugins with the tests for values enabled?

Thanks for this useful plugin! Blake

I've successfully extended the output to include UV index, radiation and soil moisture by adding the following lines:
#if $current.UV.has_data
"UV": {"value": $current.UV.raw, "units": "$current.UV.format(" ").lstrip()"},
#end if
#if $current.radiation.has_data
"Radiation": {"value": $current.radiation.raw, "units": "$current.radiation.format(" ").lstrip()"},
#end if
#if $current.soilMoist1.has_data
"Soil Moisture": {"value": $current.soilMoist1.raw, "units": "$current.soilMoist1.format(" ").lstrip()"},
#end if

I found the easiest way to obtain the required obstype was to open the weewx.sdb in a SQLite editor and look at the headings.

The tests are commented out as that's how conditional statements in inc files work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants