Skip to content

Commit

Permalink
Bump aiohue to 2.3.0 (home-assistant#50217)
Browse files Browse the repository at this point in the history
Co-authored-by: Franck Nijhof <[email protected]>
  • Loading branch information
balloob and frenck authored May 7, 2021
1 parent 5d5122c commit 17fc962
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 11 deletions.
12 changes: 8 additions & 4 deletions homeassistant/components/hue/binary_sensor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Hue binary sensor entities."""

from aiohue.sensors import TYPE_ZLL_PRESENCE

from homeassistant.components.binary_sensor import (
Expand All @@ -15,9 +14,14 @@

async def async_setup_entry(hass, config_entry, async_add_entities):
"""Defer binary sensor setup to the shared sensor module."""
await hass.data[HUE_DOMAIN][
config_entry.entry_id
].sensor_manager.async_register_component("binary_sensor", async_add_entities)
bridge = hass.data[HUE_DOMAIN][config_entry.entry_id]

if not bridge.sensor_manager:
return

await bridge.sensor_manager.async_register_component(
"binary_sensor", async_add_entities
)


class HuePresence(GenericZLLSensor, BinarySensorEntity):
Expand Down
7 changes: 6 additions & 1 deletion homeassistant/components/hue/bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ async def async_setup(self, tries=0):
return False

self.api = bridge
self.sensor_manager = SensorManager(self)
if bridge.sensors is not None:
self.sensor_manager = SensorManager(self)

hass.config_entries.async_setup_platforms(self.config_entry, PLATFORMS)

Expand Down Expand Up @@ -178,6 +179,10 @@ async def async_reset(self):

async def hue_activate_scene(self, data, skip_reload=False, hide_warnings=False):
"""Service to call directly into bridge to set scenes."""
if self.api.scenes is None:
_LOGGER.warning("Hub %s does not support scenes", self.api.host)
return

group_name = data[ATTR_GROUP_NAME]
scene_name = data[ATTR_SCENE_NAME]
transition = data.get(ATTR_TRANSITION)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/hue/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Philips Hue",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/hue",
"requirements": ["aiohue==2.1.0"],
"requirements": ["aiohue==2.3.0"],
"ssdp": [
{
"manufacturer": "Royal Philips Electronics",
Expand Down
9 changes: 6 additions & 3 deletions homeassistant/components/hue/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@

async def async_setup_entry(hass, config_entry, async_add_entities):
"""Defer sensor setup to the shared sensor module."""
await hass.data[HUE_DOMAIN][
config_entry.entry_id
].sensor_manager.async_register_component("sensor", async_add_entities)
bridge = hass.data[HUE_DOMAIN][config_entry.entry_id]

if not bridge.sensor_manager:
return

await bridge.sensor_manager.async_register_component("sensor", async_add_entities)


class GenericHueGaugeSensorEntity(GenericZLLSensor, SensorEntity):
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ aiohomekit==0.2.61
aiohttp_cors==0.7.0

# homeassistant.components.hue
aiohue==2.1.0
aiohue==2.3.0

# homeassistant.components.imap
aioimaplib==0.7.15
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ aiohomekit==0.2.61
aiohttp_cors==0.7.0

# homeassistant.components.hue
aiohue==2.1.0
aiohue==2.3.0

# homeassistant.components.apache_kafka
aiokafka==0.6.0
Expand Down

0 comments on commit 17fc962

Please sign in to comment.