An answer right from the source! Thanks for sharing your work.

Ok so my understanding wasn't too far off, albeit a little murky. I can 
read the from $current no problem, and then following the guide to add 
"electricity" in the customization guide, I added the database column 
"cpu_temp" and "cpu_load" -- data is stored in it with no further changes. 
Your code already has the requisite obs_units added. In order to graph 
meaningful results I had to add "count = %.2f" to [[[[StringFormats]]]] in 
weewx.conf - now it works great.

My Belchertown skin graph config looks like this, for anyone interested

[[cpu]]
    title = CPU
    [[[cpu_temp]]]
        zIndex = 2
        name = CPU Temperature
        color = red
    [[[cpu_load]]]
        name = CPU Load
        yAxis = 1

Thanks again for your work, and the clarification!

On Tuesday, 27 April 2021 at 20:45:25 UTC+9:30 [email protected] wrote:

> Using this service as an example: 
> https://github.com/g-eddy/weewx-vitalstats. How can I get the data from 
> that into something graphable by the Belchertown skin?
>
>
> you will be creating new data_types(s). i don’t know belchertown; use its 
> method to add new items to template files
>
> Is it necessary to add a database column if I want these graphed over 
> time? 
>
>
> yes, that is how weewx works: graphed over time → stored as column in 
> database
>
> Can they be shown as current values somehow without needing to store them? 
> (and then I presume I would not be able to graph them)
>
>
> again yes. $current refers to the current (archive) data packet, just as 
> it is being put into the database (that is, the data_types in the packet 
> that have columns get stored). if you put $current.outTemp in a template, 
> that is taking from the packet, no column required
>
> Adding the graph like this results in a error "weewx.UnknownType: cpu_temp”
>
>
> this is a new data_type so weewx as yet knows nothing about it. creating a 
> column for it only persists it in database, it doesn’t tell weewx what it 
> is (e.g. what units does it use)
>
> I've created my own services for a couple of raspberry pi sensors, but I 
> just store info in database names that already exist eg 
> "event.packet['pressure'] = 0.02953 * float(pressure)" and the data is then 
> easily used in a Belchertown graph..
>
>
> quite valid thing to do - you are hijacking weewx’s knowledge of existing 
> data_types to use for your own variables
>
> the Customisation Manual goes into this in great detail; you will get your 
> answer there.
> a partial answer is to say you need to add a definition to your 
> bin/user/extensions.py, such as
>
> weewx.units.obs_group_dict['cpu_temp'] = 'group_temperature'
>
> which tells weewx that ‘cpu_temp’ is a temperature thingy so degree_C and 
> degree_F are the kind of units to use for it
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/439e149a-2929-436a-8d62-7966fd87173an%40googlegroups.com.

Reply via email to