diff --git a/tests/components/sql/__init__.py b/tests/components/sql/__init__.py index 9cdd026bd3bf..1d3ce0878c39 100644 --- a/tests/components/sql/__init__.py +++ b/tests/components/sql/__init__.py @@ -18,6 +18,7 @@ from homeassistant.const import ( CONF_UNIQUE_ID, CONF_UNIT_OF_MEASUREMENT, CONF_VALUE_TEMPLATE, + UnitOfInformation, ) from homeassistant.core import HomeAssistant from homeassistant.helpers.trigger_template_entity import ( @@ -170,10 +171,10 @@ YAML_CONFIG = { CONF_NAME: "Get Value", CONF_QUERY: "SELECT 5 as value", CONF_COLUMN_NAME: "value", - CONF_UNIT_OF_MEASUREMENT: "MiB", + CONF_UNIT_OF_MEASUREMENT: UnitOfInformation.MEBIBYTES, CONF_UNIQUE_ID: "unique_id_12345", CONF_VALUE_TEMPLATE: "{{ value }}", - CONF_DEVICE_CLASS: SensorDeviceClass.DATA_RATE, + CONF_DEVICE_CLASS: SensorDeviceClass.DATA_SIZE, CONF_STATE_CLASS: SensorStateClass.MEASUREMENT, } } diff --git a/tests/components/sql/test_sensor.py b/tests/components/sql/test_sensor.py index 9ac22f483125..6c2686cb6fe7 100644 --- a/tests/components/sql/test_sensor.py +++ b/tests/components/sql/test_sensor.py @@ -20,6 +20,7 @@ from homeassistant.const import ( CONF_UNIQUE_ID, STATE_UNAVAILABLE, STATE_UNKNOWN, + UnitOfInformation, ) from homeassistant.core import HomeAssistant from homeassistant.helpers import issue_registry as ir @@ -401,9 +402,9 @@ async def test_attributes_from_yaml_setup( state = hass.states.get("sensor.get_value") assert state.state == "5" - assert state.attributes["device_class"] == SensorDeviceClass.DATA_RATE + assert state.attributes["device_class"] == SensorDeviceClass.DATA_SIZE assert state.attributes["state_class"] == SensorStateClass.MEASUREMENT - assert state.attributes["unit_of_measurement"] == "MiB" + assert state.attributes["unit_of_measurement"] == UnitOfInformation.MEBIBYTES async def test_binary_data_from_yaml_setup(