[Ovmsdev] V3 set metrics

Michael Balzer dexter at expeedo.de
Mon Oct 23 22:25:22 HKT 2017


Am 09.10.2017 um 03:17 schrieb Mark Webb-Johnson:
> The issue is that for the MQTT and GATT protocols (generic IoT style), we need to provide granular updates. It just seems simpler to store things in that way in the first place. That way, the MQTT and GATT code in OVMS v3 can just publish all metrics in the same way - no need for per-metric logic. It is also trivial then to add per-vehicle custom metrics, as necessary.

That's clear for single flags with isolated semantics like "key on".

How about collections of semantically coupled flags?

I.e. how about battery cell voltage / temperature alert flags?

I would normally map these flags to a string metric with set syntax,
i.e. "3,7,12" to reflect active alerts on cells 3, 7 & 12.

That would still be a granularly updatable metric, happening to
transport structured information. As a client only interested in an
alert status change, I can subscribe to this single attribute.
Conversion to JSON can also be done by simply adding brackets.

If that makes sense, I'll have a look at adding some sort of
OvmsMetricsSet class for these cases -- I've been working on the metrics
module anyway.

Regards,
Michael

-- 
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26





More information about the OvmsDev mailing list