i forgot to acknowledge the design consideration you raised that by calculating 
value once and storing it in the packet, unlike an xtype it is not 
re-calculated each time it is referenced

> On 28 Dec 2020, at 12:54 pm, Graham Eddy <[email protected]> wrote:
> 
> hmm, the ‘novelty’ i think is having an xtype calculated with values from 
> outside weewx (eg cpu temperature), and the expense of the calculation is not 
> really at issue - though normally they would be light-weight in case they are 
> used often (eg barometer)
> 
> architecturally anything external is supposed to brought into weewx via a 
> service and made available via weewx packet. (the *providing* of an xtype is 
> now positioned as a service, but the xtypes themselves are not.)
> 
> okay, i’ll recast my vitalstats from xtypes_service to data_service and not 
> bypass the packets...
> 
>> On 28 Dec 2020, at 11:40 am, Tom Keffer <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> That's a novel use of xtypes, but I'm not sure it's always a good idea. In 
>> this case, I think you'd be better off simply adding the type to the LOOP 
>> packet or archive record. 
>> 
>> The intended purpose of xtypes is to calculate derived variables. It's 
>> entirely possible it could be called many times during a reporting cycle, 
>> depending on the template used. Something involving I/O could be very 
>> expensive.
>> 
>> Having said that, xtypes also do database accesses, which can also be very 
>> expensive, so my advice is inconsistent. So, not saying never do it, but 
>> think it through.
> 

-- 
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/929A756F-DAE7-495C-9368-C85D2479E4F7%40gmail.com.

Reply via email to