Use json_loads_object in arwn (#88611)
This commit is contained in:
parent
9fc6700c5a
commit
95dd62186e
1 changed files with 3 additions and 3 deletions
|
@ -1,7 +1,6 @@
|
|||
"""Support for collecting data from the ARWN project."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
|
||||
from homeassistant.components import mqtt
|
||||
|
@ -11,6 +10,7 @@ from homeassistant.core import HomeAssistant, callback
|
|||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
from homeassistant.util import slugify
|
||||
from homeassistant.util.json import json_loads_object
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -102,7 +102,7 @@ async def async_setup_platform(
|
|||
"""Set up the ARWN platform."""
|
||||
|
||||
@callback
|
||||
def async_sensor_event_received(msg):
|
||||
def async_sensor_event_received(msg: mqtt.ReceiveMessage) -> None:
|
||||
"""Process events as sensors.
|
||||
|
||||
When a new event on our topic (arwn/#) is received we map it
|
||||
|
@ -115,7 +115,7 @@ async def async_setup_platform(
|
|||
This lets us dynamically incorporate sensors without any
|
||||
configuration on our side.
|
||||
"""
|
||||
event = json.loads(msg.payload)
|
||||
event = json_loads_object(msg.payload)
|
||||
sensors = discover_sensors(msg.topic, event)
|
||||
if not sensors:
|
||||
return
|
||||
|
|
Loading…
Add table
Reference in a new issue