gjohansson-ST / sector

Integration to Sector Alarm for Home Assistant
37 stars 18 forks source link

Account with many alarmsystems #24

Closed MrJinxed55 closed 2 years ago

MrJinxed55 commented 3 years ago

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?

gjohansson-ST commented 3 years ago

Do you know how to run a python file to provide me with the required output?

marcfager commented 2 years ago

Hi, just add ?panelid=123456 (where 123456 would be the correct system id that can be found by logging in with a browser). I.e. https://mypagesapi.sectoralarm.net/api/panel/getFullSystem?panelid=123456

gjohansson-ST commented 2 years ago

Hi, just add ?panelid=123456 (where 123456 would be the correct system id that can be found by logging in with a browser). I.e. https://mypagesapi.sectoralarm.net/api/panel/getFullSystem?panelid=123456

Does it say somewhere on the sector website or does someone need to fish in the code to get hold of it?

marcfager commented 2 years ago

Hi, just add ?panelid=123456 (where 123456 would be the correct system id that can be found by logging in with a browser). I.e. https://mypagesapi.sectoralarm.net/api/panel/getFullSystem?panelid=123456

Does it say somewhere on the sector website or does someone need to fish in the code to get hold of it?

Hi, I haven't found any documentation of the API Sector provides. I checked your code and few other implementations online and studied the raw response from the API. As the "filter" item of interest was named panelid, I tried to add that to the request string and it was successful. As a quick fix, I added it statically to the custom_component you have created, as the integration otherwise defaults to a different system. Not a good solution but it works until the component is updated.

For a quick implementation I think adding the panel id to the config as non-mandatory (and to the API request url, if panel id is not empty) is sufficient. The ideal implementation would probably be to find out how to list all available panel id:s from the API, and populating entries according to this. However, I think the work needed is significant compared to the first option. Also, as multiple requests are anyway needed (one for each system), I think multiple instances of the same custom_component with the first option will work flawlessly.

gjohansson-ST commented 2 years ago

I would agree it seems easiest to make a non-mandatory option to use it but my question was mainly for a user how does he know his panel id. Is that on the sector website so it's possible for a "regular" user to fill it?

marcfager commented 2 years ago

Sorry, I misunderstood your question. Yes, it can be found without any special tools as per below:

  1. Log in to https://mypagesapi.sectoralarm.net/
  2. You are greeted by a list of the alarm systems you have. Hover with the pointer on the interesting one(s).
  3. Check the URL for the numbers in the end. I.e. if the link is "https://mypagesapi.sectoralarm.net/#!/systems/12345678" your panel id is 12345678.
gjohansson-ST commented 2 years ago

Perfect! I will create a beta for it after next release and hope you can try it out for me then. Thanks so far

marcfager commented 2 years ago

I would be happy to do that! Can you write a comment here when the beta is ready? :)

gjohansson-ST commented 2 years ago

Will for sure let you know here when it's ready to test

marcfager commented 2 years ago

Hi, just wanted to follow up if you have had any opportunity to look at this yet? :)

gjohansson-ST commented 2 years ago

Not really unfortunately but let's try to get this sorted now. Could you perhaps run this file and provide me with the output. There is sensitive data in the output so you need to mask to what you feel comfortable with.

Would also help with other issues of course

marcfager commented 2 years ago

Hi,

The code failed at the lock section (the setup does not have any logs). I declared the output variable to be printed just to allow it to run through. I have changed names and serials in the output. I also removed the log section in the end, as it only shows when the unit has been armed&disarmed.


2022-06-08 22:15:13.744864
FULLSYSTEMINFO
{'Panel': {'PartialAvalible': True, 'PanelQuickArm': False, 'PanelCodeLength': 4, 'LockLanguage': 1, 'SupportsApp': True, 'SupportsInterviewServices': True, 'SupportsPanelUsers': True, 'SupportsTemporaryPanelUsers': True, 'SupportsRegisterDevices': True, 'CanAddDoorLock': False, 'CanAddSmartPlug': False, 'HasVideo': False, 'Wifi': {'WifiExist': False, 'Serial': ''}, 'PanelId': '01234567', 'ArmedStatus': 'partialarmed', 'PanelDisplayName': 'SuperSecretPanelName', 'StatusAnnex': 'unknown', 'PanelTime': '2022-06-08T21:43:38', 'AnnexAvalible': False, 'IVDisplayStatus': True, 'DisplayWizard': False, 'BookedStartDate': '0001-01-01T00:00:00', 'BookedEndDate': '0001-01-01T00:00:00', 'InstallationStatus': 3, 'InstallationAddress': None, 'WizardStep': 0, 'AccessGroup': 0, 'SessionExpires': '0001-01-01T00:00:00', 'IsOnline': True}, 'Locks': [], 'Smartplugs': [{'Consumption': None, 'DisplayScenarios': False, 'Id': '2345678', 'Label': 'SmartPlug', 'PanelId': None, 'SerialNo': '12345678901', 'Scenarios': None, 'Status': '', 'TimerActive': False, 'TimerEvents': None, 'TimerEventsSchedule': None}], 'Temperatures': [{'Id': None, 'Label': 'TemperatureLabel', 'SerialNo': '12345678901', 'Temprature': '', 'DeviceId': None}], 'Cameras': [], 'Photos': [], 'Access': ['History', 'Smartplugs']}
2022-06-08 22:15:14.029424
GetPanelStatus
{'IsOnline': True, 'StatusTime': '2022-06-08T21:43:38', 'Status': 2, 'AnnexStatus': 0}
2022-06-08 22:15:18.203378
GetTemperatures
[{'Id': None, 'Label': 'TemperatureLabel', 'SerialNo': '12345678901', 'Temprature': '25', 'DeviceId': None}]
2022-06-08 22:15:20.405684
Funkar inte
GetLockStatus

2022-06-08 22:15:20.724418
GetLogs```