Giter VIP home page Giter VIP logo

sector's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

sector's Issues

Error setting up temp sensors after server restart

I am running Hassio 2021.12.10 and Sector v0.3.4. The problem started with Sector v0.3.4. Had the some problem on Hassio 2021.12.09.

After a server restart of Hassio the temp sensors in the Sector integration cannot be setup. I have to remove and install the integration after every restart, then they come back again, otherwise they stay in the "unavailable" state. The alarm and smartplugs works as intended, it is only the temp sensors that wont leave the unavailable state.

The following is logged after a restart:

2022-01-31 08:06:01 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up sector platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/sector/sensor.py", line 51, in async_setup_entry
    SectorAlarmTemperatureSensor(sector_hub, coordinator, description)
  File "/config/custom_components/sector/sensor.py", line 73, in __init__
    self._attr_native_value = self._hub.temp_state[description.key]
KeyError: '2490xxxxA35'

pin code is a bit funky

Not quite worked it all out but it seems like I can only arm/disarm with the pin code configured at install. That is not so great as everyone in the house has their own pass code meaning they cant use HA to disable the alarm.

Also I don't find a place in the UI (or anywhere) to change the configured pin.

Why must the code compare the entered pin to the configured pin anyway, just send the disarm command with what ever pin is provided.

Generate unique IDs for entitities

It would be swell to be for the component to generate unique IDs for the entities, so that alisases etc could be set in the UI. This is described in https://developers.home-assistant.io/docs/config_entries_config_flow_handler.

There is also the question of naming, the alarm_panel seems to be getting a pretty identifiable name (incl "sector") while the sensors are not (just the display name from the app/api from what I can see). There seems to be some kind of naming convention(?) now where an integration adds on a domain to the name, like sensor.sectoralarm.hall, this should probably also be investigated. This could likely be done as part of the same enhancement.

Error while setting up sector platform for alarm_control_panel

Get some errors after HA updates.

This is from the log of the integration

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/sector/alarm_control_panel.py", line 41, in async_setup_entry async_add_entities([SectorAlarmPanel(sector_hub, coordinator, code)]) File "/config/custom_components/sector/alarm_control_panel.py", line 54, in __init__ self._displayname: str = self._hub.alarm_displayname File "/config/custom_components/sector/coordinator.py", line 390, in alarm_displayname return self._panel["PanelDisplayName"] TypeError: list indices must be integers or slices, not str

and
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 335, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/sector/__init__.py", line 128, in async_setup_entry identifiers={(DOMAIN, "sa_hub_" + str(api.alarm_id))}, File "/config/custom_components/sector/coordinator.py", line 385, in alarm_id return self._panel["PanelId"] TypeError: list indices must be integers or slices, not str

Option to enable/disable polling of temperature sensors

Thanks for developing this promising plugin!

Sadly I get issues with my alarm (problems with status in the Sector Alarm app, notifications of alarm turned on/off many times per day, even though the status of the alarm has not changed, issues with my Yale lock taking too long time to communicate with the alarm). I had a Sector Alarm technician here today and he found no issues with my alarm unit and suggested the Hass integration is probably the cause of all my issues, especially since I did not have them before adding this integration.

One thing I thought about was to change polling rate to like 5 minutes or more, which might work but would be less optimal for automations based upon the alarm status...

Another thought was that maybe the issue would go away if the temperature data would be excluded from the polling. That is why I'm writing this feature request here, to ask if such a feature would be possible to add? :)

Timed out when connecting to Sector

Since about a week ago I keep getting this problem. Seems like I get more timed out than successful connections. But every now and then I get the alarm state.

_Logger: custom_components.sector
Source: custom_components/sector/init.py:445
Integration: Sector Alarm (documentation, issues)
First occurred: 4 maj 2022 22:04:56 (85 occurrences)
Last logged: 08:47:30

Timed out when connecting to Sector_

Sector Alarm timing out

Hi,

Very often I get this error message in my logs:
2021-07-19 07:08:05 ERROR (MainThread) [custom_components.sector] Timed out when connecting to Sector Alarm
In this case the error message has came up 37 times the last two days...

I think it might be related to that Sector Alarms website sometimes takes incredible long time to load all states and then your plugin gives up because it takes too long.

