python-broadlink: check_nightlight with python3 not working

Using broadlink-0.8 in python2.7 all is working, but I need the lib in python3.5 and there I get following error when calling set_power():

2018-04-01 20:34:57 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall broadlink_switch.set_on>
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 1010, in _event_to_service_call
    await self._hass.async_add_job(execute_service)
  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 "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 1007, in execute_service
    service_handler.func(service_call)
  File "/home/homeassistant/.homeassistant/custom_components/broadlink_switch.py", line 30, in set_on_service
    switch_all(True)
  File "/home/homeassistant/.homeassistant/custom_components/broadlink_switch.py", line 15, in switch_all
    devices[j].set_power(toOn)
  File "/srv/homeassistant/lib/python3.5/site-packages/broadlink/__init__.py", line 394, in set_power
  File "/srv/homeassistant/lib/python3.5/site-packages/broadlink/__init__.py", line 432, in check_nightlight
TypeError: ord() expected string of length 1, but int found

This seems to be a problem with code not adapted to python3. Look for example here on stackoverflow.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (9 by maintainers)

Commits related to this issue

Most upvoted comments

I put that line into the code, but it still showing the same error. The output of the pip freeze is:

aiohttp==3.1.3
aiohttp-cors==0.7.0
argh==0.26.2
asn1crypto==0.24.0
astral==1.6
async-timeout==2.0.1
asyncio==3.4.3
attrs==17.4.0
beautifulsoup4==4.6.0
bitstring==3.1.5
boto3==1.6.1
botocore==1.9.1
broadlink==0.9
cachetools==2.0.1
certifi==2018.4.16
cffi==1.11.5
chardet==3.0.4
click==6.7
colorlog==3.1.2
cookies==2.2.1
cryptography==2.1.1
distro==1.2.0
docutils==0.14
ecdsa==0.13
enum-compat==0.0.2
envs==1.2.4
ephem==3.7.6.0
future==0.16.0
gTTS-token==1.1.1
home-assistant-frontend==20180426.0
homeassistant==0.68.1
http-ece==1.0.5
idna==2.6
idna-ssl==1.0.1
Jinja2==2.10
jmespath==0.9.3
keyring==8.7
keyrings.alt==1.3
libnacl==1.6.1
locationsharinglib==0.4.0
MarkupSafe==1.0
multidict==4.1.0
mutagen==1.40.0
netdisco==1.3.1
netifaces==0.10.6
paho-mqtt==1.3.1
pathtools==0.1.2
pkg-resources==0.0.0
protobuf==3.5.2.post1
pushbullet.py==0.11.0
py-vapid==1.3.0
PyChromecast==2.1.0
pycparser==2.18
PyCRC==1.21
pycryptodome==3.4.11
pyfttt==0.3
pyicloud==0.9.1
PyJWT==1.6.0
pylgtv==0.1.7
python-dateutil==2.6.1
python-forecastio==1.4.0
python-jose-cryptodome==1.3.2
python-magic==0.4.15
python-mpd2==1.0.0
python-synology==0.1.0
pytz==2018.3
pywebpush==1.6.0
PyXiaomiGateway==0.9.0
PyYAML==3.12
requests==2.18.4
responses==0.9.0
RestrictedPython==4.0b2
s3transfer==0.1.13
six==1.11.0
speedtest-cli==2.0.0
spotipy==2.4.4
SQLAlchemy==1.2.6
typing==3.6.4
tzlocal==1.5.1
ua-parser==0.7.3
urllib3==1.22
user-agents==1.1.0
voluptuous==0.11.1
voluptuous-serialize==1.0.0
wakeonlan==1.0.0
warrant==0.6.1
watchdog==0.8.3
websocket-client==0.47.0
websockets==3.2
xmltodict==0.11.0
yahooweather==0.10
yarl==1.1.1
zeroconf==0.20.0