On Sun, Mar 22, 2015 at 03:26:30PM +0000, Stuart Henderson wrote:
> On 2015-03-22, T. Ribbrock <[email protected]> wrote:
> > What I cannot seem to get to work is that sensorsd *reacts* to these
> > changes. Based on the examples in the thread mentioned above, I've
> > created a small script "/etc/sensorsd/upd.sh" that looks as follows:
> > # cat /etc/sensorsd/upd.sh
> > echo "${@}" | logger -t UPD
> > I have then created the following sensorsd.conf:
> > hw.sensors.upd0.indicator0:high=0:command=/etc/sensorsd/upd.sh %x.%t%n
> > Charging %2 %s
> > hw.sensors.upd0.indicator1:high=0:command=/etc/sensorsd/upd.sh %x.%t%n
> > Discharging %2 %s
> > hw.sensors.upd0.indicator2:low=1:command=/etc/sensorsd/upd.sh %x.%t%n
> > ACPresent %2 %s
> > hw.sensors.upd0.indicator3:low=1:command=/etc/sensorsd/upd.sh %x.%t%n
> > BatteryPresent %2 %s
> > hw.sensors.upd0.indicator4:high=0:command=/etc/sensorsd/upd.sh %x.%t%n
> > ShutdownImminent %2 %s
> > hw.sensors.upd0.percent0:low=25:command=/etc/sensorsd/upd.sh %x.%t%n
> > FullChargeCapacity %2 %s
> > hw.sensors.upd0.percent1:low=25:command=/etc/sensorsd/upd.sh %x.%t%n
> > RemainingCapacity %2 %s
> It's a bit of a hack, but for the "normally on" sensors like ACPresent you
> can use :low=1:high=2
> http://www.undeadly.org/cgi?action=article&sid=20140320093943&pid=1
Thanks for the suggestion! I tried that just now for the ACPresent
sensor and changed the corresponding rule to
hw.sensors.upd0.indicator2:low=1:high=2:command=/etc/sensorsd/upd.sh %x.%t%n
ACPresent %2 %s
Upon starting sensorsd (with '-c 1'), I got the following messages:
sensorsd[23468]: upd0.indicator2: exceeds limits: On is below On
sensorsd[23468]: upd0.indicator3: exceeds limits: On is below On
UPD: upd0.indicator3 BatteryPresent On OK
UPD: upd0.indicator2 ACPresent On OK
UPD: upd0.percent0 FullChargeCapacity 100.00% OK
UPD: upd0.indicator0 Charging On OK
UPD: upd0.indicator4 ShutdownImminent Off OK
UPD: upd0.indicator1 Discharging Off OK
UPD: upd0.percent1 RemainingCapacity 88.00% OK
Then, I removed the power and waited for almost two minutes, but no
further messages appeared and no apparent reaction from sensorsd was
visible.
To be certain, I also tried the other way round, i.e. I restarted
sensorsd while the power was still removed:
sensorsd[24532]: upd0.indicator2: exceeds limits: Off is below On
sensorsd[24532]: upd0.indicator3: exceeds limits: On is below On
UPD: upd0.indicator0 Charging Off OK
UPD: upd0.indicator4 ShutdownImminent Off OK
UPD: upd0.indicator3 BatteryPresent On OK
UPD: upd0.indicator2 ACPresent Off OK
UPD: upd0.indicator1 Discharging On OK
UPD: upd0.percent1 RemainingCapacity 79.00% OK
UPD: upd0.percent0 FullChargeCapacity 100.00% OK
Then, I re-applied power, but that, too, was never flagged by sensorsd.
For some reason, it looks like sensorsd only ever detects a status
change (for these rules) when it gets started - but not afterwards.
Regards,
Thomas
--
-----------------------------------------------------------------------------
Thomas Ribbrock http://www.ribbrock.org/
"You have to live on the edge of reality - to make your dreams come true!"