Do you think this is the case and if so, is it possible to increase the time before the plugin gives up to get all states from Sector Alarm?

Trigger manual sync

Hi,

Do you know if it's possible to trigger a sync manually?
I have set the integration to sync every 15 minutes but I would also like to trigger a sync manually from example an automation.

Is this something that can be implemented or do you know if it's possible to already trigger it through an automation?

Thank you for this great integration :)

"Unknown error occured" during setup

Hello!

I'm getting an error "Unknown error occured" when press submit in the integrations setup dialog. No matter which fields are fill och ticked.

I'm on the latest HA, HACS and Sector. I have never tried Sector before, so their should not be any old configs lying around.

Getting stack trace in logs about temperature sensors

After upgrading to version 0.3.1 I'm getting these stack traces over and over again in my Home Assistant logs:

2021-01-17 21:46:10 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 119, in _handle_refresh_interval
    await self.async_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 193, in async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 245, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state
    sstate = self.state
  File "/config/custom_components/sector/sensor.py", line 91, in state
    self._state = self._hub.temp_state[self._serial]
KeyError: '24XXXXXX7B'

I'm getting them for different values in KeyError. They seem to disappear some hours after Home Assistant was restarted. Is it possible to restore state for the temperature sensors if they are unavailable during startup instead of throwing these exceptions in the log? Alternatively, set the state value to "unknown" if the Sector Alarm API can't tell you what it is supposed to be?

Update through HACS results in missing alarm panel sensor

I've upgraded a couple times and each time I've had to recreate the integration with numerous restarts to get it working again.

expected

After upgrading the alarm sensor still exists and works

actual

sensor does not exist

steps

  • upgrade
  • reboot
  • notice sensor is not available
  • delete it
  • recreate integration, enter all details again
  • sensor is back

Status is unexpectedly changed to 'Armed away'

Looks like the same issue as #17, the alarm status fetched from Sector is incorrectly read as 'Armed away' (the actual alarm was disarmed the entire time).
image

Could potentially be related to connection timeouts as I see alot of ERROR messages in the log:
image

Happy to help with debugging!

No "Sector Alarm" integration found

Hi, I am trying to get this integration to work and I have been following the optional installation method. After having placed the 11 files in "custom_components/sector" and restarted Home Assistant, I try to add the integration, but nothing called Sector is found. Any advice on how to proceed?

Alarm panel left in pending state after upgrade to 0.3.4

After I upgraded to version 0.3.4 (from 0.3.3) my alarm panel card is stuck in a yellow blinking pending state, as shown in the screenshot.

Screenshot-20220119-095205

I have no messages in the log, except some connection timed out messages. My temperature sensors show data, and if I enter code and disarm, it actually disarms the alarm. For a moment I see a green status in the panel, then it goes back to pending state.
I've tried to log into my Sector Alarm personal page, and I see no errors or login issues.

Home Assistant Container 2021.12.10

Any idea what is causing this and how to troubleshoot?

suddenly sending wrong status

Not quite sure whats going on and haven''t found any way to figure outeither.

But every once in a while the status will change from home to away in home assistant. And then back to home.

The problem is that I have an automation that is triggered when the alarm changes to away. You know, like turning off all lights, media, heat...

Any idea what's going on?

I guess an easy solution to the problem is to add one more trigger, like check if phone is home, but would prefer not to.

Warning - Update of sensor and alam panel take longer time than expected

Hi,
Using this application for my Norwegian subscription for Sector Alarm. Everything is working as expected, but in the log I get the warning that update of sensor and alarm panel takes longer than expected (see picture). Would be good if something could be done with it.

I am running on version 0.1.9 and HA core 112.2 and 3.13 of the operating system.
image

Bjorn

Multiple state change triggered

Not sure why you are locking all the closed issues, would have been better to continue the discussion in #43

I've run the latest version for a while now and it's better but still got some issues with state change.

Always triggers two notifications when locking automatically, the first notification says "locked by " and the next says "locked by " which is correct. Notifications are sent at the same time. According to the logs there is no state change but something is triggering the state change.

