Sector Alarm

The code now works for the latest Home Assistant.

Hmm

82.1?

I still get this error:

Error during setup of component sector_alarm
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/setup.py", line 145, in _async_setup_component
    hass, processed_config)
  File "/config/custom_components/sector_alarm.py", line 82, in async_setup
    CONF_CODE: config[DOMAIN][CONF_CODE]
TypeError: load_platform() missing 1 required positional argument: 'hass_config'

Have you pulled the latest code from github?

Yeah!

Sorry, no I hadn’t, but now I have and that did work very well. Thanks!

This seems really interesting, but I think I must be doing something wrong. I keep getting the following error every minute. I’ve tried to read the source code on https://github.com/mgejke/hass-sectoralarm/blob/master/sector_alarm.py, but can’t seem to figure out what is causing the problem. It might be the login, but a login error is supposed to throw a different message, so I’m guessing I managed to log in correctly. Does anyone have an idea as to what I might be doing wrong?
Sector Alarm failed previous update, trying to login again

I have a problem with disarming through automations. The log says " Invalid code given".
I am sure I use the right code. It is possible to disarm the alarm through the frontend with the given code. I have tried formating the code in different ways with no success.

code: 0000
code: ‘0000’
code: “0000”

Non of the above works. I want to disarm the alarm when my vacuum robot is vacuuming the house.

Anyone else got a call from Sector Alarm when using this component? If you did/did not did you have the thermometers on or off? Don’t want to enable it if I am just going to get a call saying I am overloading their API :slight_smile:

Hello, I still have to power off my Hass.IO to get this component to work. If I restart in software it fails. Is this a problem everyone has or only me? I thought this was solved in a git-release but I am running latest versions of everything and still it foobars…

I have not had any calls but not using thermometer either :slight_smile:

Just installed on a new Hass.IO setup and I still get errors if I do not power it off properly. In the log I only find this:

2019-01-08 08:19:58 ERROR (MainThread) [homeassistant.setup] Setup failed for sector_alarm: Component failed to initialize.

@mgejke @endor

Have tried my config with “” and ‘’ and with no quotes, stille the same. My alert panel shows the following:

Config:

Sector Alarm

sector_alarm:
email: !secret sector_username
password: !secret sector_password
alarm_id: !secret sector_alarm_id

code: !secret sector_code

thermometers: false
alarm_panel: true

Secret:

sector_username: '[email protected]'
sector_password: 'password'
sector_alarm_id: '0123456'
sector_code: '123456'

Alarm Panel (ui-lovelace.yaml):

  - icon: mdi:shield
    title: Alarm
    cards:
      - type: alarm-panel
        entity: alarm_control_panel.svingensvingen_alarm

This problem should be solved in the files available on github.

When you update the files in custom components folder, make sure to download the latest version from the git repository and update all files. There are files in subfolders as well (like sensors/ etc).

I think this particular fix is in the main file custom components/sector_alarm.py
If you find the line ending with
…import PLATFORM_SCHEMA

That is the cause for error and you need to update the files or simply remove this line :wink:

Thank you @endor for your reply!

I have a copy of all my config here: https://github.com/corvy/home-hassio and I cannot find the “PLATFORM_SCHEMA” in any file in my custom_components subdirs. If you could have a look I would be very happy!

And just to be perfectly clear I just installed all fresh from git just two days ago due to a total data loss on my old solution. So there should be no old config or datafiles lingering.

The configuration.yaml looks correct. and if it works on reboot it should not be any content issues.
I have also secrets in use. All secrets regardless of format are in double qoutes in the secrets file.

sector_code: “0000”

Only difference from your config is that i have thermometers: true
and my code is defined as opposed to yours is commented out… although with dummy code in secrets.

Ok I changed to your setup:

And I double quoted all settings in secrets, also I used a dummy code. Still the same error… I will do a hard reboot at home and then test a reload aftewards to see if anything has helped but it seems not…

Nah, still fails even with hard boot. Not sure what is wrong. Not sure I have a verified test since I reinstalled. Any way to turn on debugging of the component? The logs give me nada as-is.

Just got an email from Sector that they have locked my account :wink: Seems they have gotten some error on logins. When I unlocked it now it all works!

My sector_alarm seems to work about every other restart in hass.io. When it fails, I get this in the log:

2019-01-15 16:06:46 WARNING (MainThread) [homeassistant.setup] Setup of sector_alarm is taking over 10 seconds.
2019-01-15 16:06:47 ERROR (MainThread) [homeassistant.setup] Error during setup of component sector_alarm
Traceback (most recent call last):
  File "/config/deps/lib/python3.6/site-packages/asyncsector/asyncsector.py", line 36, in login
    AsyncSector.Base + AsyncSector.Login, json=self._auth)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/client.py", line 424, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/client_reqrep.py", line 818, in start
    message, payload = await self._protocol.read()  # type: ignore  # noqa
  File "/usr/local/lib/python3.6/site-packages/aiohttp/streams.py", line 566, in read
    await self._waiter
concurrent.futures._base.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/setup.py", line 145, in _async_setup_component
    hass, processed_config)
  File "/config/custom_components/sector_alarm.py", line 58, in async_setup
    if not await async_sector.login():
  File "/config/deps/lib/python3.6/site-packages/asyncsector/asyncsector.py", line 42, in login
    return True
  File "/usr/local/lib/python3.6/site-packages/async_timeout/__init__.py", line 45, in __exit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.6/site-packages/async_timeout/__init__.py", line 92, in _do_exit
    raise asyncio.TimeoutError

Hello,
I’m using this custom component and it’s working almost flawlessly, I have the random “can’t start sector” but a restart normally sorts it out. So thank you!

Now on to my question,
I’m been trying to find out if there is a way to add triggering the alarm.
From reading through the code it seems that the component only supports arm_home, arm_away, disarm

On my Swedish sector alarm I have 2 “trigger types”

  1. “trygghetslarm” or “panic mode” basically a mode for when your not feeling safe . say someone is trying to break in during the night.
  2. the basic alarm trigger. from a motion sensor or door sensor etc.

But, neither of these modes are possible to trigger via the app or webpage.

Does anyone know if it’s exposed through commands even though you cant see it in the app or on the homepage?
Have anyone researched this?

So, after 0.88.1 upgrade sector broke for me.
It times out when starting, similar to @tomoqv error message.

  • In file \config\deps\lib\python3.7\site-packages\asyncsector\asyncsector.py
    Removed the lines import async_timeout and with async_timeout.timeout(10): (+ changed indentation of following 7 lines)
    Copy of my file is here: https://pastebin.com/YrmgukQX

Not sure if it is due to that my sd-card is slow or why it times out, but removing the timeout completely works in my setup, verify if it works for you and then we can propose to have it removed as default in git and the module?

  • Rearranged files in custom components
  1. create new folder custom_components\sector_alarm

  2. Move custom_components\sector_alarm.py to custom_components\sector_alarm\__init__.py

  3. Move custom_components\sensor\sector_alarm.py to custom_components\sector_alarm\sensor.py

  4. Move custom_components\alarm_control_panel\sector_alarm.py to custom_components\sector_alarm\alarm_control_panel.py

This seems to be the new expected folder structure that aligns with this change:

1 Like