Fix unknown data in qwikswitch (#85621)
parent
d313d82eb7
commit
298d7504fd
|
@ -68,7 +68,7 @@ class QSSensor(QSEntity, SensorEntity):
|
|||
@property
|
||||
def native_value(self):
|
||||
"""Return the value of the sensor."""
|
||||
return str(self._val)
|
||||
return None if self._val is None else str(self._val)
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
|
|
|
@ -7,6 +7,7 @@ import pytest
|
|||
from yarl import URL
|
||||
|
||||
from homeassistant.components.qwikswitch import DOMAIN as QWIKSWITCH
|
||||
from homeassistant.const import STATE_UNKNOWN
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.test_util.aiohttp import AiohttpClientMockResponse, MockLongPollSideEffect
|
||||
|
@ -105,7 +106,7 @@ async def test_sensor_device(hass, aioclient_mock, qs_devices):
|
|||
await hass.async_block_till_done()
|
||||
|
||||
state_obj = hass.states.get("sensor.ss1")
|
||||
assert state_obj.state == "None"
|
||||
assert state_obj.state == STATE_UNKNOWN
|
||||
|
||||
# receive command that sets the sensor value
|
||||
listen_mock.queue_response(
|
||||
|
|
Loading…
Reference in New Issue