Sector Alarm

Include this alarm system in

This is a component I would very much like to try.
How can I install it manually until it become a component?

After looking though the code I realized it was not a component to be used with Home Assistant, so:

  • I ported it to Python 3.
  • Made a package and published it to PyPI.
  • Made a sensor component.

If you want to give it a try, here it is:

Seems to work great in my installation so far :slight_smile:

I have no idea how to make it an official component so I will leave that to someone else.

Awesome man!! Thanks.
Working great. :slight_smile:

How did you port it to Python3?
Because I found one that’s even better:

I would also like to get a more feature-rich sensor component (with arming, partial arming and disable). The basic setup works hoever. I have now a panel which indicates the arming status of my alarm.

Hadn’t seen this thread before…

I’ve actually started on a Sector Alarm component using my own asynchronous Sector Alarm library:

I just pushed this if someone wants to try it out:

As I only have temperature sensors and the alarm, that’s the only components so far, but lock and outlets should be quite easy to add I guess.

Nice, i will try it out!

Works like a charm… great work!

I just tried it but I cannot get it to work. This is my log error:

2017-11-07 11:18:48 ERROR (MainThread) [homeassistant.helpers.entity] Update for alarm_control_panel.sector_alarm_01234567 fails
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/", line 204, in async_update_ha_state
    yield from self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/", line 307, in async_device_update
    yield from self.async_update()
TypeError: cannot 'yield from' a coroutine object in a non-coroutine generator

My config looks like this:

  email: [email protected]
  password: !secret sector
  alarm_id: 01234567
  code: !secret sector_pin
#  thermometers: 0
#  alarm_panel: 1

I have tried to uncomment the two last lines, and replacing 1 and 0 with true false but the error is the same. Am I missing something? The alarm_id is of course also not 1234567 but taken from the URL of the login site from Sector. The old plugin worked :slight_smile:

Any pointers?

What version of HA are you using and what version of Python?

These components are written using the Python 3.5 async/await syntax, it could be some kind of clash with that perhaps?

(I saw this and decided to skip 3.4 support…)

1 Like

Hello @mgejke, thanks for your reply.

I am running a Docker image on Synology. Just bashed into the docker image and found:

[email protected]:/usr/src/app# python --version
Python 3.6.3

So that should be fine then?

Forgot to answer HA version:

Home Assistant

Edit; upgraded to 0.57.2 now, still the same error.

Edit #2

/usr/src/app/homeassistant/helpers/ RuntimeWarning: coroutine 'Sec
torAlarmPanel.async_update' was never awaited                                   
  yield from self.async_update()                                                
2017-11-07 11:55:43 ERROR (MainThread) [homeassistant.helpers.entity] Update for
 alarm_control_panel.sector_alarm_01234567 fails                                
Traceback (most recent call last):                                              
  File "/usr/src/app/homeassistant/helpers/", line 204, in async_update
    yield from self.async_device_update()                                       
  File "/usr/src/app/homeassistant/helpers/", line 307, in async_device
    yield from self.async_update()                                              
TypeError: cannot 'yield from' a coroutine object in a non-coroutine generator 

Got this error from the console log. That first part was not in there in the log from the UI I think. Not sure it gives more meaning?

Ah, that’s actually a newer HA version than I’m using.
From my limited knowledge it looks like a bug in HA… I’ll have to check some more tonight.

However, you can get around it by changing:

    async def async_update(self):
        update = self._hub.update()
        if update:
            await update


    def async_update(self):
        update = self._hub.update()
        if update:
            yield from update

In the files in sensors/ and alarm_control_panel/

1 Like

Thanks Martin, that really worked to kill off the errors in the log. :smiley:

Still I get this status on the sensors in <>:



code_format: ^\d{4,6}$
friendly_name: Sector Alarm 01234567

Is there some logging option to find out why it cannot pull the status from Sector? It seems to log in fine since if I put an ID that is wrong then it does not work at all. Something is still fishy…

The errors in the log actually seems to be a HA bug… But I’ve changed to the working code in the repo.

I don’t know why you don’t get any status for the alarm, I’ve added some debug output as well. So update from the repo and make sure you have the logger-component in your configuration and let me now what it says(might be that you want to anonymize it a bit… )

Thanks @mgejke

Seems I f#%#%ed up my HA install by upgrading to 0.57.2 so I need to find a way to fix that first. Been fighting all night with it without moving forward at all. As soon as I find the solution I will pop right back to this topic.

If you have any ideas or time to have a look my issue is here:

Not sure, but does the upgrade maybe change my config files somehow? Sorry for the off-topic. Will go sleep a bit and hope someone found some kind of way forward!

Thanks for all your great work :smiley:

Hello again @mgejke

Finally back up and running … :smiley: :smiley:

I have now git’ed a new copy of the plugin and enabled debug logging. I did a grep for sector_alarm in the log and replacted the alarm ID. The result is here:

I cannot see anything useful in here myself, it all looks good to my eyes.

Hello, stop the press, I just checked with Sector and it seems they have issues with my central, so this is probably not the plugins fault at all! :smiley:

Great news, Sector fixed it :slight_smile:

Thank you for your efforts!

Alright… Odd!
I checked your sector log and you have entries in it called “mainsrestore” and “mains” that I haven’t seen before(instead of just “armed”, “disarmed” etc). I’ll make a fix so that it handles that case anyway…
Did the say anything about what was wrong?
Did you tell them why you were asking? I’m not sure what their opinion about plugins like this is :slight_smile: