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
1 changed files with 4 additions and 2 deletions
|
@ -24,6 +24,7 @@ from homeassistant.helpers.dispatcher import (
|
|||
)
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.setup import async_when_setup
|
||||
from homeassistant.util.json import json_loads
|
||||
|
||||
from .config_flow import CONF_SECRET
|
||||
from .const import DOMAIN
|
||||
|
@ -133,10 +134,11 @@ async def async_connect_mqtt(hass, component):
|
|||
"""Subscribe to MQTT topic."""
|
||||
context = hass.data[DOMAIN]["context"]
|
||||
|
||||
async def async_handle_mqtt_message(msg):
|
||||
@callback
|
||||
def async_handle_mqtt_message(msg):
|
||||
"""Handle incoming OwnTracks message."""
|
||||
try:
|
||||
message = json.loads(msg.payload)
|
||||
message = json_loads(msg.payload)
|
||||
except ValueError:
|
||||
# If invalid JSON
|
||||
_LOGGER.error("Unable to parse payload as JSON: %s", msg.payload)
|
||||
|
|
Loading…
Add table
Reference in a new issue