Update file header (#21023)
* Update file header * Update file header * Update file header * Update file header * Update file header * Fix lint issues
This commit is contained in:
parent
22af9707ad
commit
127c55e0c1
492 changed files with 1015 additions and 3497 deletions
|
@ -1,9 +1,4 @@
|
|||
"""
|
||||
Support for sensors from the Dovado router.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/sensor.dovado/
|
||||
"""
|
||||
"""Support for sensors from the Dovado router."""
|
||||
import logging
|
||||
import re
|
||||
from datetime import timedelta
|
||||
|
@ -31,20 +26,16 @@ SENSOR_SMS_UNREAD = 'sms'
|
|||
SENSORS = {
|
||||
SENSOR_NETWORK: ('signal strength', 'Network', None,
|
||||
'mdi:access-point-network'),
|
||||
SENSOR_SIGNAL: ('signal strength', 'Signal Strength', '%',
|
||||
'mdi:signal'),
|
||||
SENSOR_SIGNAL: ('signal strength', 'Signal Strength', '%', 'mdi:signal'),
|
||||
SENSOR_SMS_UNREAD: ('sms unread', 'SMS unread', '',
|
||||
'mdi:message-text-outline'),
|
||||
SENSOR_UPLOAD: ('traffic modem tx', 'Sent', 'GB',
|
||||
'mdi:cloud-upload'),
|
||||
SENSOR_UPLOAD: ('traffic modem tx', 'Sent', 'GB', 'mdi:cloud-upload'),
|
||||
SENSOR_DOWNLOAD: ('traffic modem rx', 'Received', 'GB',
|
||||
'mdi:cloud-download'),
|
||||
}
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
vol.Required(CONF_SENSORS): vol.All(
|
||||
cv.ensure_list, [vol.In(SENSORS)]
|
||||
),
|
||||
vol.Required(CONF_SENSORS): vol.All(cv.ensure_list, [vol.In(SENSORS)]),
|
||||
})
|
||||
|
||||
|
||||
|
@ -69,6 +60,7 @@ class DovadoSensor(Entity):
|
|||
self._state = self._compute_state()
|
||||
|
||||
def _compute_state(self):
|
||||
"""Compute the state of the sensor."""
|
||||
state = self._data.state.get(SENSORS[self._sensor][0])
|
||||
if self._sensor == SENSOR_NETWORK:
|
||||
match = re.search(r"\((.+)\)", state)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue