for the impatient, here are my questions: - Although I use the same (undocumented, undeadly.org) trick of "low=1:high=2" for indicators everywhere, this can result in "On is below On", and "Off is below On" - Although I use "low=1:high=2", I get "On" for %3 (low limit) as well as for %4 (high limit) - Reading sensorsd.conf(5): "If the limits are crossed or if the status provided by the driver changes, sensorsd(8)'s alert functionality is triggered and a command, if specified, is executed" If limits are crossed, yes; if status changes, no, unless you use the "low=1:high=2" trick. - Reading sensorsd.conf(5): "Values for all other types of sensors can be specified in the same units as they appear under the sysctl(8) hw.sensors tree." No: "low=Off:high=On" results in (sensorsd -c 1 -d): "sensorsd: incorrect value: Off: file or directory not found"
(for the more patient these will come up later...) j...@entropicblur.com (Joe Gidi), 2014.11.28 (Fri) 17:40 (CET): > On Fri, November 28, 2014 2:45 am, Marcus MERIGHI wrote: > > j...@entropicblur.com (Joe Gidi), 2014.11.27 (Thu) 16:41 (CET): > >> I just spent some more time poking at this and I'm still unable to get > > > > So did I... > > > >> sensorsd to recognize upd state changes. This is a bit of a frustrating > >> regression from my point of view, since I can no longer use apcupsd > >> unless > >> I disable uhidev in the kernel. > >> > >> Does anyone have a working example configuration for sensorsd/upd? > > > > What I have now: > > > > $ getcap -a -f /etc/sensorsd.conf > > hw.sensors.upd0.indicator0:low=1:high=2:command=/etc/sensorsd/upd.sh \ > > %l %n %s %x %t %2 %3 %4 > > hw.sensors.upd0.indicator1:low=1:high=2:command=/etc/sensorsd/upd.sh \ > > %l %n %s %x %t %2 %3 %4 > > hw.sensors.upd0.indicator2:low=1:high=2:command=/etc/sensorsd/upd.sh \ > > %l %n %s %x %t %2 %3 %4 > > hw.sensors.upd0.indicator3:low=1:high=2:command=/etc/sensorsd/upd.sh \ > > %l %n %s %x %t %2 %3 %4 > > hw.sensors.upd0.indicator4:low=1:high=2:command=/etc/sensorsd/upd.sh \ > > %l %n %s %x %t %2 %3 %4 > > hw.sensors.upd0.percent0:low=10:high=100:command=\ > > /etc/sensorsd/upd-capacityremaining.sh %l %n %s %x %t %2 %3 %4 > > hw.sensors.upd0.percent1:low=95:high=100:command=/etc/sensorsd/upd.sh \ > > %l %n %s %x %t %2 %3 %4 > > > > The ``command=/etc/sensorsd/upd.sh'' lines are just informational. > > > > The workhorse is "command=/etc/sensorsd/upd-capacityremaining.sh": > > ---- > > #!/bin/sh -e > > if [[ X"${1}" == X"below" ]]; then > > logger -t "UPD-capacityremaining" "SHUTDOWN (${@})" > > shutdown -hp +1 > > else > > logger -t "UPD-capacityremaining" "NON-SHUTDOWN (${@})" > > fi > > ---- > > > > I did some testing (plug/unplug, wait for hw.sensors.upd0.percent0 to go > > below low=) and left it as "working". > > Thanks for this! The percent0 example will be useful. Were you able to get > any useful results with the other indicator sensors? The 'low=1:high=2' > attributes don't seem to do anything for me. What I never mentioned: for now I'm running sensorsd(8) with '-c 1'. What happens in syslog when running unplugged with the above config, the UPD:-lines are from the script 'command=/etc/sensorsd/upd.sh %l %n %s %x %t %2 %3 %4' which just does 'echo "${@}" | logger -t UPD' I've trimmed and shuffled the lines a bit to have a better reading experience. Commented lines after syslog lines are my comments and the config (without parameters to command=). -------- sensorsd[14579]: startup, system has 9 sensors # just restarted sensorsd sensorsd[658]: upd0.indicator0: Off, OK sensorsd[658]: upd0.indicator0: exceeds limits: Off is below On UPD: below 0 OK upd0 indicator Off On On # Charging is Off, command= is run. # hw.sensors.upd0.indicator0:low=1:high=2:command=/etc/sensorsd/upd.sh sensorsd[658]: upd0.indicator1: On, OK sensorsd[658]: upd0.indicator1: exceeds limits: On is below On UPD: below 1 OK upd0 indicator On On On # Discharging is On, command= is run # hw.sensors.upd0.indicator1:low=1:high=2:command=/etc/sensorsd/upd.sh sensorsd[658]: upd0.indicator2: Off, OK sensorsd[658]: upd0.indicator2: exceeds limits: Off is below On UPD: below 2 OK upd0 indicator Off On On # ACPresent is Off, command= is run # hw.sensors.upd0.indicator2:low=1:high=2:command=/etc/sensorsd/upd.sh sensorsd[658]: upd0.indicator3: On, OK sensorsd[658]: upd0.indicator3: exceeds limits: On is below On UPD: below 3 OK upd0 indicator On On On # BatteryPresent is On, command= is run # hw.sensors.upd0.indicator3:low=1:high=2:command=/etc/sensorsd/upd.sh sensorsd[658]: upd0.indicator4: Off, OK sensorsd[658]: upd0.indicator4: exceeds limits: Off is below On UPD: below 4 OK upd0 indicator Off On On # ShutdownImminent is Off, command= is run # hw.sensors.upd0.indicator4:low=1:high=2:command=/etc/sensorsd/upd.sh # todo: test low=2:high=1:; # todo: check whether it flips when upd0.percent0 goes below "low=". sensorsd[658]: upd0.percent0: 71.00%, OK sensorsd[658]: upd0.percent0: within limits: 71.00% # RemainingCapacity is 71%, command= is run but does no syslog output # hw.sensors.upd0.percent0:low=10:high=100:command=/etc/sensorsd/\ # upd-capacityremaining.sh # the value I rely on. sensorsd[658]: upd0.percent1: 100.00%, OK sensorsd[658]: upd0.percent1: within limits: 100.00% UPD: within 1 OK upd0 percent 100.00% 95.00% 100.00% # FullChargeCapacity is 100%, command= is run # hw.sensors.upd0.percent1:low=95:high=100:command=/etc/sensorsd/upd.sh -------- Noteworthy: - Although I use the same (undocumented, undeadly.org) trick of "low=1:high=2" for indicators everywhere, this can result in "On is below On", and "Off is below On" - Although I use "low=1:high=2", I get "On" for %3 (low limit) as well as for %4 (high limit) - Reading sensorsd.conf(5): "If the limits are crossed or if the status provided by the driver changes, sensorsd(8)'s alert functionality is triggered and a command, if specified, is executed" If limits are crossed, yes; if status changes, no, unless you use the "low=1:high=2" trick. - Reading sensorsd.conf(5): "Values for all other types of sensors can be specified in the same units as they appear under the sysctl(8) hw.sensors tree." No: "low=Off:high=On" results in (sensorsd -c 1 -d): "sensorsd: incorrect value: Off: file or directory not found" BTW, does anyone get the full list of sensors according to upd(4)? RelativeStateOfCharge AbsoluteStateOfCharge RemainingCapacity FullChargeCapacity Charging Discharging BatteryPresent ShutdownImminent ACPresent AtRateTimeToFull Bye, Marcus