summaryrefslogtreecommitdiff
path: root/files/common/openwrt/sensors-read.lua
blob: b2fa6fd089bba22f35187bb00200112614348942 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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 .. " (" .. values['_kind_'] .. "):")
    for t, v in pairs(values) do
        if t ~= '_kind_' then print(" * " .. t .. " = " .. v) end
    end
end