Skip to content

Commit

Permalink
Fix code after blueprint merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Limych committed Oct 29, 2023
1 parent 708422c commit 79e2b06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
File renamed without changes.
13 changes: 6 additions & 7 deletions custom_components/temperature_feels_like/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
DOMAIN as CLIMATE,
)
from homeassistant.components.group import expand_entity_ids
from homeassistant.components.recorder.models import LazyState
from homeassistant.components.weather import (
ATTR_WEATHER_HUMIDITY,
ATTR_WEATHER_TEMPERATURE,
Expand All @@ -36,7 +35,7 @@
STATE_UNKNOWN,
TEMP_CELSIUS,
)
from homeassistant.core import HomeAssistant, callback, split_entity_id
from homeassistant.core import HomeAssistant, State, callback, split_entity_id
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.event import async_track_state_change
Expand Down Expand Up @@ -178,7 +177,7 @@ def sensor_startup(event):
"""Update entity on startup."""
entities = set()
for entity_id in self._sources:
state: LazyState = self.hass.states.get(entity_id)
state: State = self.hass.states.get(entity_id)
domain = split_entity_id(state.entity_id)[0]
device_class = state.attributes.get(ATTR_DEVICE_CLASS)
unit_of_measurement = state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
Expand Down Expand Up @@ -210,7 +209,7 @@ def sensor_startup(event):
entities.add(entity_id)

if not self._name:
state: LazyState = self.hass.states.get(self._temp)
state: State = self.hass.states.get(self._temp)
self._name = state.name
if self._name.lower().find("temperature") < 0:
self._name += " Temperature"
Expand All @@ -236,7 +235,7 @@ def _get_temperature(self, entity_id: Optional[str]) -> Optional[float]:
"""Get temperature value (in °C) from entity."""
if entity_id is None:
return None
state: LazyState = self.hass.states.get(entity_id)
state: State = self.hass.states.get(entity_id)
if state is None:
return None

Expand Down Expand Up @@ -268,7 +267,7 @@ def _get_humidity(self, entity_id: Optional[str]) -> Optional[float]:
"""Get humidity value from entity."""
if entity_id is None:
return None
state: LazyState = self.hass.states.get(entity_id)
state: State = self.hass.states.get(entity_id)
if state is None:
return None

Expand All @@ -289,7 +288,7 @@ def _get_wind_speed(self, entity_id: Optional[str]) -> Optional[float]:
"""Get wind speed value from entity."""
if entity_id is None:
return 0.0
state: LazyState = self.hass.states.get(entity_id)
state: State = self.hass.states.get(entity_id)
if state is None:
return 0.0

Expand Down

0 comments on commit 79e2b06

Please sign in to comment.