Skip to content

Commit

Permalink
Add todos, remove breakpoint call for binary_sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
rytilahti committed Nov 15, 2022
1 parent 7184cea commit 19fd24e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions homeassistant/components/xiaomi_miio/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ async def async_setup_entry(
coordinator = hass.data[DOMAIN][config_entry.entry_id][KEY_COORDINATOR]
for sensor in device.sensors().values():
if sensor.type == bool:
breakpoint()
if getattr(coordinator.data, sensor.property) is None:
# TODO: we might need to rethink this, as some properties (e.g., mop settings)
# are none depending on the device mode
# are none depending on the device mode at least for miio devices
# maybe these should just default to be disabled?
_LOGGER.debug("Skipping %s as it's value was None", sensor.property)
continue

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/xiaomi_miio/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import logging

from miio.descriptors import SettingType

from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand All @@ -28,8 +30,6 @@ async def async_setup_entry(

# Handle switches defined by the backing class.
for setting in device.settings().values():
from miio.descriptors import SettingType

if setting.type == SettingType.Number:
_LOGGER.debug("Adding new number setting: %s", setting)
entities.append(XiaomiNumber(device, setting, config_entry, coordinator))
Expand Down
3 changes: 3 additions & 0 deletions homeassistant/components/xiaomi_miio/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ async def async_setup_entry(
for sensor in device.sensors().values():
if sensor.type != bool:
if getattr(coordinator.data, sensor.property) is None:
# TODO: we might need to rethink this, as some properties (e.g., mop settings)
# are none depending on the device mode at least for miio devices
# maybe these should just default to be disabled?
_LOGGER.debug("Skipping %s as it's value was None", sensor.property)
continue

Expand Down

0 comments on commit 19fd24e

Please sign in to comment.