Compare commits

...

2 Commits

Author SHA1 Message Date
Li Shuzhen
75390a3d83
docs: update changelog and version to v0.4.6 (#1565)
Some checks failed
Tests / check-rule-format (push) Has been cancelled
Validate / validate-hassfest (push) Has been cancelled
Validate / validate-hacs (push) Has been cancelled
Validate / validate-lint (push) Has been cancelled
Validate / validate-setup (push) Has been cancelled
2025-12-18 09:37:27 +08:00
Li Shuzhen
86a739b503
feat: add tv-box device as media player entity (#1562) 2025-12-18 09:04:59 +08:00
4 changed files with 93 additions and 18 deletions

View File

@ -1,4 +1,19 @@
# CHANGELOG
## v0.4.6
### Added
- Add tv-box device as the media player entity. [#1562](https://github.com/XiaoMi/ha_xiaomi_home/pull/1562)
- Set play-control service's play-loop-mode property as the sound mode. [#1562](https://github.com/XiaoMi/ha_xiaomi_home/pull/1562)
### Changed
- Use constant value to indicate the cloud MQTT broker host domain. [#1530](https://github.com/XiaoMi/ha_xiaomi_home/pull/1530)
- Use constant value to indicate the timer delay of refreshing devices. [#1555](https://github.com/XiaoMi/ha_xiaomi_home/pull/1555)
- Set the playing-state property as the required property in the play-control service of the speaker device. [#1552](https://github.com/XiaoMi/ha_xiaomi_home/pull/1552)
- Set the playing-state property as the required property in the optional play-control service of the television. [#1562](https://github.com/XiaoMi/ha_xiaomi_home/pull/1562)
### Fixed
- Catch paho-mqtt subscribe error properly. [#1551](https://github.com/XiaoMi/ha_xiaomi_home/pull/1551)
- After the network resumes, keep retrying to fetch the device list until it succeeds. [#1555](https://github.com/XiaoMi/ha_xiaomi_home/pull/1555)
- Catch the http post error properly. [#1555](https://github.com/XiaoMi/ha_xiaomi_home/pull/1555)
- Fixed the format and the access field of daikin.aircondition.k2 and fix: daikin.airfresh.k33 string value properties. [#1561](https://github.com/XiaoMi/ha_xiaomi_home/pull/1561)
## v0.4.5
### Changed
- Ignore mdns REMOVED package. [#1296](https://github.com/XiaoMi/ha_xiaomi_home/pull/1296)

View File

@ -25,7 +25,7 @@
"cryptography",
"psutil"
],
"version": "v0.4.5",
"version": "v0.4.6",
"zeroconf": [
"_miot-central._tcp.local."
]

View File

@ -436,7 +436,8 @@ class MIoTDevice:
optional_properties: dict
required_actions: set
optional_actions: set
# 2. The service shall have all required properties, actions.
# 2. The required service shall have all required properties
# and actions.
if service.name in required_services:
required_properties = SPEC_DEVICE_TRANS_MAP[spec_name][
'required'].get(
@ -454,6 +455,23 @@ class MIoTDevice:
'required'].get(
service.name, {}
).get('optional', {}).get('actions', set({}))
if not {
prop.name for prop in service.properties if prop.access
}.issuperset(set(required_properties.keys())):
return None
if not {
action.name for action in service.actions
}.issuperset(required_actions):
return None
# 3. The required property in required service shall have all
# required access mode.
for prop in service.properties:
if prop.name in required_properties:
if not set(prop.access).issuperset(
required_properties[prop.name]):
return None
# 4. The optional service shall have all required properties
# and actions.
elif service.name in optional_services:
required_properties = SPEC_DEVICE_TRANS_MAP[spec_name][
'optional'].get(
@ -471,22 +489,23 @@ class MIoTDevice:
'optional'].get(
service.name, {}
).get('optional', {}).get('actions', set({}))
if not {
prop.name for prop in service.properties if prop.access
}.issuperset(set(required_properties.keys())):
continue
if not {
action.name for action in service.actions
}.issuperset(required_actions):
continue
# 5. The required property in optional service shall have all
# required access mode.
for prop in service.properties:
if prop.name in required_properties:
if not set(prop.access).issuperset(
required_properties[prop.name]):
continue
else:
continue
if not {
prop.name for prop in service.properties if prop.access
}.issuperset(set(required_properties.keys())):
return None
if not {
action.name for action in service.actions
}.issuperset(required_actions):
return None
# 3. The required property shall have all required access mode.
for prop in service.properties:
if prop.name in required_properties:
if not set(prop.access).issuperset(
required_properties[prop.name]):
return None
# property
for prop in service.properties:
if prop.name in set.union(

View File

@ -331,6 +331,7 @@ SPEC_DEVICE_TRANS_MAP: dict = {
'actions': {'play'}
},
'optional': {
'properties': {'play-loop-mode'},
'actions': {'pause', 'stop', 'next', 'previous'}
}
}
@ -362,9 +363,49 @@ SPEC_DEVICE_TRANS_MAP: dict = {
},
'optional': {
'play-control': {
'required': {},
'required': {
'properties': {
'playing-state': {'read'}
}
},
'optional': {
'properties': {'playing-state'},
'properties': {'play-loop-mode'},
'actions': {'play', 'pause', 'stop', 'next', 'previous'}
}
}
},
'entity': 'television'
},
'tv-box':{
'required': {
'speaker': {
'required': {
'properties': {
'volume': {'read', 'write'}
}
},
'optional': {
'properties': {'mute'}
}
},
'tv-box': {
'required': {
'actions': {'turn-off'}
},
'optional': {
'actions': {'turn-on'}
}
}
},
'optional': {
'play-control': {
'required': {
'properties': {
'playing-state': {'read'}
}
},
'optional': {
'properties': {'play-loop-mode'},
'actions': {'play', 'pause', 'stop', 'next', 'previous'}
}
}