Skip to content

Commit

Permalink
💦 deprecate fan entity for humidifier (#2032)
Browse files Browse the repository at this point in the history
  • Loading branch information
al-one committed Dec 12, 2024
1 parent c2c67e1 commit 60fc0a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
6 changes: 6 additions & 0 deletions custom_components/xiaomi_miot/core/device_customizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2041,6 +2041,9 @@
'switch_properties': 'motor_reverse',
'select_properties': 'mode',
},
'*.derh.*': {
'select_properties': 'fan_level',
},
'*.desk.*': {
'button_properties': 'motor_control,reset',
'switch_properties': 'on',
Expand Down Expand Up @@ -2096,6 +2099,9 @@
'switch_properties': 'heater.on,horizontal_swing,alarm.alarm,delay.delay',
'number_properties': 'countdown_time,delay_time',
},
'*.humidifier.*': {
'select_properties': 'fan_level',
},
'*.ihcooker.*': {
'sensor_properties': 'left_time,working_time',
'switch_properties': 'induction_cooker.on',
Expand Down
13 changes: 1 addition & 12 deletions custom_components/xiaomi_miot/humidifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,12 @@ async def async_update(self):
num = round(num * fac)
self._attr_target_humidity = num

add_fans = self._add_entities.get('fan')
for p in self._mode_props:
pnm = p.full_name
if self._prop_mode and pnm == self._prop_mode.full_name:
continue
if pnm in self._subs:
self._subs[pnm].update_from_parent()
elif add_fans:
self._subs[pnm] = MiotModesSubEntity(self, p)
add_fans([self._subs[pnm]], update_before_add=True)

@property
def device_class(self):
if cls := self.get_device_class(HumidifierDeviceClass):
return cls
typ = f'{self.model} {self._miot_service.spec.type}'
if HumidifierDeviceClass.DEHUMIDIFIER.value in typ or '.derh.' in typ:
if 'dehumidifier' in typ or '.derh.' in typ:
return HumidifierDeviceClass.DEHUMIDIFIER
return HumidifierDeviceClass.HUMIDIFIER

Expand Down

0 comments on commit 60fc0a2

Please sign in to comment.