From 8a15ee84db8f5c8586346eed7e160ca3db575ae3 Mon Sep 17 00:00:00 2001 From: Blaise Thompson Date: Thu, 31 Aug 2023 17:04:42 -0500 Subject: [PATCH] actually invert (#31) * actually invert * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- yaqd_mcc/_mcc_ulw_sensor.py | 2 ++ yaqd_mcc/mcc-ulw-sensor.avpr | 4 ++++ yaqd_mcc/mcc-ulw-sensor.toml | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/yaqd_mcc/_mcc_ulw_sensor.py b/yaqd_mcc/_mcc_ulw_sensor.py index 4c6f417..bacb97f 100644 --- a/yaqd_mcc/_mcc_ulw_sensor.py +++ b/yaqd_mcc/_mcc_ulw_sensor.py @@ -55,5 +55,7 @@ async def _measure(self): else: value = ul.a_in_32(0, c.index, ai_range) voltage = ul.to_eng_units_32(0, ai_range, value) + if c.invert: + voltage *= -1 out[c.name] = voltage return out diff --git a/yaqd_mcc/mcc-ulw-sensor.avpr b/yaqd_mcc/mcc-ulw-sensor.avpr index e8f5db3..a534693 100644 --- a/yaqd_mcc/mcc-ulw-sensor.avpr +++ b/yaqd_mcc/mcc-ulw-sensor.avpr @@ -1,5 +1,9 @@ { "config": { + "channels": { + "type": "map", + "values": "channel" + }, "enable": { "default": true, "doc": "Disable this daemon. The kind entry-point will not attempt to start this daemon.", diff --git a/yaqd_mcc/mcc-ulw-sensor.toml b/yaqd_mcc/mcc-ulw-sensor.toml index 27c3e0a..5510733 100644 --- a/yaqd_mcc/mcc-ulw-sensor.toml +++ b/yaqd_mcc/mcc-ulw-sensor.toml @@ -21,6 +21,10 @@ fields = [{"name"="enabled", "type"="boolean", "default"=true}, [config] +[config.channels] +type = "map" +values = "channel" + [state] [messages]