I’ve created a Custom Component to act as a platform for the sensor domain.
You can grab it on my GitHub custom components repository.
The yaml configuration is pretty straightforward:
Good morning, and thank you so much for sharing this project. I am so happy that I don’t have to run from python 2.7 from pi user which really effected me when I try to install python 3.6 for HA. Since it it custom_component then I can upgrade python 3.6 with no issue.
Would it be possible to track the battery level of the sensor as well?
Would it be possible to make them as binary_sensor / as I can set the device_class which more effective.
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))
but when it starts there’s a persistent message saying that there’s an error loading the component:
(now, inside the sensor directory there is also another dir called “__ pycache __” which contains a file named broadlink_s1c.cpython-36.pyc, so it is probably been loaded)
Special Notes
Initial configuration of the sensor in the Broadlink App is required.
The platform discovers the sensors upon loading, therefore if you add another sensor, restart Home Assistant and the new sensors will be added to ha.
The entity name of each sensor is constructed from the original sensor name from the Broadlink App concatenated with the platform name. Spaces and dashes will be replaced with underscores.
For instance, if you sensor is name Bedroom Door the entity name will be broadlink_s1c_bedroom_door, and to reference it you will call sensor.broadlink_s1c_bedroom_door
well, my Broadlink S1c is up and running since a few months, so the initial configuration has been done at that time. I used to use it with my addon, but a custom component would be better.
Would it be possible to track the battery level of the sensor as well?
I’m constantly watching the python-broadlink repository on github, which is the source for the S1C connection. If there will be any advancement in the future that will enable tracking the sensor’s battery level… I will update the component accordingly.
Unfortunately broadlink never released an API documentation, so everything we have for the python-broadlink integration is based on reverse engineering by the library developers.
I also don’t recall seeing any battery level reference in the braodlink app itself, so I find it hard to believe it will be available anytime soon for us.
Would it be possible to make them as binary_sensor / as I can set the device_class which more effective.
Sounds doable, I think I can also add a device_class reference without converting it to binary_sensors
Can you give me an example of a device_class usage in regards to the s1c sensors so that I can try and play around with it?
A couple of HA versions ago (I don’t remember which one) the logger component was updated and it can only set the log level in the log file itself.
The logs showing in the Info screen in HA are showing warning level logs only.
So to check the debug level logs which is two levels below warning logs, you will need to look into the log file itself.
I could not add log: into the configuration.yaml
I am getting below error.
Testing configuration at /config
ERROR:homeassistant.loader:Unable to find component logs
ERROR:homeassistant.setup:Setup failed for logs: Component not found.
ERROR:homeassistant.loader:Unable to find component custom_components.sensor.broadlink_s1c
ERROR:homeassistant.setup:Setup failed for custom_components.sensor.broadlink_s1c: Component not found.
Failed config
General Errors:
- Component not found: logs
- Setup failed for logs: Component not found.
- Platform not found: custom_components.sensor.broadlink_s1c
- Setup failed for custom_components.sensor.broadlink_s1c: Component not found.