diff --git a/custom_components/sengledapi/__init__.py b/custom_components/sengledapi/__init__.py index e233e7f..7758e39 100644 --- a/custom_components/sengledapi/__init__.py +++ b/custom_components/sengledapi/__init__.py @@ -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( @@ -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." diff --git a/custom_components/sengledapi/sengledapi/sengled_bulb.py b/custom_components/sengledapi/sengledapi/sengled_bulb.py index 64b50b7..ae87790 100644 --- a/custom_components/sengledapi/sengledapi/sengled_bulb.py +++ b/custom_components/sengledapi/sengledapi/sengled_bulb.py @@ -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 @@ -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) diff --git a/custom_components/sengledapi/sengledapi/sengled_wifi_bulb.py b/custom_components/sengledapi/sengledapi/sengled_wifi_bulb.py index dfb786a..436cd50 100644 --- a/custom_components/sengledapi/sengledapi/sengled_wifi_bulb.py +++ b/custom_components/sengledapi/sengledapi/sengled_wifi_bulb.py @@ -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