# alarm arm automation triggered at 21:00:00
2022-01-13 21:00:00 INFO (MainThread) [homeassistant.components.automation.auto_arm_alarm] Auto Arm Alarm: Running automation actions
# a sound is played as a warning 
2022-01-13 21:00:00 INFO (MainThread) [homeassistant.components.automation.auto_arm_alarm] Auto Arm Alarm: Executing step call service
2022-01-13 21:00:00 INFO (MainThread) [homeassistant.components.automation.auto_arm_alarm] Auto Arm Alarm: Executing step delay 0:00:02.500000
2022-01-13 21:00:02 INFO (MainThread) [homeassistant.components.automation.auto_arm_alarm] Auto Arm Alarm: Executing step call service
# 30 second delay before actually activating the 
2022-01-13 21:00:02 INFO (MainThread) [homeassistant.components.automation.auto_arm_alarm] Auto Arm Alarm: Executing step delay 0:00:30

# Random sector update, nothing to note but see that PersonA was the changed_by as they unlocked it in the morning
2022-01-13 21:00:19 DEBUG (MainThread) [custom_components.sector] UPDATE_INTERVAL = {60}
2022-01-13 21:00:19 DEBUG (MainThread) [custom_components.sector] last updated = 2022-01-13 20:00:19.000927
2022-01-13 21:00:19 DEBUG (MainThread) [custom_components.sector] self._last_updated_temp = 2022-01-13 19:59:15.004026
2022-01-13 21:00:19 DEBUG (MainThread) [custom_components.sector] self._timesync * 5 = 300
2022-01-13 21:00:19 DEBUG (MainThread) [custom_components.sector] Evaluate should temp sensors update 0:01:03.997284
2022-01-13 21:00:19 DEBUG (MainThread) [custom_components.sector] Info retrieved successfully URL: https://mypagesapi.sectoralarm.net/api/Panel/GetPanelStatus?panelId=xxxxxx
2022-01-13 21:00:19 DEBUG (MainThread) [custom_components.sector] request status: 200
2022-01-13 21:00:19 DEBUG (MainThread) [custom_components.sector] self._alarmstatus = 1
2022-01-13 21:00:19 DEBUG (MainThread) [custom_components.sector] Full output panelstatus: {'IsOnline': True, 'StatusTime': '2022-01-13T08:01:09', 'Status': 1, 'AnnexStatus': 0}
2022-01-13 21:00:19 DEBUG (MainThread) [custom_components.sector] Info retrieved successfully URL: https://mypagesapi.sectoralarm.net/api/Panel/GetLogs?panelId=xxxxxx
2022-01-13 21:00:19 DEBUG (MainThread) [custom_components.sector] request status: 200
2022-01-13 21:00:19 DEBUG (MainThread) [custom_components.sector] self._changed_by = PersonA
2022-01-13 21:00:23 DEBUG (MainThread) [custom_components.sector] Info retrieved successfully URL: https://mypagesapi.sectoralarm.net/api/Panel/GetSmartplugStatus?panelId=xxxxxx
2022-01-13 21:00:23 DEBUG (MainThread) [custom_components.sector] request status: 200
2022-01-13 21:00:23 DEBUG (MainThread) [custom_components.sector] self._switchdata = [{'Consumption': '-1', 'DisplayScenarios': False, 'Id': 'xxxxxxx', 'Label': 'Smtplg 1', 'PanelId': None, 'SerialNo': '251000F780E', 'Scenarios': None, 'Status': 'Unreachable', 'TimerActive': False, 'TimerEvents': None, 'TimerEventsSchedule': None}]
2022-01-13 21:00:23 DEBUG (MainThread) [custom_components.sector] Finished fetching sector_api data in 4.028 seconds (success: True)


