Compare commits

..

No commits in common. "1258d3f3d31bef62aa26bf27013dedb67718ea7e" and "64d9d5417058f865e74ba5cb82a4495310d5dc16" have entirely different histories.

4 changed files with 9 additions and 17 deletions

View File

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

View File

@ -1374,13 +1374,10 @@ class MIoTClient:
"""Update cloud devices.
NOTICE: This function will operate the cloud_list
"""
# MIoT cloud may not publish the online state updating message
# MIoT cloud service may not publish the online state updating message
# 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():
if did.startswith('blt.') or did.startswith('proxy.'):
if did.startswith('blt.'):
info['online'] = True
for did, info in self._device_list_cache.items():
if filter_dids and did not in filter_dids:

View File

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

View File

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