Skip to content

Commit

Permalink
Rename CONF_ATTRIBUTION to ATTRIBUTION (#21069)
Browse files Browse the repository at this point in the history
* Rename CONF_ATTRIBUTION to ATTRIBUTION

* Update homeassistant/components/sensor/irish_rail_transport.py

Co-Authored-By: fabaff <mail@fabian-affolter.ch>
  • Loading branch information
fabaff committed Feb 14, 2019
1 parent 03ec3ac commit cdc4dc3
Show file tree
Hide file tree
Showing 66 changed files with 232 additions and 239 deletions.
7 changes: 4 additions & 3 deletions homeassistant/components/abode/__init__.py
Expand Up @@ -17,7 +17,8 @@

_LOGGER = logging.getLogger(__name__)

CONF_ATTRIBUTION = "Data provided by goabode.com"
ATTRIBUTION = "Data provided by goabode.com"

CONF_POLLING = 'polling'

DOMAIN = 'abode'
Expand Down Expand Up @@ -280,7 +281,7 @@ def name(self):
def device_state_attributes(self):
"""Return the state attributes."""
return {
ATTR_ATTRIBUTION: CONF_ATTRIBUTION,
ATTR_ATTRIBUTION: ATTRIBUTION,
'device_id': self._device.device_id,
'battery_low': self._device.battery_low,
'no_response': self._device.no_response,
Expand Down Expand Up @@ -327,7 +328,7 @@ def name(self):
def device_state_attributes(self):
"""Return the state attributes."""
return {
ATTR_ATTRIBUTION: CONF_ATTRIBUTION,
ATTR_ATTRIBUTION: ATTRIBUTION,
'automation_id': self._automation.automation_id,
'type': self._automation.type,
'sub_type': self._automation.sub_type
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/abode/alarm_control_panel.py
Expand Up @@ -2,7 +2,7 @@
import logging

import homeassistant.components.alarm_control_panel as alarm
from homeassistant.components.abode import CONF_ATTRIBUTION, AbodeDevice
from homeassistant.components.abode import ATTRIBUTION, AbodeDevice
from homeassistant.components.abode import DOMAIN as ABODE_DOMAIN
from homeassistant.const import (
ATTR_ATTRIBUTION, STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME,
Expand Down Expand Up @@ -73,7 +73,7 @@ def name(self):
def device_state_attributes(self):
"""Return the state attributes."""
return {
ATTR_ATTRIBUTION: CONF_ATTRIBUTION,
ATTR_ATTRIBUTION: ATTRIBUTION,
'device_id': self._device.device_id,
'battery_backup': self._device.battery,
'cellular_backup': self._device.is_cellular,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/arlo/__init__.py
Expand Up @@ -15,7 +15,7 @@

_LOGGER = logging.getLogger(__name__)

CONF_ATTRIBUTION = "Data provided by arlo.netgear.com"
ATTRIBUTION = "Data provided by arlo.netgear.com"

DATA_ARLO = 'data_arlo'
DEFAULT_BRAND = 'Netgear Arlo'
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/arlo/alarm_control_panel.py
Expand Up @@ -9,7 +9,7 @@
from homeassistant.components.alarm_control_panel import (
AlarmControlPanel, PLATFORM_SCHEMA)
from homeassistant.components.arlo import (
DATA_ARLO, CONF_ATTRIBUTION, SIGNAL_UPDATE_ARLO)
DATA_ARLO, ATTRIBUTION, SIGNAL_UPDATE_ARLO)
from homeassistant.const import (
ATTR_ATTRIBUTION, STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME,
STATE_ALARM_DISARMED, STATE_ALARM_ARMED_NIGHT)
Expand Down Expand Up @@ -117,7 +117,7 @@ def name(self):
def device_state_attributes(self):
"""Return the state attributes."""
return {
ATTR_ATTRIBUTION: CONF_ATTRIBUTION,
ATTR_ATTRIBUTION: ATTRIBUTION,
'device_id': self._base_station.device_id
}

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/arlo/sensor.py
Expand Up @@ -6,7 +6,7 @@
from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv
from homeassistant.components.arlo import (
CONF_ATTRIBUTION, DEFAULT_BRAND, DATA_ARLO, SIGNAL_UPDATE_ARLO)
ATTRIBUTION, DEFAULT_BRAND, DATA_ARLO, SIGNAL_UPDATE_ARLO)
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
ATTR_ATTRIBUTION, CONF_MONITORED_CONDITIONS, TEMP_CELSIUS,
Expand Down Expand Up @@ -177,7 +177,7 @@ def device_state_attributes(self):
"""Return the device state attributes."""
attrs = {}

attrs[ATTR_ATTRIBUTION] = CONF_ATTRIBUTION
attrs[ATTR_ATTRIBUTION] = ATTRIBUTION
attrs['brand'] = DEFAULT_BRAND

if self._sensor_type != 'total_cameras':
Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/binary_sensor/aurora.py
Expand Up @@ -19,8 +19,8 @@

_LOGGER = logging.getLogger(__name__)

CONF_ATTRIBUTION = "Data provided by the National Oceanic and Atmospheric" \
"Administration"
ATTRIBUTION = "Data provided by the National Oceanic and Atmospheric " \
"Administration"
CONF_THRESHOLD = 'forecast_threshold'

DEFAULT_DEVICE_CLASS = 'visible'
Expand Down Expand Up @@ -91,7 +91,7 @@ def device_state_attributes(self):
if self.aurora_data:
attrs['visibility_level'] = self.aurora_data.visibility_level
attrs['message'] = self.aurora_data.is_visible_text
attrs[ATTR_ATTRIBUTION] = CONF_ATTRIBUTION
attrs[ATTR_ATTRIBUTION] = ATTRIBUTION
return attrs

def update(self):
Expand Down
18 changes: 7 additions & 11 deletions homeassistant/components/binary_sensor/ring.py
Expand Up @@ -11,7 +11,7 @@
import homeassistant.helpers.config_validation as cv

from homeassistant.components.ring import (
CONF_ATTRIBUTION, DEFAULT_ENTITY_NAMESPACE, DATA_RING)
ATTRIBUTION, DEFAULT_ENTITY_NAMESPACE, DATA_RING)

from homeassistant.const import (
ATTR_ATTRIBUTION, CONF_ENTITY_NAMESPACE, CONF_MONITORED_CONDITIONS)
Expand Down Expand Up @@ -47,18 +47,14 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
for device in ring.doorbells: # ring.doorbells is doing I/O
for sensor_type in config[CONF_MONITORED_CONDITIONS]:
if 'doorbell' in SENSOR_TYPES[sensor_type][1]:
sensors.append(RingBinarySensor(hass,
device,
sensor_type))
sensors.append(RingBinarySensor(hass, device, sensor_type))

for device in ring.stickup_cams: # ring.stickup_cams is doing I/O
for sensor_type in config[CONF_MONITORED_CONDITIONS]:
if 'stickup_cams' in SENSOR_TYPES[sensor_type][1]:
sensors.append(RingBinarySensor(hass,
device,
sensor_type))
sensors.append(RingBinarySensor(hass, device, sensor_type))

add_entities(sensors, True)
return True


class RingBinarySensor(BinarySensorDevice):
Expand All @@ -69,8 +65,8 @@ def __init__(self, hass, data, sensor_type):
super(RingBinarySensor, self).__init__()
self._sensor_type = sensor_type
self._data = data
self._name = "{0} {1}".format(self._data.name,
SENSOR_TYPES.get(self._sensor_type)[0])
self._name = "{0} {1}".format(
self._data.name, SENSOR_TYPES.get(self._sensor_type)[0])
self._device_class = SENSOR_TYPES.get(self._sensor_type)[2]
self._state = None
self._unique_id = '{}-{}'.format(self._data.id, self._sensor_type)
Expand Down Expand Up @@ -99,7 +95,7 @@ def unique_id(self):
def device_state_attributes(self):
"""Return the state attributes."""
attrs = {}
attrs[ATTR_ATTRIBUTION] = CONF_ATTRIBUTION
attrs[ATTR_ATTRIBUTION] = ATTRIBUTION

attrs['device_id'] = self._data.id
attrs['firmware'] = self._data.firmware
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/binary_sensor/uptimerobot.py
Expand Up @@ -19,7 +19,7 @@

ATTR_TARGET = 'target'

CONF_ATTRIBUTION = "Data provided by Uptime Robot"
ATTRIBUTION = "Data provided by Uptime Robot"

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_API_KEY): cv.string,
Expand Down Expand Up @@ -78,7 +78,7 @@ def device_class(self):
def device_state_attributes(self):
"""Return the state attributes of the binary sensor."""
return {
ATTR_ATTRIBUTION: CONF_ATTRIBUTION,
ATTR_ATTRIBUTION: ATTRIBUTION,
ATTR_TARGET: self._target,
}

Expand Down
7 changes: 3 additions & 4 deletions homeassistant/components/camera/ring.py
Expand Up @@ -13,7 +13,7 @@

from homeassistant.helpers import config_validation as cv
from homeassistant.components.ring import (
DATA_RING, CONF_ATTRIBUTION, NOTIFICATION_ID)
DATA_RING, ATTRIBUTION, NOTIFICATION_ID)
from homeassistant.components.camera import Camera, PLATFORM_SCHEMA
from homeassistant.components.ffmpeg import DATA_FFMPEG
from homeassistant.const import ATTR_ATTRIBUTION, CONF_SCAN_INTERVAL
Expand All @@ -34,8 +34,7 @@

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Optional(CONF_FFMPEG_ARGUMENTS): cv.string,
vol.Optional(CONF_SCAN_INTERVAL, default=SCAN_INTERVAL):
cv.time_period,
vol.Optional(CONF_SCAN_INTERVAL, default=SCAN_INTERVAL): cv.time_period,
})