# Execute the actual automated arm after the 30 second delay
# Seems that status returned has correct changed_by and status. 
2022-01-13 21:00:32 INFO (MainThread) [homeassistant.components.automation.auto_arm_alarm] Auto Arm Alarm: Executing step call service
2022-01-13 21:00:34 DEBUG (MainThread) [custom_components.sector] Info retrieved successfully URL: https://mypagesapi.sectoralarm.net/api/Panel/PartialArm
2022-01-13 21:00:34 DEBUG (MainThread) [custom_components.sector] request status: 204
2022-01-13 21:00:34 DEBUG (MainThread) [custom_components.sector] self._last_updated_temp = 2022-01-13 19:59:15.004026
2022-01-13 21:00:34 DEBUG (MainThread) [custom_components.sector] self._timesync * 5 = 300
2022-01-13 21:00:34 DEBUG (MainThread) [custom_components.sector] Evaluate should temp sensors update 0:01:19.378687
2022-01-13 21:00:39 DEBUG (MainThread) [custom_components.sector] Info retrieved successfully URL: https://mypagesapi.sectoralarm.net/api/Panel/GetPanelStatus?panelId=xxxxxx
2022-01-13 21:00:39 DEBUG (MainThread) [custom_components.sector] request status: 200
2022-01-13 21:00:39 DEBUG (MainThread) [custom_components.sector] self._alarmstatus = 2
2022-01-13 21:00:39 DEBUG (MainThread) [custom_components.sector] Full output panelstatus: {'IsOnline': True, 'StatusTime': '2022-01-13T21:00:34.333', 'Status': 2, 'AnnexStatus': 0}
2022-01-13 21:00:40 DEBUG (MainThread) [custom_components.sector] Info retrieved successfully URL: https://mypagesapi.sectoralarm.net/api/Panel/GetLogs?panelId=xxxxxx
2022-01-13 21:00:40 DEBUG (MainThread) [custom_components.sector] request status: 200
2022-01-13 21:00:40 DEBUG (MainThread) [custom_components.sector] self._changed_by = home
2022-01-13 21:00:42 DEBUG (MainThread) [custom_components.sector] Info retrieved successfully URL: https://mypagesapi.sectoralarm.net/api/Panel/GetSmartplugStatus?panelId=xxxxxx
2022-01-13 21:00:42 DEBUG (MainThread) [custom_components.sector] request status: 200
2022-01-13 21:00:42 DEBUG (MainThread) [custom_components.sector] self._switchdata = [{'Consumption': '-1', 'DisplayScenarios': False, 'Id': 'xxxxxxx', 'Label': 'Smtplg 1', 'PanelId': None, 'SerialNo': '251000F780E', 'Scenarios': None, 'Status': 'Unreachable', 'TimerActive': False, 'TimerEvents': None, 'TimerEventsSchedule': None}]

# First state change automation triggered
2022-01-13 21:00:42 INFO (MainThread) [homeassistant.components.automation.alarm_state_change] Alarm State Change: Running automation actions
2022-01-13 21:00:42 INFO (MainThread) [homeassistant.components.automation.alarm_state_change] Alarm State Change: Executing step call service

# 1 minute later update, I don't spot any difference. change_by and status still the same.
2022-01-13 21:01:23 DEBUG (MainThread) [custom_components.sector] UPDATE_INTERVAL = {60}
2022-01-13 21:01:23 DEBUG (MainThread) [custom_components.sector] last updated = 2022-01-13 20:01:23.001721
2022-01-13 21:01:23 DEBUG (MainThread) [custom_components.sector] self._last_updated_temp = 2022-01-13 19:59:15.004026
2022-01-13 21:01:23 DEBUG (MainThread) [custom_components.sector] self._timesync * 5 = 300
2022-01-13 21:01:23 DEBUG (MainThread) [custom_components.sector] Evaluate should temp sensors update 0:02:07.998592
2022-01-13 21:01:24 DEBUG (MainThread) [custom_components.sector] Info retrieved successfully URL: https://mypagesapi.sectoralarm.net/api/Panel/GetPanelStatus?panelId=xxxxxx
2022-01-13 21:01:24 DEBUG (MainThread) [custom_components.sector] request status: 200
2022-01-13 21:01:24 DEBUG (MainThread) [custom_components.sector] self._alarmstatus = 2
2022-01-13 21:01:24 DEBUG (MainThread) [custom_components.sector] Full output panelstatus: {'IsOnline': True, 'StatusTime': '2022-01-13T21:00:34.333', 'Status': 2, 'AnnexStatus': 0}
2022-01-13 21:01:24 DEBUG (MainThread) [custom_components.sector] Info retrieved successfully URL: https://mypagesapi.sectoralarm.net/api/Panel/GetLogs?panelId=xxxxxx
2022-01-13 21:01:24 DEBUG (MainThread) [custom_components.sector] request status: 200
2022-01-13 21:01:24 DEBUG (MainThread) [custom_components.sector] self._changed_by = home
2022-01-13 21:01:27 DEBUG (MainThread) [custom_components.sector] Info retrieved successfully URL: https://mypagesapi.sectoralarm.net/api/Panel/GetSmartplugStatus?panelId=xxxxxx
2022-01-13 21:01:27 DEBUG (MainThread) [custom_components.sector] request status: 200
2022-01-13 21:01:27 DEBUG (MainThread) [custom_components.sector] self._switchdata = [{'Consumption': '-1', 'DisplayScenarios': False, 'Id': 'xxxxxxx', 'Label': 'Smtplg 1', 'PanelId': None, 'SerialNo': '251000F780E', 'Scenarios': None, 'Status': 'Unreachable', 'TimerActive': False, 'TimerEvents': None, 'TimerEventsSchedule': None}]
2022-01-13 21:01:27 DEBUG (MainThread) [custom_components.sector] Finished fetching sector_api data in 4.561 seconds (success: True)

