summaryrefslogtreecommitdiff
path: root/files/common/openwrt/sensors-read.lua
diff options
context:
space:
mode:
Diffstat (limited to 'files/common/openwrt/sensors-read.lua')
-rwxr-xr-xfiles/common/openwrt/sensors-read.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/files/common/openwrt/sensors-read.lua b/files/common/openwrt/sensors-read.lua
new file mode 100755
index 00000000..e441b9ea
--- /dev/null
+++ b/files/common/openwrt/sensors-read.lua
@@ -0,0 +1,15 @@
+#!/usr/bin/lua
+
+local sensors = require "sensors"
+
+local config, err = sensors.read_config('/etc/sensors.json')
+if not config then error(err) end
+
+local readings, err = sensors.read(config)
+if not readings then error(err) end
+for name, values in pairs(readings) do
+ print(name .. ":")
+ for t, v in pairs(values) do
+ print(" * " .. t .. " = " .. v)
+ end
+end