Extending json output with new values
Opened this issue · 2 comments
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
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?
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.