Skip to content

Commit

Permalink
Fix async_get_hass in wrong context
Browse files Browse the repository at this point in the history
Use hass variable from device itself instead of getting it async which
would have made sense to beginn with.
  • Loading branch information
rautesamtr authored Jan 9, 2023
1 parent 781aa47 commit b7fff5f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom_components/thermal_comfort/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
STATE_UNKNOWN,
UnitOfTemperature,
)
from homeassistant.core import HomeAssistant, async_get_hass
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import TemplateError
from homeassistant.helpers import entity_registry
import homeassistant.helpers.config_validation as cv
Expand Down Expand Up @@ -695,7 +695,7 @@ async def temperature_state_listener(self, event):

async def _new_temperature_state(self, state):
if _is_valid_state(state):
hass = async_get_hass()
hass = self.hass
unit = state.attributes.get(ATTR_UNIT_OF_MEASUREMENT, hass.config.units.temperature_unit)
temp = util.convert(state.state, float)
# convert to celsius if necessary
Expand Down

0 comments on commit b7fff5f

Please sign in to comment.