Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions homeassistant/components/alarm_control_panel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,11 @@ def supported_features(self) -> int:
@property
def state_attributes(self):
"""Return the state attributes."""
state_attr = {
return {
ATTR_CODE_FORMAT: self.code_format,
ATTR_CHANGED_BY: self.changed_by,
ATTR_CODE_ARM_REQUIRED: self.code_arm_required,
}
return state_attr


class AlarmControlPanel(AlarmControlPanelEntity):
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/alarmdecoder/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ def should_poll(self):
@property
def device_state_attributes(self):
"""Return the state attributes."""
attr = {}
attr[CONF_ZONE_NUMBER] = self._zone_number
attr = {CONF_ZONE_NUMBER: self._zone_number}
if self._rfid and self._rfstate is not None:
attr[ATTR_RF_BIT0] = bool(self._rfstate & 0x01)
attr[ATTR_RF_LOW_BAT] = bool(self._rfstate & 0x02)
Expand Down
4 changes: 1 addition & 3 deletions homeassistant/components/bom/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def state(self):
@property
def device_state_attributes(self):
"""Return the state attributes of the device."""
attr = {
return {
ATTR_ATTRIBUTION: ATTRIBUTION,
ATTR_LAST_UPDATE: self.bom_data.last_updated,
ATTR_SENSOR_ID: self._condition,
Expand All @@ -184,8 +184,6 @@ def device_state_attributes(self):
ATTR_ZONE_ID: self.bom_data.latest_data["history_product"],
}

return attr

@property
def unit_of_measurement(self):
"""Return the units of measurement."""
Expand Down
4 changes: 1 addition & 3 deletions homeassistant/components/environment_canada/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ def name(self):
@property
def device_state_attributes(self):
"""Return the state attributes of the device."""
attr = {ATTR_ATTRIBUTION: CONF_ATTRIBUTION, ATTR_UPDATED: self.timestamp}

return attr
return {ATTR_ATTRIBUTION: CONF_ATTRIBUTION, ATTR_UPDATED: self.timestamp}

@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/filesize/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,11 @@ def icon(self):
@property
def device_state_attributes(self):
"""Return other details about the sensor state."""
attr = {
return {
"path": self._path,
"last_updated": self._last_updated,
"bytes": self._size,
}
return attr

@property
def unit_of_measurement(self):
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/folder/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,13 @@ def icon(self):
@property
def device_state_attributes(self):
"""Return other details about the sensor state."""
attr = {
return {
"path": self._folder_path,
"filter": self._filter_term,
"number_of_files": self._number_of_files,
"bytes": self._size,
"file_list": self._file_list,
}
return attr

@property
def unit_of_measurement(self):
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/fritzbox_netmonitor/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def state_attributes(self):
# Don't return attributes if FritzBox is unreachable
if self._state == STATE_UNAVAILABLE:
return {}
attr = {
return {
ATTR_IS_LINKED: self._is_linked,
ATTR_IS_CONNECTED: self._is_connected,
ATTR_EXTERNAL_IP: self._external_ip,
Expand All @@ -110,7 +110,6 @@ def state_attributes(self):
ATTR_MAX_BYTE_RATE_UP: self._max_byte_rate_up,
ATTR_MAX_BYTE_RATE_DOWN: self._max_byte_rate_down,
}
return attr

@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/hikvision/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,7 @@ def should_poll(self):
@property
def device_state_attributes(self):
"""Return the state attributes."""
attr = {}
attr[ATTR_LAST_TRIP_TIME] = self._sensor_last_update()
attr = {ATTR_LAST_TRIP_TIME: self._sensor_last_update()}

if self._delay != 0:
attr[ATTR_DELAY] = self._delay
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/homematic/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,7 @@ def state(self):
@property
def state_attributes(self):
"""Return the state attributes."""
attr = self._variables.copy()
return attr
return self._variables.copy()

@property
def icon(self):
Expand Down
4 changes: 1 addition & 3 deletions homeassistant/components/image_processing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,7 @@ def device_class(self):
@property
def state_attributes(self):
"""Return device specific state attributes."""
attr = {ATTR_FACES: self.faces, ATTR_TOTAL_FACES: self.total_faces}

return attr
return {ATTR_FACES: self.faces, ATTR_TOTAL_FACES: self.total_faces}

def process_faces(self, faces, total):
"""Send event with detected faces and store data."""
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/iota/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ def name(self):
@property
def device_state_attributes(self):
"""Return the state attributes of the device."""
attr = {CONF_WALLET_NAME: self._name}
return attr
return {CONF_WALLET_NAME: self._name}

@property
def api(self):
Expand Down
4 changes: 1 addition & 3 deletions homeassistant/components/lutron/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,4 @@ def name(self):
@property
def device_state_attributes(self):
"""Return the state attributes."""
attr = {}
attr["lutron_integration_id"] = self._lutron_device.id
return attr
return {"lutron_integration_id": self._lutron_device.id}
4 changes: 1 addition & 3 deletions homeassistant/components/lutron/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,4 @@ def update(self):
@property
def device_state_attributes(self):
"""Return the state attributes."""
attr = {}
attr["Lutron Integration ID"] = self._lutron_device.id
return attr
return {"Lutron Integration ID": self._lutron_device.id}
3 changes: 1 addition & 2 deletions homeassistant/components/lutron/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ def turn_off(self, **kwargs):
@property
def device_state_attributes(self):
"""Return the state attributes."""
attr = {"lutron_integration_id": self._lutron_device.id}
return attr
return {"lutron_integration_id": self._lutron_device.id}

@property
def is_on(self):
Expand Down
7 changes: 2 additions & 5 deletions homeassistant/components/lutron/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ def turn_off(self, **kwargs):
@property
def device_state_attributes(self):
"""Return the state attributes."""
attr = {}
attr["lutron_integration_id"] = self._lutron_device.id
return attr
return {"lutron_integration_id": self._lutron_device.id}

@property
def is_on(self):
Expand Down Expand Up @@ -83,12 +81,11 @@ def turn_off(self, **kwargs):
@property
def device_state_attributes(self):
"""Return the state attributes."""
attr = {
return {
"keypad": self._keypad_name,
"scene": self._scene_name,
"led": self._lutron_device.name,
}
return attr

@property
def is_on(self):
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/mfi/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def current_power_w(self):
@property
def device_state_attributes(self):
"""Return the state attributes for the device."""
attr = {}
attr["volts"] = round(self._port.data.get("v_rms", 0), 1)
attr["amps"] = round(self._port.data.get("i_rms", 0), 1)
return attr
return {
"volts": round(self._port.data.get("v_rms", 0), 1),
"amps": round(self._port.data.get("i_rms", 0), 1),
}
3 changes: 1 addition & 2 deletions homeassistant/components/miflora/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ def available(self):
@property
def device_state_attributes(self):
"""Return the state attributes of the device."""
attr = {ATTR_LAST_SUCCESSFUL_UPDATE: self.last_successful_update}
return attr
return {ATTR_LAST_SUCCESSFUL_UPDATE: self.last_successful_update}

@property
def unit_of_measurement(self):
Expand Down
4 changes: 1 addition & 3 deletions homeassistant/components/openalpr_local/image_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ def device_class(self):
@property
def state_attributes(self):
"""Return device specific state attributes."""
attr = {ATTR_PLATES: self.plates, ATTR_VEHICLES: self.vehicles}

return attr
return {ATTR_PLATES: self.plates, ATTR_VEHICLES: self.vehicles}

def process_plates(self, plates, vehicles):
"""Send event with new plates and store data."""
Expand Down
4 changes: 1 addition & 3 deletions homeassistant/components/plex/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,16 +597,14 @@ def play_media(self, media_type, media_id, **kwargs):
@property
def device_state_attributes(self):
"""Return the scene state attributes."""
attr = {
return {
"media_content_rating": self._media_content_rating,
"session_username": self.username,
"media_library_name": self._app_name,
"summary": self.media_summary,
"player_source": self.player_source,
}

return attr

@property
def device_info(self):
"""Return a device description for device registry."""
Expand Down
3 changes: 1 addition & 2 deletions homeassistant/components/simulated/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def unit_of_measurement(self):
@property
def device_state_attributes(self):
"""Return other details about the sensor state."""
attr = {
return {
"amplitude": self._amp,
"mean": self._mean,
"period": self._period,
Expand All @@ -151,4 +151,3 @@ def device_state_attributes(self):
"seed": self._seed,
"relative_to_epoch": self._relative_to_epoch,
}
return attr
3 changes: 1 addition & 2 deletions homeassistant/components/swiss_public_transport/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def device_state_attributes(self):
self._opendata.connections[0]["departure"]
) - dt_util.as_local(dt_util.utcnow())

attr = {
return {
ATTR_TRAIN_NUMBER: self._opendata.connections[0]["number"],
ATTR_PLATFORM: self._opendata.connections[0]["platform"],
ATTR_TRANSFERS: self._opendata.connections[0]["transfers"],
Expand All @@ -116,7 +116,6 @@ def device_state_attributes(self):
ATTR_ATTRIBUTION: ATTRIBUTION,
ATTR_DELAY: self._opendata.connections[0]["delay"],
}
return attr

@property
def icon(self):
Expand Down
5 changes: 1 addition & 4 deletions homeassistant/components/synology_dsm/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,4 @@ class SynoDSMStorageBinarySensor(SynologyDSMDeviceEntity, BinarySensorEntity):
@property
def is_on(self) -> bool:
"""Return the state."""
attr = getattr(self._api.storage, self.entity_type)(self._device_id)
if attr is None:
return None
return attr
return getattr(self._api.storage, self.entity_type)(self._device_id)
3 changes: 1 addition & 2 deletions homeassistant/components/tradfri/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ def __init__(self, device, api, gateway_id):
@property
def device_state_attributes(self):
"""Return the state attributes."""
attr = {ATTR_MODEL: self._device.device_info.model_number}
return attr
return {ATTR_MODEL: self._device.device_info.model_number}

@property
def current_cover_position(self):
Expand Down