Broadlink S1C Alarm Kit Custom Sensor Component

I’m sorry, I didn’t quite understand what are you trying to do.
Maybe you can share the yaml configuration so it will be more clear.

2 Likes

0.65 version of Ha on Hassio is working perfect. Thanks for not letting me use and addon anymore.

1 Like

Thank you very much Mr.TomerFi
This also working fine with hassbian and raspbian for HA 0.65.1. as custom_component.
However, I have to use from old mqtt which is support binary_sensor.

For those who want to know how to install this custom_component. It is very straight forward.

  1. File located. Just copy the broadlink_s1c.py to your home-assistant configuration folder>custom_component>sensor>broadlink_s1c.py download from Mr.TomerFi broadlink_s1c github page

  2. Setting in configuration.yaml under sensor platform

    sensor:

    • platform: broadlink_s1c
      ip_address: 192.168.xxx.xxx <== broadlink s1c ip address, no quote ’ or double quote "
      mac: ‘AB:CD:EF:GH:IJ:KL’ <==broadlink s1c mac address with single quote ’

3.Reboot your home-assistant. Then you will see all the sensor generate into your home-assistant automatically. example: sensor.broadlink_s1c.nameofyoursensor
4. Time to put in group and customize, where you want the sensor to be display and name to be display.

1 Like
  1. Time to put in group and customize, where you want the sensor to be display and name to be display.

@Sunonline, would be interesting to see how you customized it. Can you share your configs please? :slight_smile:

For key_fob to be usable not just read the status of the arm home, arm away and sos.
I create the package file for key fob and paste it here as switch and script

From Mr.TomerFi, I only use his keyfob option to read out the status of the alarm.
Mr.TomerFi has already put the icon for both sensor and key fob so you don’t have put icon in customize. Mine is binary_sensor so I have to put in refer from device_class: and icon I want to be display
Down below is just the guide how you get group and customize and put in new tab you want.

customize: 
  binary_sensor.office_motion_sensor:
    friendly_name: Office Motion
    show_last_changed: true
    templates:
      rgb_color: "if (state === 'off') return [10, 170, 10]; else return [255, 0, 0];"
      icon_template: "{{ 'mdi:run-fast' if is_state('binary_sensor.office_motion_sensor', 'on') else 'mdi:walk' }}"
  binary_sensor.office_door_sensor:
    friendly_name: Office Door
    show_last_changed: true
    templates:
      rgb_color: "if (state === 'off') return [51, 153, 255]; else return [255, 0, 0];"
      icon_template: "{{ 'mdi:door-open' if is_state('binary_sensor.office_door_sensor', 'on') else 'mdi:glassdoor' }}"
  sensor.key_fob:
    friendly_name: S1C Key Fob
    icon: mdi:remote     
    show_last_changed: true
    templates:
      rgb_color: "if (state === 'alarm_disarmed') return [10, 170, 10]; if (state === 'Alarm_Armed_Home') return [51, 153, 255]; if (state === 'Alarm_Armed_Away') return [255, 0, 0]; if (state === 'Alarm_SOS') return [255, 0, 125]; else return [255, 0, 0];"  

sensor:
  - platform: mqtt
    name: "key_fob"   
    state_topic: "sensors/s1c/key_fob"

group:
  s1c_all:
    name: All Alarm
    control: hidden
    entities:
     - binary_sensor.front_door_sensor  <== refer from your entity_id
     - binary_sensor.office_door_sensor
     - binary_sensor.back_door_sensor
     - binary_sensor.bedroom_1_door_sensor
     - binary_sensor.bedroom_2_door_sensor    
     - binary_sensor.office_motion_sensor

  security_status:
    name: Security Status
    entities:
     - sensor.key_fob
     - sensor.s1c_armed_away_status
     - sensor.s1c_armed_home_status
     - sensor.alarm_control_panel_ssh_status

  system_view:
    view: yes
    name: System
    icon: mdi:desktop-classic
    entities:
     - group.s1c_all
     - group.security_status

by doing this you get like this
s1c_status
sensor_status

