mirror of
https://github.com/home-assistant/core.git
synced 2025-07-30 10:48:01 +02:00
Add missing attribution (#22964)
This commit is contained in:
committed by
Sebastian Muszynski
parent
691271147e
commit
f4309dfcc6
@ -1,11 +1,12 @@
|
||||
"""Sensor for checking the status of London Underground tube lines."""
|
||||
import logging
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import ATTR_ATTRIBUTION
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
REQUIREMENTS = ['london-tube-status==0.2']
|
||||
@ -16,6 +17,8 @@ ATTRIBUTION = "Powered by TfL Open Data"
|
||||
|
||||
CONF_LINE = 'line'
|
||||
|
||||
ICON = 'mdi:subway'
|
||||
|
||||
SCAN_INTERVAL = timedelta(seconds=30)
|
||||
|
||||
TUBE_LINES = [
|
||||
@ -54,16 +57,15 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
|
||||
|
||||
class LondonTubeSensor(Entity):
|
||||
"""Sensor that reads the status of a line from TubeData."""
|
||||
|
||||
ICON = 'mdi:subway'
|
||||
"""Sensor that reads the status of a line from Tube Data."""
|
||||
|
||||
def __init__(self, name, data):
|
||||
"""Initialize the sensor."""
|
||||
self._name = name
|
||||
"""Initialize the London Underground sensor."""
|
||||
self._data = data
|
||||
self._state = None
|
||||
self._description = None
|
||||
self._name = name
|
||||
self._state = None
|
||||
self.attrs = {ATTR_ATTRIBUTION: ATTRIBUTION}
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
@ -78,14 +80,13 @@ class LondonTubeSensor(Entity):
|
||||
@property
|
||||
def icon(self):
|
||||
"""Icon to use in the frontend, if any."""
|
||||
return self.ICON
|
||||
return ICON
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
"""Return other details about the sensor state."""
|
||||
attrs = {}
|
||||
attrs['Description'] = self._description
|
||||
return attrs
|
||||
self.attrs['Description'] = self._description
|
||||
return self.attrs
|
||||
|
||||
def update(self):
|
||||
"""Update the sensor."""
|
||||
|
Reference in New Issue
Block a user