mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2026-01-18 16:10:44 +08:00
style: fix pylint format
This commit is contained in:
parent
679af9dd62
commit
fc0dedb399
@ -515,20 +515,17 @@ class MIoTDevice:
|
|||||||
prop.icon = self.icon_convert(prop.unit)
|
prop.icon = self.icon_convert(prop.unit)
|
||||||
device_class = SPEC_PROP_TRANS_MAP['properties'][prop_name][
|
device_class = SPEC_PROP_TRANS_MAP['properties'][prop_name][
|
||||||
'device_class']
|
'device_class']
|
||||||
|
|
||||||
result = {'platform': platform, 'device_class': device_class}
|
result = {'platform': platform, 'device_class': device_class}
|
||||||
|
|
||||||
# optional:
|
# optional:
|
||||||
prop_optional = SPEC_PROP_TRANS_MAP['properties'][prop_name].get('optional')
|
optional = SPEC_PROP_TRANS_MAP['properties'][prop_name].get('optional')
|
||||||
if prop_optional:
|
if optional:
|
||||||
prop_optional_state_class = prop_optional.get('state_class')
|
prop_optional_state_class = optional.get('state_class')
|
||||||
if prop_optional_state_class:
|
if prop_optional_state_class:
|
||||||
result['state_class'] = prop_optional_state_class
|
result['state_class'] = prop_optional_state_class
|
||||||
|
|
||||||
prop_optional_unit = prop_optional.get('unit_of_measurement')
|
prop_optional_unit = optional.get('unit_of_measurement')
|
||||||
if prop_optional_unit and not prop.unit:
|
if prop_optional_unit and not prop.unit:
|
||||||
result['unit_of_measurement'] = prop_optional_unit
|
result['unit_of_measurement'] = prop_optional_unit
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def spec_transform(self) -> None:
|
def spec_transform(self) -> None:
|
||||||
@ -559,9 +556,10 @@ class MIoTDevice:
|
|||||||
if 'state_class' in prop_entity:
|
if 'state_class' in prop_entity:
|
||||||
prop.state_class = prop_entity['state_class']
|
prop.state_class = prop_entity['state_class']
|
||||||
if 'unit_of_measurement' in prop_entity:
|
if 'unit_of_measurement' in prop_entity:
|
||||||
prop.external_unit = self.unit_convert(prop_entity['unit_of_measurement'])
|
prop.external_unit = self.unit_convert(
|
||||||
prop.icon = self.icon_convert(prop_entity['unit_of_measurement'])
|
prop_entity['unit_of_measurement'])
|
||||||
|
prop.icon = self.icon_convert(
|
||||||
|
prop_entity['unit_of_measurement'])
|
||||||
# general conversion
|
# general conversion
|
||||||
if not prop.platform:
|
if not prop.platform:
|
||||||
if prop.writable:
|
if prop.writable:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user