2 Likes

I set group for a better visual, but maybe there’s a bug in the script I think, I have tested for 2 days , and I have always 2 sensor in unknown status, one is a door sensor and the other a motion sensor by 2 different hub, while in e-Control works good.

0.65.4 HA tested and working with this project , always 2 sensor not working any working in progress for fix bug or I need to delete in e-Control and repeat configuration ?

That what I do. Also during setting up new sensor in e-control I stop homeassistant.

You can add my package file in order to control the arm home, arm away and activate the sos from HA.

I do what you write , but not working,s1c_keyfob.yaml in /home/homeassistant/.homeassistant/custom_components/sensor ???

I add in configuration.yaml

sensor:

  • platform: mqtt
    name: “key_fob”
    state_topic: “sensors/s1c/key_fob”

and the rest in group, for now I don’t used customize
Checked config ok
I changed ip and mac as you say but don’t work , do I need also some script running in background?

I add in switch “arm at home” and “arm away” as code for RM2 pro but I’m interessed to the state of Hub S2 if is it in ARMED STATE or DISARMED

My key fob is in normal sensor.yaml file. This key fob to read the status of the alarm.

****If you already has use Mr.TomerFi custom_component. The broadlink.s1c.key_fob will automatically generate.

You don’t have to do any extra sensor like me.

If you want to control the arm home, arm away or sos in HA. Then use the package from post #66

Tested again but never work , always keyfob unknown status. I used a sc1 switch as allarm indicator so when allarm is armed s1c go on and light a led indicator , MQTT not work in my configuration to read status. Anyway now is so:

when you turn on S1C Armed Away or Armed Home from S1C Alarm and SOS group. Did the status from Keyfob group show that your alarm is in armed away or armed home?

You don’t need to create any sensor as you use the custom_component. It will generate sensor.broadlink.s1c automatically.

My package the S1C Alarm and SOS. when you turn on S1C armed home, or armed away. Did it tell you the status of armed home or armed away in your keyfob group?

Mine show correctly.

its not because s1c device only suppose to work with 16 sensor
not sure only have 6 device here

all working good for me, I have 5 hub s1/s2 and now after reconfigure some sensor on e-controll are finally ok.
I used part of code of SUNONLINE directly on my configuration.yaml , I changed the string of RF because are different for everyone , when I armed all hub are armed and led light (by a sp2 switch) became in status ON.
Keyfob show armed , all is done by TomerFi plugin. I don’t use mqqt sensor. I think can be much more better in the future , for example battery level and other addon, but now is the best can I do . Thanks guys for your support in configuration.

hi Dustardly2

and do you prefer s1 or s2 will need to order one more currently have a s2

S2 Better signal and Better hardware, also use 5v power if You use a powerbank You can have allarm working when someone poweroff You elettrical line

I still get lots of these errors and I have no idea how to resolve:

exception while getting sensors status: Traceback (most recent call last):
  File "/config/custom_components/sensor/broadlink_s1c.py", line 253, in run
for i, sensor in enumerate(current_status["sensors"]):
TypeError: 'NoneType' object is not subscriptable

Any ideas? Thanks as always!

Yes.
This message is printed on purpose, Maybe it should have been configured as Warning and not Error (I’ll look into it).

The thing is, the component is repeatedly asking for a state report from the S1C hub and updates the sensors state based on the information received.
On some occasions the hub is not replying or it’s replying with a broken response,
The component will then receive a NoneType response from broadlink library.
When it happens the component is adding the message you are referring to and goes back to repeatedly asking the hub for a the state report.

I added a safety mechanism, if 50 exceptions will be received in 1 minute,
The hub connection will be terminated and the component will add the following message to the error log: max exceptions allowed in watch loop exceeded, stopping watch loop.

So… until you see the second error message, you can pretty much ignore any previous ones.
Unless it’s really bothering you, or you think it’s too much, you can try and figure out what’s wrong.
It can either be the network’s fault or the hub’s fault, something along the way is causing the response to break.

I would bet on the hub’s fault… it’s broadlink not smartthings. :wink: