diff --git a/custom_components/xiaomi_home/config_flow.py b/custom_components/xiaomi_home/config_flow.py index 7818d47..7c0d20a 100644 --- a/custom_components/xiaomi_home/config_flow.py +++ b/custom_components/xiaomi_home/config_flow.py @@ -159,7 +159,7 @@ class XiaomiMihomeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): self._area_name_rule = self.DEFAULT_AREA_NAME_RULE self._action_debug = False self._hide_non_standard_entities = False - self._display_binary_mode = ['text'] + self._display_binary_mode = ['bool'] self._display_devices_changed_notify = ['add', 'del', 'offline'] self._auth_info = {} self._nick_name = DEFAULT_NICK_NAME diff --git a/custom_components/xiaomi_home/sensor.py b/custom_components/xiaomi_home/sensor.py index 148a459..6151b50 100644 --- a/custom_components/xiaomi_home/sensor.py +++ b/custom_components/xiaomi_home/sensor.py @@ -53,7 +53,7 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.components.sensor import SensorEntity, SensorDeviceClass -from homeassistant.components.sensor import DEVICE_CLASS_UNITS +from homeassistant.components.sensor import DEVICE_CLASS_UNITS, SensorStateClass from .miot.miot_device import MIoTDevice, MIoTPropertyEntity from .miot.miot_spec import MIoTSpecProperty @@ -115,6 +115,9 @@ class Sensor(MIoTPropertyEntity, SensorEntity): # Set state_class if spec.state_class: self._attr_state_class = spec.state_class + else: + # Set default state_class + self._attr_state_class = SensorStateClass.MEASUREMENT @property def native_value(self) -> Any: