Skip to content

Commit

Permalink
Merge branch 'al-one:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Menelao147 authored Oct 17, 2023
2 parents 4fb27d7 + bfcf402 commit 78eff41
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
29 changes: 29 additions & 0 deletions custom_components/xiaomi_miot/core/device_customizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@
'select_properties': 'mode',
},

'babai.curtain.190812': {
'chunk_properties': 1,
},
'babai.curtain.at5810': {
'chunk_properties': 1,
},
'babai.curtain.bb82mj': {
'chunk_properties': 1,
},
'babai.curtain.m515e': {
'chunk_properties': 1,
},
'babai.curtain.mtx850': {
'chunk_properties': 1,
},
'babai.curtain.yilc3': {
'chunk_properties': 1,
},
'bkrobo.chair.*': {
'sensor_properties': 'sit_state,power_state,recharge',
'switch_properties': 'on,setcheck',
Expand Down Expand Up @@ -876,6 +894,13 @@
'number_properties': 'target_temperature,dry_time',
},

'philips.light.aibed': {
'sensor_properties': 'sleep_state,wakeup_state',
'switch_properties': 'night_en,wristband_switch,awake_enable_first,awake_enable_second,awake_enable_third',
'select_properties': 'mode_main,mode_light,mode_sleep,mode_scene',
'number_properties': 'sleep_duration,music_preview,sleep_volume,sleep_startbri,scene_volume',
'button_actions': 'brightness_up,brightness_down,cct_up,cct_down,stop_preview',
},
'philips.light.strip3': {
'switch_properties': 'mitv_rhythm,acousto_optic_rhythm',
'select_properties': 'rhythm_sensitivity,rhythm_animation',
Expand Down Expand Up @@ -1309,6 +1334,10 @@
'brightness_for_on': 0,
'brightness_for_off': 2,
},
'zhimi.humidifier.cb1:water_level': {
'state_class': 'measurement',
'unit_of_measurement': '%',
},
'zhimi.humidifier.*': {
'sensor_properties': 'water_level,actual_speed',
'switch_properties': 'alarm,other.clean,humidifier.dry',
Expand Down
15 changes: 7 additions & 8 deletions custom_components/xiaomi_miot/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,8 @@ async def async_added_to_hass(self):

self._motor_reverse = self.custom_config_bool('motor_reverse', False)
self._position_reverse = self.custom_config_bool('position_reverse', self._motor_reverse)
self._open_texts = [
*(self.custom_config_list('open_texts') or []),
'Opening', 'Opened', 'Open', 'Up', 'Rising', 'Risen', 'Rise',
]
self._close_texts = [
*(self.custom_config_list('close_texts') or []),
'Closing', 'Closed', 'Close', 'Down', 'Falling', 'Descent',
]
self._open_texts = self.custom_config_list('open_texts', ['Opening', 'Opened', 'Open', 'Up', 'Rising', 'Risen', 'Rise'])
self._close_texts = self.custom_config_list('close_texts', ['Closing', 'Closed', 'Close', 'Down', 'Falling', 'Descent'])
if self._motor_reverse:
self._open_texts, self._close_texts = self._close_texts, self._open_texts

Expand Down Expand Up @@ -170,6 +164,11 @@ def current_cover_position(self):
elif range_max != 100:
pos = cur / range_max * 100
if pos < 0:
# If the motor controller is stopped, generate fake middle position
if self._prop_status:
sta = int(self._prop_status.from_dict(self._state_attrs) or -1)
if sta in self._prop_status.list_search('Stopped'):
return 50
return None
dev = int(self.custom_config_integer('deviated_position', 1) or 0)
if pos <= dev:
Expand Down

0 comments on commit 78eff41

Please sign in to comment.