Skip to content

Commit

Permalink
Merge pull request #35 from iMicknl/minor_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
iMicknl authored Jun 7, 2020
2 parents 5be75d0 + fef2a54 commit c977a81
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
16 changes: 10 additions & 6 deletions custom_components/tahoma/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,20 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
_LOGGER.exception("Error when getting devices from the Tahoma API")
return False

hass.data[DOMAIN][entry.entry_id] = {"controller": controller, "devices": [], "scenes": []}
hass.data[DOMAIN][entry.entry_id] = {
"controller": controller,
"devices": [],
"scenes": [],
}

# List devices
for device in devices:
_device = controller.get_device(device)

if _device.uiclass in TAHOMA_TYPES:
if TAHOMA_TYPES[_device.uiclass] in PLATFORMS:
component = TAHOMA_TYPES[_device.uiclass]

hass.data[DOMAIN][entry.entry_id]["devices"].append(_device)

hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
)
else:
_LOGGER.warning(
"Unsupported Tahoma device (%s - %s - %s)",
Expand All @@ -94,6 +93,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
_device.widget,
)

for component in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
)

for scene in scenes:
hass.data[DOMAIN][entry.entry_id]["scenes"].append(scene)

Expand Down
6 changes: 2 additions & 4 deletions custom_components/tahoma/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,10 @@ def update(self):

if CORE_SMOKE_STATE in self.tahoma_device.active_states:
self.current_value = (
self.tahoma_device.active_states.get(CORE_SMOKE_STATE) != "notDetected"
self.tahoma_device.active_states.get(CORE_SMOKE_STATE) == "detected"
)

if self.current_value:
self._state = STATE_ON
else:
self._sate = STATE_OFF

_LOGGER.debug("Update %s, state: %s", self._name, self._state)
self._state = STATE_OFF
3 changes: 2 additions & 1 deletion custom_components/tahoma/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def __init__(self, tahoma_device, controller):
self._skip_update = False
self._effect = None
self._brightness = None

self._state = None

self.update()

@property
Expand Down

0 comments on commit c977a81

Please sign in to comment.