Expand Down Expand Up @@ -106,7 +105,7 @@ def unique_id(self):
def device_state_attributes(self):
"""Return the state attributes."""
return {
ATTR_ATTRIBUTION: CONF_ATTRIBUTION,
ATTR_ATTRIBUTION: ATTRIBUTION,
'device_id': self._camera.id,
'firmware': self._camera.firmware,
'kind': self._camera.kind,
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/digital_ocean/__init__.py
Expand Up @@ -22,7 +22,8 @@
ATTR_REGION = 'region'
ATTR_VCPUS = 'vcpus'

CONF_ATTRIBUTION = 'Data provided by Digital Ocean'
ATTRIBUTION = 'Data provided by Digital Ocean'

CONF_DROPLETS = 'droplets'

DATA_DIGITAL_OCEAN = 'data_do'
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/digital_ocean/binary_sensor.py
Expand Up @@ -9,7 +9,7 @@
from homeassistant.components.digital_ocean import (
CONF_DROPLETS, ATTR_CREATED_AT, ATTR_DROPLET_ID, ATTR_DROPLET_NAME,
ATTR_FEATURES, ATTR_IPV4_ADDRESS, ATTR_IPV6_ADDRESS, ATTR_MEMORY,
ATTR_REGION, ATTR_VCPUS, CONF_ATTRIBUTION, DATA_DIGITAL_OCEAN)
ATTR_REGION, ATTR_VCPUS, ATTRIBUTION, DATA_DIGITAL_OCEAN)
from homeassistant.const import ATTR_ATTRIBUTION

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -71,7 +71,7 @@ def device_class(self):
def device_state_attributes(self):
"""Return the state attributes of the Digital Ocean droplet."""
return {
ATTR_ATTRIBUTION: CONF_ATTRIBUTION,
ATTR_ATTRIBUTION: ATTRIBUTION,
ATTR_CREATED_AT: self.data.created_at,
ATTR_DROPLET_ID: self.data.id,
ATTR_DROPLET_NAME: self.data.name,
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/digital_ocean/switch.py
Expand Up @@ -8,7 +8,7 @@
from homeassistant.components.digital_ocean import (
CONF_DROPLETS, ATTR_CREATED_AT, ATTR_DROPLET_ID, ATTR_DROPLET_NAME,
ATTR_FEATURES, ATTR_IPV4_ADDRESS, ATTR_IPV6_ADDRESS, ATTR_MEMORY,
ATTR_REGION, ATTR_VCPUS, CONF_ATTRIBUTION, DATA_DIGITAL_OCEAN)
ATTR_REGION, ATTR_VCPUS, ATTRIBUTION, DATA_DIGITAL_OCEAN)
from homeassistant.const import ATTR_ATTRIBUTION

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -65,7 +65,7 @@ def is_on(self):
def device_state_attributes(self):
"""Return the state attributes of the Digital Ocean droplet."""
return {
ATTR_ATTRIBUTION: CONF_ATTRIBUTION,
ATTR_ATTRIBUTION: ATTRIBUTION,
ATTR_CREATED_AT: self.data.created_at,
ATTR_DROPLET_ID: self.data.id,
ATTR_DROPLET_NAME: self.data.name,
Expand Down
5 changes: 3 additions & 2 deletions homeassistant/components/hydrawise/__init__.py
Expand Up @@ -20,7 +20,8 @@

ALLOWED_WATERING_TIME = [5, 10, 15, 30, 45, 60]

CONF_ATTRIBUTION = "Data provided by hydrawise.com"
ATTRIBUTION = "Data provided by hydrawise.com"

CONF_WATERING_TIME = 'watering_minutes'

NOTIFICATION_ID = 'hydrawise_notification'
Expand Down Expand Up @@ -141,6 +142,6 @@ def unit_of_measurement(self):
def device_state_attributes(self):
"""Return the state attributes."""
return {
ATTR_ATTRIBUTION: CONF_ATTRIBUTION,
ATTR_ATTRIBUTION: ATTRIBUTION,
'identifier': self.data.get('relay'),
}
8 changes: 4 additions & 4 deletions homeassistant/components/logi_circle/__init__.py
@@ -1,19 +1,19 @@
"""Support for Logi Circle devices."""
import logging
import asyncio
import logging

import voluptuous as vol
import async_timeout
import voluptuous as vol

from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
import homeassistant.helpers.config_validation as cv
from homeassistant.const import CONF_USERNAME, CONF_PASSWORD

REQUIREMENTS = ['logi_circle==0.1.7']

_LOGGER = logging.getLogger(__name__)
_TIMEOUT = 15 # seconds

CONF_ATTRIBUTION = "Data provided by circle.logi.com"
ATTRIBUTION = "Data provided by circle.logi.com"

NOTIFICATION_ID = 'logi_notification'
NOTIFICATION_TITLE = 'Logi Circle Setup'
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/logi_circle/camera.py
Expand Up @@ -7,7 +7,7 @@

from homeassistant.helpers import config_validation as cv
from homeassistant.components.logi_circle import (
DOMAIN as LOGI_CIRCLE_DOMAIN, CONF_ATTRIBUTION)
DOMAIN as LOGI_CIRCLE_DOMAIN, ATTRIBUTION)
from homeassistant.components.camera import (
Camera, PLATFORM_SCHEMA, CAMERA_SERVICE_SCHEMA, SUPPORT_ON_OFF,
ATTR_ENTITY_ID, ATTR_FILENAME, DOMAIN)
Expand Down Expand Up @@ -128,7 +128,7 @@ def supported_features(self):
def device_state_attributes(self):
"""Return the state attributes."""
state = {
ATTR_ATTRIBUTION: CONF_ATTRIBUTION,
ATTR_ATTRIBUTION: ATTRIBUTION,
'battery_saving_mode': (
STATE_ON if self._camera.battery_saving else STATE_OFF),
'ip_address': self._camera.ip_address,
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/logi_circle/sensor.py
Expand Up @@ -5,7 +5,7 @@

import homeassistant.helpers.config_validation as cv
from homeassistant.components.logi_circle import (
CONF_ATTRIBUTION, DEFAULT_ENTITY_NAMESPACE, DOMAIN as LOGI_CIRCLE_DOMAIN)
ATTRIBUTION, DEFAULT_ENTITY_NAMESPACE, DOMAIN as LOGI_CIRCLE_DOMAIN)
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
ATTR_ATTRIBUTION, ATTR_BATTERY_CHARGING,
Expand Down Expand Up @@ -86,7 +86,7 @@ def state(self):
def device_state_attributes(self):
"""Return the state attributes."""
state = {
ATTR_ATTRIBUTION: CONF_ATTRIBUTION,
ATTR_ATTRIBUTION: ATTRIBUTION,
'battery_saving_mode': (
STATE_ON if self._camera.battery_saving else STATE_OFF),
'ip_address': self._camera.ip_address,
Expand Down
5 changes: 3 additions & 2 deletions homeassistant/components/raincloud/__init__.py
Expand Up @@ -24,7 +24,8 @@

ALLOWED_WATERING_TIME = [5, 10, 15, 30, 45, 60]

CONF_ATTRIBUTION = "Data provided by Melnor Aquatimer.com"
ATTRIBUTION = "Data provided by Melnor Aquatimer.com"

CONF_WATERING_TIME = 'watering_minutes'

NOTIFICATION_ID = 'raincloud_notification'
Expand Down Expand Up @@ -165,7 +166,7 @@ def unit_of_measurement(self):
def device_state_attributes(self):
"""Return the state attributes."""
return {
ATTR_ATTRIBUTION: CONF_ATTRIBUTION,
ATTR_ATTRIBUTION: ATTRIBUTION,
'identifier': self.data.serial,
}

Expand Down
16 changes: 4 additions & 12 deletions homeassistant/components/raincloud/switch.py
@@ -1,16 +1,11 @@
"""
Support for Melnor RainCloud sprinkler water timer.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.raincloud/
"""
"""Support for Melnor RainCloud sprinkler water timer."""
import logging

import voluptuous as vol

import homeassistant.helpers.config_validation as cv
from homeassistant.components.raincloud import (
ALLOWED_WATERING_TIME, CONF_ATTRIBUTION, CONF_WATERING_TIME,
ALLOWED_WATERING_TIME, ATTRIBUTION, CONF_WATERING_TIME,
DATA_RAINCLOUD, DEFAULT_WATERING_TIME, RainCloudEntity, SWITCHES)
from homeassistant.components.switch import SwitchDevice, PLATFORM_SCHEMA
from homeassistant.const import (
Expand Down Expand Up @@ -38,12 +33,9 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
# create a sensor for each zone managed by faucet
for zone in raincloud.controller.faucet.zones:
sensors.append(
RainCloudSwitch(default_watering_timer,
zone,
sensor_type))
RainCloudSwitch(default_watering_timer, zone, sensor_type))

add_entities(sensors, True)
return True


class RainCloudSwitch(RainCloudEntity, SwitchDevice):
Expand Down Expand Up @@ -87,7 +79,7 @@ def update(self):
def device_state_attributes(self):
"""Return the state attributes."""
return {
ATTR_ATTRIBUTION: CONF_ATTRIBUTION,
ATTR_ATTRIBUTION: ATTRIBUTION,
'default_manual_timer': self._default_watering_timer,
'identifier': self.data.serial
}

0 comments on commit cdc4dc3

Please sign in to comment.