Skip to content

Commit

Permalink
Merge pull request #14 from jfarmer08/Dev
Browse files Browse the repository at this point in the history
issues when you only have wifi bulbs
  • Loading branch information
jfarmer08 authored Aug 19, 2020
2 parents 6a2cbc2 + 9e1d3de commit f625cf0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions custom_components/sengledapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ async def async_setup(hass, config):
_LOGGER.debug("SengledApi Connected to Sengled account")

sengledapi_devices = await sengledapi_account.async_get_devices()
sengledapiwifi_devices = await sengledapi_account.get_devices()

# Store the logged in account object for the platforms to use.
_LOGGER.debug(
Expand All @@ -73,6 +74,8 @@ async def async_setup(hass, config):
# Start up lights and switch components
if sengledapi_devices:
await discovery.async_load_platform(hass, "light", DOMAIN, {}, config)
elif sengledapiwifi_devices:
await discovery.async_load_platform(hass, "light", DOMAIN, {}, config)
else:
_LOGGER.error(
"SengledApi: SengledApi authenticated but could not find any devices."
Expand Down
4 changes: 2 additions & 2 deletions custom_components/sengledapi/sengledapi/sengled_bulb.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ def __init__(
self._device_model = device_model
self._brightness = int(brightness)
self._color_temperature = self.translate(
int(color_temperature), 0, 100, 1000, 10000
int(color_temperature), 0, 100, 0, 10000
)
self._jsession_id = jsession_id
self._country = country
Expand Down Expand Up @@ -599,7 +599,7 @@ async def async_update(self):
self._state = items.switch
self._avaliable = items.online
self._color_temperature = self.translate(
int(items.color_temperature), 0, 100, 1000, 10000
int(items.color_temperature), 0, 100, 0, 10000
)
_LOGGER.debug(items.brightness)
_LOGGER.debug(items.color_temperature)
Expand Down
4 changes: 2 additions & 2 deletions custom_components/sengledapi/sengledapi/sengled_wifi_bulb.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ def color_temperature(self):
if attr["name"] == "colorTemperature":
_LOGGER.debug(
"what the fuck this should work color temperature"
+ str(self.translate(int(attr["value"]), 0, 100, 1000, 10000))
+ str(self.translate(int(attr["value"]), 0, 100, 0, 10000))
)
return self.translate(int(attr["value"]), 0, 100, 1000, 10000)
return self.translate(int(attr["value"]), 0, 100, 0, 10000)
return 0

@property
Expand Down

0 comments on commit f625cf0

Please sign in to comment.