yes, I could see pycache created inside the custom_components/sensor
Can you please share your yaml configuration for the logger component?
Debug logs
logs:
custom_components.sensor.broadlink_s1c: debug
The logs property is part of the logger component and not a component itself.
Your configuration.yaml should be:
logger:
default: warning
logs:
custom_components.sensor.broadlink_s1c: debug
If you got the same error. Can you show the file name package_constrains.text line 20 located at /usr/lib/python3.6/site-packages/homeassistant/package_constraints.txt (line 20))
Thanks. logs working now.
2018-03-07 21:06:41 ERROR (SyncWorker_7) [homeassistant.util.package] Unable to install package https://github.com/mjg59/python-broadlink/archive/master.zipmaster.zip#broadlink==0.6: HTTP error 404 while getting https://github.com/mjg59/python-broadlink/archive/master.zipmaster.zip#broadlink==0.6
Could not install requirement https://github.com/mjg59/python-broadlink/archive/master.zipmaster.zip#broadlink==0.6 because of error 404 Client Error: Not Found for url: https://codeload.github.com/mjg59/python-broadlink/zip/master.zipmaster
Could not install requirement https://github.com/mjg59/python-broadlink/archive/master.zipmaster.zip#broadlink==0.6 because of HTTP error 404 Client Error: Not Found for url: https://codeload.github.com/mjg59/python-broadlink/zip/master.zipmaster for URL https://github.com/mjg59/python-broadlink/archive/master.zipmaster.zip#broadlink==0.6
2018-03-07 21:06:41 ERROR (MainThread) [homeassistant.requirements] Not initializing sensor.broadlink_s1c because could not install requirement https://github.com/mjg59/python-broadlink/archive/master.zipmaster.zip#broadlink==0.6
2018-03-07 21:06:41 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform sensor.broadlink_s1c: Could not install all requirements.
2018-03-07 21:06:49 ERROR (MainThread) [homeassistant.components.sensor] cpuspeed: Error on device update!
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 197, in _async_add_entity
yield from entity.async_device_update(warning=False)
File "/usr/lib/python3.6/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.6/asyncio/futures.py", line 332, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
future.result()
File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
raise self._exception
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3.6/site-packages/homeassistant/components/sensor/cpuspeed.py", line 86, in update
self._state = round(float(self.info['hz_actual_raw'][0])/10**9, 2)
KeyError: 'hz_actual_raw'
2018-03-07 21:07:10 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/lib/python3.6/socketserver.py", line 453, in __init__
self.server_bind()
File "/usr/lib/python3.6/http/server.py", line 136, in server_bind
socketserver.TCPServer.server_bind(self)
File "/usr/lib/python3.6/socketserver.py", line 467, in server_bind
self.socket.bind(self.server_address)
OSError: [Errno 98] Address in use
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3.6/site-packages/homeassistant/components/homekit/__init__.py", line 125, in start_driver
ip_address, path)
File "/usr/lib/python3.6/site-packages/pyhap/accessory_driver.py", line 144, in __init__
self.http_server = HAPServer((self.address, port), self)
File "/usr/lib/python3.6/site-packages/pyhap/hap_server.py", line 766, in __init__
super(HAPServer, self).__init__(addr_port, handler_type)
File "/usr/lib/python3.6/socketserver.py", line 456, in __init__
self.server_close()
File "/usr/lib/python3.6/site-packages/pyhap/hap_server.py", line 798, in server_close
for sock in self.connections.values():
AttributeError: 'HAPServer' object has no attribute 'connections'
from home-assistant-custom-components/custom_components/sensor/broadlink_s1c.py <== open this file and change the requirement
from
REQUIREMENTS = [
‘https://github.com/mjg59/python-broadlink/archive/master.zip’
‘master.zip#broadlink==0.6’]
to
REQUIREMENTS = [
‘https://github.com/mjg59/python-broadlink/archive/master.zip’
‘#broadlink==0.6’]
also delete the old file create in pycache
still same
2018-03-07 21:22:00 ERROR (MainThread) [homeassistant.components.sensor] cpuspeed: Error on device update!
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 197, in _async_add_entity
yield from entity.async_device_update(warning=False)
File “/usr/lib/python3.6/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.6/asyncio/futures.py”, line 332, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.6/asyncio/tasks.py”, line 250, in _wakeup
future.result()
File “/usr/lib/python3.6/asyncio/futures.py”, line 245, in result
raise self._exception
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, self.kwargs)
File “/usr/lib/python3.6/site-packages/homeassistant/components/sensor/cpuspeed.py”, line 86, in update
self._state = round(float(self.info[‘hz_actual_raw’][0])/109, 2)
KeyError: ‘hz_actual_raw’
2018-03-07 21:22:32 ERROR (SyncWorker_12) [homeassistant.util.package] Unable to install package https://github.com/mjg59/python-broadlink/archive/master.zip#broadlink==0.6: Could not find a version that satisfies the requirement pycrypto==1000000000.0.0 (from -c /usr/lib/python3.6/site-packages/homeassistant/package_constraints.txt (line 20)) (from versions: 2.0.1, 2.1.0, 2.2, 2.3, 2.4, 2.4.1, 2.5, 2.6, 2.6.1)
No matching distribution found for pycrypto==1000000000.0.0 (from -c /usr/lib/python3.6/site-packages/homeassistant/package_constraints.txt (line 20))
2018-03-07 21:22:32 ERROR (MainThread) [homeassistant.requirements] Not initializing sensor.broadlink_s1c because could not install requirement https://github.com/mjg59/python-broadlink/archive/master.zip#broadlink==0.6
2018-03-07 21:22:32 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform sensor.broadlink_s1c: Could not install all requirements.
2018-03-07 21:22:59 ERROR (SyncWorker_7) [homeassistant.components.sensor.command_line] Command failed: hassio ha info
2018-03-07 21:23:03 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.6/socketserver.py”, line 453, in init
self.server_bind()
File “/usr/lib/python3.6/http/server.py”, line 136, in server_bind
socketserver.TCPServer.server_bind(self)
File “/usr/lib/python3.6/socketserver.py”, line 467, in server_bind
self.socket.bind(self.server_address)
OSError: [Errno 98] Address in use
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/lib/python3.6/site-packages/homeassistant/components/homekit/init.py”, line 125, in start_driver
ip_address, path)
File “/usr/lib/python3.6/site-packages/pyhap/accessory_driver.py”, line 144, in init
self.http_server = HAPServer((self.address, port), self)
File “/usr/lib/python3.6/site-packages/pyhap/hap_server.py”, line 766, in init
super(HAPServer, self).init(addr_port, handler_type)
File “/usr/lib/python3.6/socketserver.py”, line 456, in init
self.server_close()
File “/usr/lib/python3.6/site-packages/pyhap/hap_server.py”, line 798, in server_close
for sock in self.connections.values():
AttributeError: ‘HAPServer’ object has no attribute ‘connections’
2018-03-07 21:23:18 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
2018-03-07 21:24:03 ERROR (SyncWorker_5) [homeassistant.components.sensor.command_line] Command failed: hassio ha info
I think it’s a different error now, before the error was:
Could not install requirement https://github.com/mjg59/python-broadlink/archive/master.zipmaster.zip#broadlink==0.6 because of HTTP error 404 Client Error: Not Found for url: https://codeload.github.com/mjg59/python-broadlink/zip/master.zipmaster for URL https://github.com/mjg59/python-broadlink/archive/master.zipmaster.zip#broadlink==0.6
Now it says:
No matching distribution found for pycrypto==1000000000.0.0 (from -c /usr/lib/python3.6/site-packages/homeassistant/package_constraints.txt (line 20))
As @Sunonline pointed out the discussion in Don't allow to use a old unsecure library by pvizeli · Pull Request #12715 · home-assistant/core · GitHub
I think the pycrypto is blocked in version 0.64.
I’ve developed this component in version 0.63 so I didn’t ran into this error.
I’ll investigate it and see if I can find a workaround.
Yep. you are right
It is a different issue.
Thanks. let me know if you find any workaround for this
@Sunonline
I’ve looked into the device_class, as it turns out it’s only eligible for use with covers and binary_sensors, so I can’t incorporate it into the sensor domain.
I’m not sure converting the component from the sensor
domain to the binary_sensor
domain is the right way to go, seeing that s1c sensors has multiple states and the binary_sensor
domain has only 2, this means the device_class
should be dynamic and based on the sensor state.
So I figured I’ll configure a template binary sensor, only to realize that the device_class
doesn’t supports templates.
But I’ve noticed you use the mqtt
platform for your binary_sensors
, so I’m sure you can write a couple of simple automations that will publish mqtt payload based on the s1c sensor states. You might have to ignore specific states.
Anyway, this is the template I tried to create for the binary_sensor
(which would have worked if the device_class
would support templates), maybe it’ll help you plan your automations.
binary_sensor:
- platform: template
sensors:
test_binary_template:
value_template: >
{% set dest_sensor = states.sensor.broadlink_s1c_closet_room %}
{% set sensor_state = dest_sensor.state %}
{% if sensor_state == "tampered" or sensor_state == "unknown" or sensor_state == "closed" or sensor_state == "no_motion" or sensor_state == "disarmed"%}0
{% else %}1
{% endif %}
device_class: >
{% set dest_sensor = states.sensor.broadlink_s1c_closet_room %}
{% set sensor_state = dest_sensor.state %}
{% set sensor_type = dest_sensor.attributes.sensor_type.lower() %}
{% if sensor_state == "tampered" or sensor_state == "unknown" %}connectivity
{% elif sensor_type == "door sensor" %}door
{% elif sensor_type == "motion sensor" %}motion
{% elif sensor_type == "key fob" and sensor_state == "sos"%}problem
{% else %} safety
{% endif %}
Does it work with S2C sensors as well?
I actually have no idea, I don’t know anyone with HA and S2C.
If you could test it and confirm it for everyone reading this post it will be great.
I’ve check on my HassIO environment, both ways works the same.
I’ll update the component with that second one.
Thanks!
@udayaw
I think I have a workaround, but I don’t want to upgrade my environment to 0.64 just yet…
If you can help me test the workaround I’ll appreciate it.
in broadlink_s1c.py
replace the REQUIREMENTS
assignment to:
REQUIREMENTS = ['https://github.com/TomerFi/python-broadlink/archive/master.zip#broadlink==0.6']
Delete the broadlink_s1c.cpython-36.pyc
file from the __pycache__
folder and restart Home Assistant.
No luck yet.
2018-03-07 23:21:45 ERROR (SyncWorker_0) [homeassistant.util.package] Unable to install package https://github.com/TomerFi/python-broadlink/archive/master.zip#broadlink==0.6: Could not find a version that satisfies the requirement pycrypto==1000000000.0.0 (from -c /usr/lib/python3.6/site-packages/homeassistant/package_constraints.txt (line 20)) (from versions: 2.0.1, 2.1.0, 2.2, 2.3, 2.4, 2.4.1, 2.5, 2.6, 2.6.1)
No matching distribution found for pycrypto==1000000000.0.0 (from -c /usr/lib/python3.6/site-packages/homeassistant/package_constraints.txt (line 20))
2018-03-07 23:21:45 ERROR (MainThread) [homeassistant.requirements] Not initializing sensor.broadlink_s1c because could not install requirement https://github.com/TomerFi/python-broadlink/archive/master.zip#broadlink==0.6
2018-03-07 23:21:45 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform sensor.broadlink_s1c: Could not install all requirements.
2018-03-07 23:21:50 ERROR (MainThread) [homeassistant.components.sensor] cpuspeed: Error on device update!
Sure will give a try,
Thx
Yeah… so… I did some reading.
See the problem is that ever since version 0.64.0 of HA the pycrypto
library is blocked from use because it has issues with the pycryptodome
library which is, to my understanding a maintained version of pycrypto
.
When 0.64.0 was released it broke all the broadlink components because HA is using python-broadlink 0.5
which uses pycrypto
.
On 0.64.1 the issue was fixed when the HA developers created their own version of the library python-broadlink 0.5.1
.
My component uses python-broadlink 0.6
for its S1C support which doesn’t exist in python-broadlink 0.5
,
And because the pycrypto
to pycryptodome
was updated on the HA temporary version of python-broadlink 0.5.1
that means python-broadlink 0.6
still uses pycrypto
and won’t work on HA version 0.64.0 or higher.
The good news are that the HA developers requested the ‘python-broadlink’ developers to do the same fix, as you can see here:
Once they do, if you use the original REQUIREMENTS
assignment in my component the issue should be fixed on the next restart (you might need to clear the cache file before).
For now, I’ll try to follow the updates in HA’s code and apply them to my forked version of ‘python-broadlink’ which you tested earlier.
If I’ll manage to get it working, it will be a good workaround until the original library will be updated.
Thanks. please let me know if find any workaround.
I think I got it.
Can you please try again?
Delete the cache file and restart.
Assuming your REQUIREMENTS
assignment is still pointing to my repository:
REQUIREMENTS = ['https://github.com/TomerFi/python-broadlink/archive/master.zip#broadlink==0.6']