mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Remove unneeded context switch in dyson (#41793)
dyson was running the add_message_listener code in the executor even though all it did was append to an array https://github.com/etheralm/libpurecool/blob/master/libpurecool/dyson_device.py#L213
This commit is contained in:
parent
5c540dcfcf
commit
ff2872e376
@ -50,9 +50,7 @@ class DysonAirSensor(AirQualityEntity):
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
"""Call when entity is added to hass."""
|
||||
self.hass.async_add_executor_job(
|
||||
self._device.add_message_listener, self.on_message
|
||||
)
|
||||
self._device.add_message_listener(self.on_message)
|
||||
|
||||
def on_message(self, message):
|
||||
"""Handle new messages which are received from the fan."""
|
||||
|
@ -97,7 +97,7 @@ class DysonPureHotCoolLinkEntity(ClimateEntity):
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
"""Call when entity is added to hass."""
|
||||
self.hass.async_add_job(self._device.add_message_listener, self.on_message)
|
||||
self._device.add_message_listener(self.on_message)
|
||||
|
||||
def on_message(self, message):
|
||||
"""Call when new messages received from the climate."""
|
||||
@ -243,9 +243,7 @@ class DysonPureHotCoolEntity(ClimateEntity):
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
"""Call when entity is added to hass."""
|
||||
self.hass.async_add_executor_job(
|
||||
self._device.add_message_listener, self.on_message
|
||||
)
|
||||
self._device.add_message_listener(self.on_message)
|
||||
|
||||
def on_message(self, message):
|
||||
"""Call when new messages received from the climate device."""
|
||||
|
@ -190,7 +190,7 @@ class DysonPureCoolLinkDevice(FanEntity):
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
"""Call when entity is added to hass."""
|
||||
self.hass.async_add_job(self._device.add_message_listener, self.on_message)
|
||||
self._device.add_message_listener(self.on_message)
|
||||
|
||||
def on_message(self, message):
|
||||
"""Call when new messages received from the fan."""
|
||||
@ -339,9 +339,7 @@ class DysonPureCoolDevice(FanEntity):
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
"""Call when entity is added to hass."""
|
||||
self.hass.async_add_executor_job(
|
||||
self._device.add_message_listener, self.on_message
|
||||
)
|
||||
self._device.add_message_listener(self.on_message)
|
||||
|
||||
def on_message(self, message):
|
||||
"""Call when new messages received from the fan."""
|
||||
|
@ -74,9 +74,7 @@ class DysonSensor(Entity):
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
"""Call when entity is added to hass."""
|
||||
self.hass.async_add_executor_job(
|
||||
self._device.add_message_listener, self.on_message
|
||||
)
|
||||
self._device.add_message_listener(self.on_message)
|
||||
|
||||
def on_message(self, message):
|
||||
"""Handle new messages which are received from the fan."""
|
||||
|
@ -64,7 +64,7 @@ class Dyson360EyeDevice(VacuumEntity):
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
"""Call when entity is added to hass."""
|
||||
self.hass.async_add_job(self._device.add_message_listener, self.on_message)
|
||||
self._device.add_message_listener(self.on_message)
|
||||
|
||||
def on_message(self, message):
|
||||
"""Handle a new messages that was received from the vacuum."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user