Skip to content

Fixed a bug within the SP2 class.#178

Merged
Danielhiversen merged 3 commits into
mjg59:masterfrom
lordneon:master
Apr 15, 2018
Merged

Fixed a bug within the SP2 class.#178
Danielhiversen merged 3 commits into
mjg59:masterfrom
lordneon:master

Conversation

@lordneon
Copy link
Copy Markdown

check_power and check_nightlight did not check to see if the payload was already an int before calling ord.

This fixes the following error:

2018-04-15 09:40:00 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.Lamp fails
Traceback (most recent call last):
  File "/opt/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 204, in async_update_ha_state
    yield from self.async_device_update()
  File "/opt/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 327, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/opt/homeassistant/lib/python3.5/site-packages/homeassistant/components/switch/broadlink.py", line 293, in update
    self._update()
  File "/opt/homeassistant/lib/python3.5/site-packages/homeassistant/components/switch/broadlink.py", line 298, in _update
    state = self._device.check_power()
  File "/opt/homeassistant/lib/python3.5/site-packages/broadlink/__init__.py", line 418, in check_power
    if ord(payload[0x4]) == 1 or ord(payload[0x4]) == 3:
TypeError: ord() expected string of length 1, but int found

jonhen added 3 commits April 15, 2018 10:19
check_power and check_nightlight did not check to see if the payload was already an int before calling ord.
check_power and check_nightlight did not check to see if the payload was already an int before calling ord.
@Danielhiversen
Copy link
Copy Markdown
Collaborator

@mjg59 Could you make a new release of the library?

@mjg59
Copy link
Copy Markdown
Owner

mjg59 commented Apr 24, 2018

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants