Broadlink S1C Alarm Kit Custom Sensor Component

Based on @NightRanger script and instruction here and based on the python-broadlink repository by mjg59…

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:

sensor:
  - platform: broadlink_s1c
    ip_address: "xxx.xxx.xxx.xxx"
    mac: "xx:xx:xx:xx:xx:xx

All you S1C sensors will be added to HA after restart.
I hope more people will found use of it.
:grinning:

9 Likes

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.

  1. Would it be possible to track the battery level of the sensor as well?
  2. Would it be possible to make them as binary_sensor / as I can set the device_class which more effective.

Thank you very much again ^^

Oh, tha’s a nice custom component. Would this work on hassio too? :slight_smile:

this would works just fine in any installation of HA as it is custom_component.

1 Like

Awesome! However, I get this error:

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))

Anyone knows what I’m missing? TIA

Ok, I’m trying.
So, I placed the broadlink_s1c.py file in this directory:

\\HASSIO\config\custom_components\sensor

and I added these lines:

sensor:
  - platform: broadlink_s1c
    ip_address: "192.168.1.77"
    mac: "34:ea:34:xx:xx:xx"

but when it starts there’s a persistent message saying that there’s an error loading the component:
image

(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)

I now added

  logs:
    custom_components.sensor.broadlink_s1c: debug

but actually I cannot find anything inside the home-assistant.log file…

I’m running on hassio 0.62.1

As what Mr.TomerFi mention.

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

2 Likes

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.

Can you try change the mac address to capital letter in your configuration.

delete the old broadlink_s1c.cpython-36.pyc in folder pycache

Also if possible upgrade you HA to 0.63.3 as it has been tested.

I have read from this 2 post with has the same problem as you posted.


and

@Sunonline

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. :frowning:

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 :slight_smile:
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?

Example of binary_sensor for s1c door and motion sensor.

binary_sensor:
  - platform: mqtt
    name: "front_door_sensor" 
    qos: 0
    state_topic: "sensors/s1c/front_door"
    payload_on: 'Open'
    payload_off: 'Closed'
    device_class: opening

  - platform: mqtt
    name: "office_door_sensor"
    qos: 0
    state_topic: "sensors/s1c/office_door"
    payload_on: 'Open'
    payload_off: 'Closed'
    device_class: opening     

  - platform: mqtt
    name: "office_motion_sensor" 
    qos: 0
    state_topic: "sensors/s1c/office_motion"
    payload_on: 'Motion_Detected'
    payload_off: 'No_motion'
    device_class: motion

Regarding to the battery status. in broadlink app. if you click in each sensor. you can see the battery status.

I’ll look into the device_class.

Regarding to the battery status. in broadlink app. if you click in each sensor. you can see the battery status

Hmm… I missed that :slight_smile: Nice to know, thanks.
I hope the python-broadlink library will enable the use of it soon, when it will, I’ll update the component.

1 Like

I use speech_engine from Mr. Costanzo. to report the door and window check which support binary_sensor and use device_class

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.

1 Like

That’s cool!
First time I’m seeing this project.

1 Like

@Marc_R
What is your ha version?

I am getting the same error. I am using 0.64.3

Can you share the exact error from the log file please?

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.

Successful config (partial)

Did you placed the broadlink_s1c.py file in your custom_components/sensor folder in HA?