Removed legacy backend.sensor.battery.

This commit is contained in:
Fabio Manganiello 2023-04-23 00:44:03 +02:00
parent 763d9e06ec
commit 259b42bdd6
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774
2 changed files with 0 additions and 53 deletions

View file

@ -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:

View file

@ -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