# Second state change automation triggered
2022-01-13 21:01:27 INFO (MainThread) [homeassistant.components.automation.alarm_state_change] Alarm State Change: Running automation actions
2022-01-13 21:01:27 INFO (MainThread) [homeassistant.components.automation.alarm_state_change] Alarm State Change: Executing step call service

image

Sector alarm Norway

I haven't tried but is there any reason this would not work for Sector alarm in Norway?

Reconfigure pincode not possible

I want to change the pin code, seems the only option is to delete and recreate the integration. Perhaps can add more options in the configure

0.1.8 release broken?

I'm not exactly sure how HACS picks up files etc but the release zip does not contain the code for unique IDs for example and the code that get's deployed to my HA (by HACS) does not either. I think it might not have the latest files in it (because I can see them in the repo.

Home Assistant warning: Entity alarm_control_panel.sector implements device_state_attributes

I'm getting this warning in my Home Assistant log:

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:549
First occurred: January 8, 2022, 17:57:13 (5 occurrences)
Last logged: January 8, 2022, 17:57:13

Entity alarm_control_panel.sector (<class 'custom_components.sector.alarm_control_panel.SectorAlarmPanel'>) implements device_state_attributes. Please report it to the custom component author.
Entity sensor.sector_living_room_temperature (<class 'custom_components.sector.sensor.SectorAlarmTemperatureSensor'>) implements device_state_attributes. Please report it to the custom component author.

Couldn't see another bug for it, so I thought it should be reported.

Home Assistant Core: 2021.12.8
Sector Alarm custom component version: 0.3.3

Breaks app funcionality?

It seems this integration breaks funcionality of Sectors app. If I log in to the integration push notifications stop working, and the history in the app stops working properly.
Anyone else having issues?

Getting false armed home/disarmed triggers

Since a while back (don't know for how long though) I get false armed home or disarm triggers. There is no actual arming or disarming of the alarm system (the log in the Sector Alarm app is clean). I don't see anything strange in the logs in HA either.

lock.lock and lock.unlock no longer working

This worked a couple of weeks ago (doorman v2), but now it no longer works.
- type: glance
#(...)
entities:
- entity: lock.ytterdor
name: Ytterdør
tap_action:
action: call-service
service: lock.lock
service_data:
entity_id: lock.ytterdor
code: !secret sector_code

Temps removed or am I blocked?

Today the temp sensors in my cameras went unavailable. I went to the app and "my pages" and saw that they are no longer showing up at all.

If it works for others I probably got blocked and got it removed by Sector. I had 180 secs polling time the last few months without problem until today.

So before contacting Sector I am asking if it works for others or if the feature has been removed for everyone or just me.

Small bug when removing integration; Tries to unload locks even if you don't have any locks

Hi

I'm testing v0.2.0-beta3 and noticed this small bug / unnecessary error when removing the integration.
The integration tries to unload locks even if you didn't have any locks configured, so it generates some unnecessary error messages in the core log:

2020-11-05 10:26:33 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry sa_XXXXXXXX for lock
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 319, in async_unload
    result = await component.async_unload_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/lock/__init__.py", line 75, in async_unload_entry
    return await hass.data[DOMAIN].async_unload_entry(entry)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 172, in async_unload_entry
    raise ValueError("Config entry was never loaded!")
ValueError: Config entry was never loaded!

No status update after upgrading to 0.34

After upgrading to 0.34 status update/feedback in HA stops working.
I can activate the alarm and lock the door from HA but I get no feedback/status update. The alarm looks like it's off and the door is marked as unlocked even though it's locked.
After downgrading to 0.33 everything works fine again.
I've upgraded to HA 2021.12 but no change in behaviour.

Account with many alarmsystems

I have 2 alarm systems on my app.

After a restart of HACS and home assistant, the Sector Alarm software changed to another alarm system.

So when trying to manage my house alarm, it switched on my restaurant alarm, really waking up my staff in the middle of their shift.

How do I choose which alarm system is accessible in this software?

Exception "Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8" thrown during startup

When I start Home Assistant I get this message from the Sector custom component (installed via HACS), and all entities are unavailable.

I noticed that the web UI and the app is also unable to login, so I think there might be an outage on Sector's side, but I think the component should handle this exception somewhat more gracefully, hopefully with a delayed setup and an exponential backoff retry timer.

Sector component version: 0.1.9

2020-08-15 18:01:42 ERROR (MainThread) [homeassistant.setup] Error during setup of component sector
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 191, in _async_setup_component
    result = await task
  File "/config/custom_components/sector/__init__.py", line 77, in async_setup
    data_out = await response.json()
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 1026, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://mypagesapi.sectoralarm.net/api/Login/Login')

Support for numeric code format

Hi!

I use the alarm control panel card (as I assume many others?), which works, but I never got the numeric keyboard, only an input which when in focus gives me the standard keyboard (not great for inputting numbers). Is anybody else seeing this problem?

Looking at the source code for the card (https://github.com/home-assistant/frontend/blob/dev/src/panels/lovelace/cards/hui-alarm-panel-card.ts), it looks at the code_format property of the panel, if it's FORMAT_NUMBER (as defined in the alarm_control_panel platform(?)), it will display the numeric pad, otherwise not. For me: not. A bit of digging in the sector code told me that this property value is being set, but I can't quite make out how.

To my knowledge, the code can't be anything but numeric in Sector, so at least having the option to hard-set this myself to numeric or have the integration do this directly would be awesome. It would make the useability of the integration even better.

Or, this could of course be SBS (skit bakom styret) and it's my own error altogether. Cheers/Måns

Documentation

Hi,

Ones again the wrong way to communicate :-) Is there a way to ask questions etc on github?

My question is where/if I can find the documentation or more specifically is there any way for me to know who has turned off the alarm or even better unlocked the door?

Enforce code entry?

Hey,

I just installed this and it works wonderfully! With the kids in bed I don't want to try, but would you have to enter the code prior to arm or does it arm by a single press?

Would I enforce code entry for arming and lock/unlock by leaving the code blank in config?

Integration overusing API?

Hi, thanks for the great integration! Given the level of support from SA, it's amazing we can do as much as we can with the SA/HA combo.

In the logs I can see that the integration is calling the SA "apis" roughly once a minute or more. There are also plenty warnings that sensor updates are taking too long etc. I have in the past had my SA account locked due to the integration calling too many times - within some given time slot I presume. SA is from what I understand known for not being super generous with their APIs.

What is being done to throttle API calls in the integration under various circumstances? Is this a problem for more people than me? My Python (and knowledge of Python libraries/apis) is not quite good enough to be able to understand this from the code. There are high level helpers built into HA that seem to help address such issues (https://developers.home-assistant.io/docs/integration_fetching_data).

Thoughts?

Make component show up in Integration list, with configuration UI

This integration is looking really good, especially being based on what seems to be(?) an SA API. Great work!

It would be great to have the integration and configuration show up in the integrations UI. From what I can gather this is mainly a manifest issue. I have forked the project and will take a peek at this. Who knows, a PR might be forthcoming? It's my first time developing an HA component (although I have 35 odd years of experience in programming), so plz have patience :)

Alarm state notifications fire constantly

Overview

  • Seems like data from sector is not reliably set in the state
  • At some random point it is correctly set resulting in wrong automations triggered
  • Wrong data used in notifications (eg: User A turned off the alarm, when actually it was User B)
  • Seems like the data in sector API is correct (according to my expectations at least)

Details / debugging

I've set up an automation to notify when the state changes and it fires constantly without any state changes. It works correctly when state does change, but through the day there can be 0-{n} extra updates due to nothing. This makes it impossible to use as a reliable indication of the alarm state change.

Automations

Auto enable at 21:00

  - id: auto-arm-alarm
    alias: Auto Arm Alarm
    trigger:
      platform: time
      at: "21:00:00"
    action:
      - service: alarm_control_panel.alarm_arm_home
        entity_id: alarm_control_panel.sector_alarmpanel_XXXXXXX

Notify on state change

automation:
  - alias: Alarm State Change
    id: alarm-state-change
    initial_state: true
    trigger:
      platform: state
      entity_id: alarm_control_panel.sector_alarmpanel_XXXXXXX
    action:
      - service: notify.ios_devices
        data:
          title: "Alarm Notification"
          message: ".... whatever ...."

Logs

So added some debugs in the code and I see this when the rogue notification is sent:

Initial normal update

_alarmstatus is constant, but watch _changed_by

2021-12-26 14:31:55 DEBUG (MainThread) [custom_components.sector] Info retrieved successfully URL: https://mypagesapi.sectoralarm.net/api/Panel/GetPanelStatus?panelId=xxxxx
2021-12-26 14:31:55 DEBUG (MainThread) [custom_components.sector] request status: 200
2021-12-26 14:31:55 DEBUG (MainThread) [custom_components.sector] OLD self._alarmstatus = 1
2021-12-26 14:31:55 DEBUG (MainThread) [custom_components.sector] self._alarmstatus = 1
2021-12-26 14:31:55 DEBUG (MainThread) [custom_components.sector] Info retrieved successfully URL: https://mypagesapi.sectoralarm.net/api/Panel/GetLogs?panelId=xxxxxx
2021-12-26 14:31:55 DEBUG (MainThread) [custom_components.sector] request status: 200
2021-12-26 14:31:55 DEBUG (MainThread) [custom_components.sector] self._changed_by = home
2021-12-26 14:31:55 DEBUG (MainThread) [custom_components.sector] Finished fetching sector_api data in 1.833 seconds (success: True)

Timeout error?

(why does it say "successful" if there was a timeout).

2021-12-26 14:33:10 ERROR (MainThread) [custom_components.sector] Timed out when connecting to Sector
2021-12-26 14:33:10 DEBUG (MainThread) [custom_components.sector] Info retrieved successfully URL: https://mypagesapi.sectoralarm.net/api/Panel/GetLogs?panelId=xxxxxxx
2021-12-26 14:33:10 DEBUG (MainThread) [custom_components.sector] request status: 200
2021-12-26 14:33:10 DEBUG (MainThread) [custom_components.sector] self._changed_by = home

Rogue update triggered by the next request

I'm assuming something happened due to the last timeout but now the _changed_by has changed.

2021-12-26 14:34:14 DEBUG (MainThread) [custom_components.sector] Info retrieved successfully URL: https://mypagesapi.sectoralarm.net/api/Panel/GetPanelStatus?panelId=xxxx
2021-12-26 14:34:14 DEBUG (MainThread) [custom_components.sector] request status: 200
2021-12-26 14:34:14 DEBUG (MainThread) [custom_components.sector] OLD self._alarmstatus = 1
2021-12-26 14:34:14 DEBUG (MainThread) [custom_components.sector] self._alarmstatus = 1
2021-12-26 14:34:14 DEBUG (MainThread) [custom_components.sector] Info retrieved successfully URL: https://mypagesapi.sectoralarm.net/api/Panel/GetLogs?panelId=xxxx
2021-12-26 14:34:14 DEBUG (MainThread) [custom_components.sector] request status: 200
2021-12-26 14:34:14 DEBUG (MainThread) [custom_components.sector] self._changed_by = Annie
2021-12-26 14:34:14 DEBUG (MainThread) [custom_components.sector] Finished fetching sector_api data in 4.676 seconds (success: True)

Looking at the logs from GetPanelHistory endpoint the following is two latest events:

0: {Time: '2021-12-26T10:05:51', EventType: 'disarmed', User: 'Annie', Channel: '', LockName: ''}
1: {Time: '2021-12-25T21:00:22', EventType: 'partialarmed', User: 'home', Channel: 'App', LockName: ''}

Last night it was set partial armed by automation at 21:00, this morning disabled by Annie at 10:05. Yet all the logs show the user who last changed was home (this is the user I set up for HA that did arm the system). Then somehow at 14:34 (~4 hours later) it gets the right user (Annie) has changed resulting in a notification.

Note to self for debugging I used this in the browser:

await fetch('https://momentjs.com/downloads/moment.min.js')
    .then(response => response.text())
    .then(text => eval(text))
a = await fetch('https://minasidor.sectoralarm.se/Panel/GetPanelHistory/xxxxx')
b = await a.json()
c = b.LogDetails.map(a => ({...a, Time: moment(a.Time).format()}))

Not able to find it in Integrations when using Norwegian language

After installing using HACS I was not able to add it from the list of integrations because it didn't show up.
But when I changed to English language I could see it in the integration list.
I have seen examples of this 'no' for Norway create problems with other things before.
It was no problem changing back to Norwegian language after setting up the integration.

Error after each home assistant restart

Since upgrading to HA 2022.4.X I have to remove the Sector integration and reinstall after each HA restart.

All units and entities get unavailable and the log reports the following errors:

2022-04-15 11:19:16 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration sector which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2022-04-15 11:19:49 ERROR (MainThread) [custom_components.sector] Timed out when connecting to Sector 2022-04-15 11:19:49 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry sa_02559614 for sector File "/config/custom_components/sector/__init__.py", line 138, in async_setup_entry File "/config/custom_components/sector/__init__.py", line 534, in alarm_id 2022-04-15 11:19:50 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up sector platform for sensor File "/config/custom_components/sector/sensor.py", line 41, in async_setup_entry 2022-04-15 11:19:51 ERROR (MainThread) [homeassistant.components.alarm_control_panel] Error while setting up sector platform for alarm_control_panel File "/config/custom_components/sector/alarm_control_panel.py", line 43, in async_setup_entry async_add_entities([SectorAlarmPanel(sector_hub, coordinator, code)]) File "/config/custom_components/sector/alarm_control_panel.py", line 56, in __init__ File "/config/custom_components/sector/__init__.py", line 539, in alarm_displayname

Sorry but not an issue, more lack of knowledge

I have been trying back and forth to get a notification when alarm is in home mode (skalskydd)... I'm trying to turn on a light when the alarm is armed but I don't get any triggers?

  • id: 'xxx'
    alias: Skalskydd
    description: Skalskyddet är påslaget
    trigger:
    • platform: state
      entity_id: alarm_control_panel.sector_alarmpanel_02648684
      to: 'on'
      condition: []
      action:
    • service: notify.notify
      data:
      message: bla bla
      title: bla bla bla
      mode: single

Also tried this:

  • id: 'xxx'
    alias: Skalskydd
    description: Skalskyddet är påslaget
    trigger:
    • platform: state
      device_id: c878c1b63ac577ea1f6377951e8ee0c2
      domain: alarm_control_panel
      entity_id: alarm_control_panel.sector_alarmpanel_02648684
      type: armed_home
      condition: []
      action:
    • service: notify.notify
      data:
      message: bla bla
      title: bla bla bla
      mode: single

Switch beta 0.3.4 beta 3

Tested the beta 0.3.4 beta 3
Removed old Sector component and redownloaded the new. In integartion this is shown.
image

From CORE Logs

2021-12-04 17:44:52 ERROR (MainThread) [custom_components.sector] Unexpected error fetching sector_api data: 'Serial'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 147, in _async_update_data
return await self.update_method()
File "/config/custom_components/sector/init.py", line 112, in async_update_data
await api.fetch_info()
File "/config/custom_components/sector/init.py", line 396, in fetch_info
self._switchstatus = {
File "/config/custom_components/sector/init.py", line 397, in
switch["Serial"]: switch["Status"] for switch in self._switchdata
KeyError: 'Serial'
2021-12-04 17:45:12 ERROR (MainThread) [custom_components.sector] Unexpected error fetching sector_api data: 'Serial'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 147, in _async_update_data
return await self.update_method()
File "/config/custom_components/sector/init.py", line 112, in async_update_data
await api.fetch_info()
File "/config/custom_components/sector/init.py", line 396, in fetch_info
self._switchstatus = {
File "/config/custom_components/sector/init.py", line 397, in
switch["Serial"]: switch["Status"] for switch in self._switchdata
KeyError: 'Serial'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.