Maintenance 2nd (#4106)

* Add link to docs

* Fix link

* Update line breaks

* Update ordering

* Align vera platofrm to only use add_devices
(instead od add_devices_callback)

* Remove line break

* Use consts

* Update ordering

* Update ordering

* Use const, create default name, use string formatting

* Update ordering

* Use const

* Update import style

* Update ordering and line breaks

* update line breaks

* Set default port

* Set defaults and update ordering

* Update ordering

* Minor style updates

* Update ordering, defaults, line breaks, and readability

* Use constants

* Add line breaks

* use string formatting

* Update line breaks

* Update logger
This commit is contained in:
Fabian Affolter authored and GitHub committed 2016-10-30 09:58:34 +01:00
1 parent e6ece4bf6d
commit 9f2aae1357
28 files changed
+272 -271

No files matched your search

+11 -12
View File
@@ -6,31 +6,30 @@ https://home-assistant.io/components/sensor.bbox/
"""
import logging
from datetime import timedelta
import requests
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (CONF_NAME, CONF_MONITORED_VARIABLES,
ATTR_ATTRIBUTION)
from homeassistant.const import (
CONF_NAME, CONF_MONITORED_VARIABLES, ATTR_ATTRIBUTION)
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
import homeassistant.helpers.config_validation as cv
# Return cached results if last scan was less then this time ago
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
REQUIREMENTS = ['pybbox==0.0.5-alpha']
_LOGGER = logging.getLogger(__name__)
CONF_ATTRIBUTION = "Powered by Bouygues Telecom"
DEFAULT_NAME = 'Bbox'
# Bandwidth units
BANDWIDTH_MEGABITS_SECONDS = 'Mb/s' # type: str
# Sensor types are defined like so:
# Name, unit, icon
CONF_ATTRIBUTION = "Powered by Bouygues Telecom"
DEFAULT_NAME = 'Bbox'
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
# Sensor types are defined like so: Name, unit, icon
SENSOR_TYPES = {
'down_max_bandwidth': ['Maximum Download Bandwidth',
BANDWIDTH_MEGABITS_SECONDS, 'mdi:download'],
@@ -51,7 +50,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
# pylint: disable=too-many-arguments
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Bbox sensor."""
"""Set up the Bbox sensor."""
# Create a data fetcher to support all of the configured sensors. Then make
# the first call to init the data.
try: