Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: refactor miot device and spec #592

Merged
merged 38 commits into from
Jan 17, 2025
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
eddeafa
fix: fix miot_device type error
topsworld Jan 7, 2025
d9d8433
fix: fix type error
topsworld Jan 7, 2025
e4dfdf6
feat: remove spec cache storage
topsworld Jan 8, 2025
078adfb
feat: update std_lib and multi_lang logic
topsworld Jan 8, 2025
3399e3b
feat: update entity value-range
topsworld Jan 8, 2025
d25d3f6
feat: update value-list logic
topsworld Jan 9, 2025
93f04b1
feat: update prop.format_ logic
topsworld Jan 9, 2025
fca97e0
fix: fix miot cloud log error
topsworld Jan 9, 2025
792d70f
merge: merge main to this branch
topsworld Jan 10, 2025
60e57e8
fix: fix fan entity
topsworld Jan 10, 2025
8d5feba
Merge branch 'main' into refactor-miot-spec-device
topsworld Jan 10, 2025
018b213
Merge branch 'main' into refactor-miot-spec-device
topsworld Jan 13, 2025
7c1cbea
Merge branch 'main' into refactor-miot-spec-device
topsworld Jan 15, 2025
470215b
style: ignore type error
topsworld Jan 15, 2025
45b4a2b
style: rename spec_filter func name
topsworld Jan 15, 2025
51d76a3
feat: move bool_trans from storage to spec
topsworld Jan 15, 2025
9c84425
feat: move sepc_filter from storage to spec, use the YAML format file
topsworld Jan 15, 2025
da4cdc4
feat: same prop supports multiple sub
topsworld Jan 16, 2025
69f1d38
feat: same event supports multiple sub
topsworld Jan 16, 2025
8a1b38e
fix: fix device remove error
topsworld Jan 16, 2025
e07b90d
feat: add func slugify_did
topsworld Jan 16, 2025
6b49d07
fix: fix multi lang error
topsworld Jan 16, 2025
93905a1
feat: update action debug logic
topsworld Jan 16, 2025
37a446f
feat: ignore normal disconnect log
topsworld Jan 16, 2025
1476646
feat: support binary mode
topsworld Jan 16, 2025
64d5ff4
feat: change miot spec name type define
topsworld Jan 16, 2025
bc62891
style: ignore i18n tranlate type error
topsworld Jan 16, 2025
3749243
fix: fix pylint warning
topsworld Jan 16, 2025
cebd483
fix: miot storage type error
topsworld Jan 17, 2025
d5e243c
feat: support binary display mode configure
topsworld Jan 17, 2025
e7564b0
feat: set default sensor state_class
topsworld Jan 17, 2025
22f843d
fix: fix sensor entity type error
topsworld Jan 17, 2025
b16d158
fix: fix __init__ type error
topsworld Jan 17, 2025
a79fe14
merge: merge main
topsworld Jan 17, 2025
ee1a910
feat: update test case logic
topsworld Jan 17, 2025
af3c457
fix: github actions add dependencies lib
topsworld Jan 17, 2025
bfb6a96
fix: fix some type error
topsworld Jan 17, 2025
8cc9178
feat: update device list changed notify logic
topsworld Jan 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: set default sensor state_class
topsworld committed Jan 17, 2025
commit e7564b01522d224e8da724b421574eb20ff04a20
2 changes: 1 addition & 1 deletion custom_components/xiaomi_home/config_flow.py
Original file line number Diff line number Diff line change
@@ -159,7 +159,7 @@ def __init__(self) -> None:
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
5 changes: 4 additions & 1 deletion custom_components/xiaomi_home/sensor.py
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@
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 @@ def __init__(self, miot_device: MIoTDevice, spec: MIoTSpecProperty) -> None:
# 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:
Loading
Oops, something went wrong.