3 Commits
v0.4.2 ... main

Author SHA1 Message Date
ec833b6539 feat: subscribe the proxy gateway child device up messages even though the device is offline (#1393)
Some checks failed
Tests / check-rule-format (push) Failing after 2s
Validate / validate-hassfest (push) Failing after 3s
Validate / validate-hacs (push) Failing after 10s
Validate / validate-lint (push) Failing after 2s
Validate / validate-setup (push) Failing after 5s
* feat: subscribe the proxy gateway child device up messages even though the device is offline (#1313)

* feat: do not subscribe proxy gateway child device online/offline state message
2025-09-02 17:22:40 +08:00
f2200ba003 fix: contact-state value format (#1387)
Some checks failed
Tests / check-rule-format (push) Failing after 4s
Validate / validate-hassfest (push) Failing after 3s
Validate / validate-hacs (push) Failing after 9s
Validate / validate-lint (push) Failing after 2s
Validate / validate-setup (push) Failing after 3s
2025-08-29 17:36:25 +08:00
073cdf2dcb fix: integer value step (#1388) 2025-08-29 17:35:46 +08:00
4 changed files with 17 additions and 9 deletions

View File

@ -70,8 +70,8 @@ async def async_setup_entry(
for miot_device in device_list: for miot_device in device_list:
if miot_device.miot_client.display_binary_bool: if miot_device.miot_client.display_binary_bool:
for prop in miot_device.prop_list.get('binary_sensor', []): for prop in miot_device.prop_list.get('binary_sensor', []):
new_entities.append(BinarySensor( new_entities.append(
miot_device=miot_device, spec=prop)) BinarySensor(miot_device=miot_device, spec=prop))
if new_entities: if new_entities:
async_add_entities(new_entities) async_add_entities(new_entities)
@ -90,7 +90,7 @@ class BinarySensor(MIoTPropertyEntity, BinarySensorEntity):
def is_on(self) -> bool: def is_on(self) -> bool:
"""On/Off state. True if the binary sensor is on, False otherwise.""" """On/Off state. True if the binary sensor is on, False otherwise."""
if self.spec.name == 'contact-state': if self.spec.name == 'contact-state':
return self._value is False return bool(self._value) is False
elif self.spec.name == 'occupancy-status': elif self.spec.name == 'occupancy-status':
return bool(self._value) return bool(self._value)
return self._value is True return self._value is True

View File

@ -1374,10 +1374,13 @@ class MIoTClient:
"""Update cloud devices. """Update cloud devices.
NOTICE: This function will operate the cloud_list NOTICE: This function will operate the cloud_list
""" """
# MIoT cloud service may not publish the online state updating message # MIoT cloud may not publish the online state updating message
# for the BLE device. Assume that all BLE devices are online. # for the BLE device. Assume that all BLE devices are online.
# MIoT cloud does not publish the online state updating message for the
# child device under the proxy gateway (eg, VRF air conditioner
# controller). Assume that all proxy gateway child devices are online.
for did, info in cloud_list.items(): for did, info in cloud_list.items():
if did.startswith('blt.'): if did.startswith('blt.') or did.startswith('proxy.'):
info['online'] = True info['online'] = True
for did, info in self._device_list_cache.items(): for did, info in self._device_list_cache.items():
if filter_dids and did not in filter_dids: if filter_dids and did not in filter_dids:

View File

@ -998,9 +998,11 @@ class MipsCloudClient(_MipsClient):
did, MIoTDeviceState.ONLINE if msg['event'] == 'online' did, MIoTDeviceState.ONLINE if msg['event'] == 'online'
else MIoTDeviceState.OFFLINE, ctx) else MIoTDeviceState.OFFLINE, ctx)
if did.startswith('blt.'): if did.startswith('blt.') or did.startswith('proxy.'):
# MIoT cloud may not publish BLE device online/offline state message. # MIoT cloud may not publish BLE device or proxy gateway child device
# Do not subscribe BLE device online/offline state. # online/offline state message.
# Do not subscribe BLE device or proxy gateway child device
# online/offline state.
return True return True
return self.__reg_broadcast_external( return self.__reg_broadcast_external(
topic=topic, handler=on_state_msg, handler_ctx=handler_ctx) topic=topic, handler=on_state_msg, handler_ctx=handler_ctx)

View File

@ -601,7 +601,10 @@ class MIoTSpecProperty(_MIoTSpecBase):
if value is None: if value is None:
return None return None
if self.format_ == int: if self.format_ == int:
if self.value_range is None:
return int(round(value)) return int(round(value))
return int(
round(value / self.value_range.step) * self.value_range.step)
if self.format_ == float: if self.format_ == float:
return round(value, self.precision) return round(value, self.precision)
if self.format_ == bool: if self.format_ == bool: