mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 10:17:51 +00:00
Avoid creating a task on callback in owntracks when using mqtt (#90548)
Nothing was being awaited in the callback. It did not need to be a coro
This commit is contained in:
parent
3a3c738945
commit
ed673a1b35
@ -24,6 +24,7 @@ from homeassistant.helpers.dispatcher import (
|
|||||||
)
|
)
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.setup import async_when_setup
|
from homeassistant.setup import async_when_setup
|
||||||
|
from homeassistant.util.json import json_loads
|
||||||
|
|
||||||
from .config_flow import CONF_SECRET
|
from .config_flow import CONF_SECRET
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
@ -133,10 +134,11 @@ async def async_connect_mqtt(hass, component):
|
|||||||
"""Subscribe to MQTT topic."""
|
"""Subscribe to MQTT topic."""
|
||||||
context = hass.data[DOMAIN]["context"]
|
context = hass.data[DOMAIN]["context"]
|
||||||
|
|
||||||
async def async_handle_mqtt_message(msg):
|
@callback
|
||||||
|
def async_handle_mqtt_message(msg):
|
||||||
"""Handle incoming OwnTracks message."""
|
"""Handle incoming OwnTracks message."""
|
||||||
try:
|
try:
|
||||||
message = json.loads(msg.payload)
|
message = json_loads(msg.payload)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# If invalid JSON
|
# If invalid JSON
|
||||||
_LOGGER.error("Unable to parse payload as JSON: %s", msg.payload)
|
_LOGGER.error("Unable to parse payload as JSON: %s", msg.payload)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user