forked from platypush/platypush
Removed legacy backend.sensor.battery
.
This commit is contained in:
parent
763d9e06ec
commit
259b42bdd6
2 changed files with 0 additions and 53 deletions
|
@ -1,40 +0,0 @@
|
|||
from platypush.backend.sensor import SensorBackend
|
||||
from platypush.context import get_plugin
|
||||
|
||||
|
||||
class SensorBatteryBackend(SensorBackend):
|
||||
"""
|
||||
This backend listens for battery full/connect/disconnect/below/above threshold events.
|
||||
The sensor events triggered by this backend will include any of the following fields:
|
||||
|
||||
- ``battery_percent``
|
||||
- ``battery_power_plugged``
|
||||
|
||||
Requires:
|
||||
|
||||
- **psutil** (``pip install psutil``) for CPU load and stats.
|
||||
|
||||
Triggers:
|
||||
|
||||
* :class:`platypush.message.event.sensor.SensorDataChangeEvent` if the measurements of a sensor have changed
|
||||
* :class:`platypush.message.event.sensor.SensorDataAboveThresholdEvent` if the measurements of a sensor have
|
||||
gone above a configured threshold
|
||||
* :class:`platypush.message.event.sensor.SensorDataBelowThresholdEvent` if the measurements of a sensor have
|
||||
gone below a configured threshold
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
def get_measurement(self):
|
||||
plugin = get_plugin('system')
|
||||
battery = plugin.sensors_battery().output
|
||||
|
||||
return {
|
||||
'battery_percent': battery.get('percent'),
|
||||
'battery_power_plugged': bool(battery.get('power_plugged')),
|
||||
}
|
||||
|
||||
|
||||
# vim:sw=4:ts=4:et:
|
|
@ -1,13 +0,0 @@
|
|||
manifest:
|
||||
events:
|
||||
platypush.message.event.sensor.SensorDataAboveThresholdEvent: if the measurements
|
||||
of a sensor havegone above a configured threshold
|
||||
platypush.message.event.sensor.SensorDataBelowThresholdEvent: if the measurements
|
||||
of a sensor havegone below a configured threshold
|
||||
platypush.message.event.sensor.SensorDataChangeEvent: if the measurements of a
|
||||
sensor have changed
|
||||
install:
|
||||
pip:
|
||||
- psutil
|
||||
package: platypush.backend.sensor.battery
|
||||
type: backend
|
Loading…
Reference in a new issue