Skip to content
This repository has been archived by the owner on Mar 8, 2022. It is now read-only.

Division by zero error #26

Closed
michaeldavie opened this issue Jun 3, 2020 · 2 comments
Closed

Division by zero error #26

michaeldavie opened this issue Jun 3, 2020 · 2 comments
Assignees
Labels

Comments

@michaeldavie
Copy link

michaeldavie commented Jun 3, 2020

Error:

Traceback (most recent call last):
  File "/config/custom_components/wiz_light/light.py", line 251, in update_temperature
    self._light.state.get_colortemp()
  File "/usr/src/homeassistant/homeassistant/util/color.py", line 515, in color_temperature_kelvin_to_mired
    return math.floor(1000000 / kelvin_temperature)
ZeroDivisionError: division by zero

getSystemConfig:

{
    "method": "getSystemConfig",
    "env": "pro",
    "result": {
        "mac": "a8bb50a6891e",
        "homeId": 361378,
        "roomId": 537437,
        "homeLock": false,
        "pairingLock": false,
        "typeId": 0,
        "moduleName": "ESP01_SHRGB1C_31",
        "fwVersion": "1.18.2",
        "groupId": 0,
        "drvConf": [
            33,
            1
        ]
    }
}

getPilot:

{
    "method": "getPilot",
    "env": "pro",
    "result": {
        "mac": "a8bb50a761d3",
        "rssi": -89,
        "src": "",
        "state": true,
        "sceneId": 11,
        "speed": 100,
        "temp": 0,
        "dimming": 100
    }
}

Home Assistant entity attributes:

min_mireds: 153
max_mireds: 400
effect_list: Ocean, Romance, Sunset, Party, Fireplace, Cozy, Forest, Pastel Colors, Wake up, Bedtime, Warm White, Daylight, Cool white, Night light, Focus, Relax, True colors, TV time, Plantgrowth, Spring, Summer, Fall, Deepdive, Jungle, Mojito, Club, Christmas, Halloween, Candlelight, Golden white, Pulse, Steampunk, Rhythm
brightness: 255
effect: Warm White
friendly_name: Driveway
supported_features: 23
@michaeldavie
Copy link
Author

michaeldavie commented Jun 4, 2020

Changing the mode of the light seems to have caused it to start reporting a color temperature again, and the change was reflected in Home Assistant.

Other than this, all of the features are working with my ESP01_SHRGB1C_31 bulbs.

@sbidy sbidy self-assigned this Jun 4, 2020
@sbidy sbidy added the Bug Something isn't working label Jun 4, 2020
@sbidy
Copy link
Owner

sbidy commented Jun 4, 2020

Thanks for the issue :)
I think the problem is that the bulb returned temp: 0 in the getPilot. That will throw this exception because I try to get all returned values to show the correct status of the bulb. Regardless if the temp itself was changed. That's why the exception was logged every time you change any vaule.
I'm not sure why this issue was not popping up in my tests. Maybe there you have a newer FW version.

sbidy added a commit that referenced this issue Jun 6, 2020
@sbidy sbidy closed this as completed Oct 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants