Fix unknown data in qwikswitch (#85621)

pull/84443/head
epenet 2023-01-10 16:42:28 +01:00 committed by GitHub
parent d313d82eb7
commit 298d7504fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -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):

View File

@ -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(