Skip to content

[BUG] KeyError: 'value' on toggle_power using API 4.0.0 FW on POL 75C #19

@theyapps

Description

@theyapps

Describe the bug
When calling toggle_power on API 4.0.0 Firmware on PN POL 75C I get the following error.

Traceback (most recent call last):
  File "/home/rcboykin/git/nanoleafapi/nanoleaf-cli.py", line 60, in <module>
    nl.toggle_power()
    ~~~~~~~~~~~~~~~^^
  File "/home/rcboykin/git/nanoleafapi/nanoleafapi/nanoleaf.py", line 224, in toggle_power
    if self.get_power():
       ~~~~~~~~~~~~~~^^
  File "/home/rcboykin/git/nanoleafapi/nanoleafapi/nanoleaf.py", line 220, in get_power
    return ans['value']
           ~~~^^^^^^^^^
KeyError: 'value'

To Reproduce
Steps to reproduce the behavior:

  1. Call toggle_power()
  2. See error

Expected behavior
Power should toggle

Screenshots
N/A

Development environment (please complete the following information):

  • OS: Fedora 42
  • Python version: Python 3.13.7
  • Nanoleaf device POL 75C Permanent Outdoor Lights

Additional context
The value of answer is {'on': {'value': True}} it seems the code expects {'value': True}.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions