fix: use binary sensor to implement read-only bool property

This commit is contained in:
Alone 2024-12-20 11:36:33 +08:00
parent 571483b302
commit f852934f29

View File

@ -560,7 +560,10 @@ class MIoTDevice:
# Irregular property will not be transformed.
pass
elif prop.readable or prop.notifiable:
prop.platform = 'sensor'
if prop.format_ == 'bool':
prop.platform = 'binary_sensor'
else:
prop.platform = 'sensor'
if prop.platform:
self.append_prop(prop=prop)
# STEP 3.2: event conversion