Compare commits

...

2 Commits

Author SHA1 Message Date
Alone
6fc73892f2
Merge f852934f29 into 6557b22a52 2025-01-10 09:26:33 +08:00
Alone
f852934f29 fix: use binary sensor to implement read-only bool property 2024-12-20 11:36:33 +08:00

View File

@ -573,6 +573,9 @@ class MIoTDevice:
# Irregular property will not be transformed. # Irregular property will not be transformed.
pass pass
elif prop.readable or prop.notifiable: elif prop.readable or prop.notifiable:
if prop.format_ == 'bool':
prop.platform = 'binary_sensor'
else:
prop.platform = 'sensor' prop.platform = 'sensor'
if prop.platform: if prop.platform:
self.append_prop(prop=prop) self.append_prop(prop=prop)