From 259b42bdd6d488ac9fefc3425818eacafdd038ea Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 23 Apr 2023 00:44:03 +0200 Subject: [PATCH] Removed legacy `backend.sensor.battery`. --- platypush/backend/sensor/battery/__init__.py | 40 ------------------- .../backend/sensor/battery/manifest.yaml | 13 ------ 2 files changed, 53 deletions(-) delete mode 100644 platypush/backend/sensor/battery/__init__.py delete mode 100644 platypush/backend/sensor/battery/manifest.yaml diff --git a/platypush/backend/sensor/battery/__init__.py b/platypush/backend/sensor/battery/__init__.py deleted file mode 100644 index 11e4ff0b20..0000000000 --- a/platypush/backend/sensor/battery/__init__.py +++ /dev/null @@ -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: diff --git a/platypush/backend/sensor/battery/manifest.yaml b/platypush/backend/sensor/battery/manifest.yaml deleted file mode 100644 index d3f0553349..0000000000 --- a/platypush/backend/sensor/battery/manifest.yaml +++ /dev/null @@ -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