Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two alarm system on same email/login account #152

Closed
baunan opened this issue May 23, 2023 · 2 comments · Fixed by #167
Closed

Two alarm system on same email/login account #152

baunan opened this issue May 23, 2023 · 2 comments · Fixed by #167

Comments

@baunan
Copy link
Contributor

baunan commented May 23, 2023

Describe the bug
I have two alarm system both linked to the same email/login account, but only one of them are shown in the add-in.

Version
0.3.9

Expected behavior
Expect that both alarm system to be shown

Additional context
Using a python script and the sectoralarm library the alarmsystem is reachable when targeting it specific ID.

@baunan
Copy link
Contributor Author

baunan commented Nov 4, 2023

Any updates on thisone? I have two alarm system linked to the user id and this addon only pickup one of them and unfortunalty for me the wrong one. The Python script I used, doesn't work anymore, but this add-on does, but is targeting the wrong alarm system. What do I need to lock this addon to a specific alarm id?

From what I can see from the log, the command Request with get: https://mypagesapi.sectoralarm.net/api/account/GetPanelList list both alarm systems. But the sensors for the first one (the one with the lowest ID number) is not generated.

@baunan
Copy link
Contributor Author

baunan commented Nov 12, 2023

Based on the log debug print, it turns out that the data variable is not updated correctly when it loops through the alarm systems. Only the last alarm system data is added.

        for panel in response_panellist:
            data: dict[str, Any] = {panel["PanelId"]: {}}
            data[panel["PanelId"]]["name"] = panel["DisplayName"]
            data[panel["PanelId"]]["id"] = panel["PanelId"]
            data[panel["PanelId"]]["alarmstatus"] = 0

I am rusty in programming, but I changed it so that the data dictonary is update when it goes through the pannellist loop and now both of my alarms systems are being seen,

data2 = {}
for panel in response_panellist:
    data1: dict[str, Any] = {panel["PanelId"]: {}}
    data1[panel["PanelId"]]["name"] = panel["DisplayName"]
    data1[panel["PanelId"]]["id"] = panel["PanelId"]
    data1[panel["PanelId"]]["alarmstatus"] = 0
 
    data2.update(data1.copy())
    data: dict[str, Any] = data2 

@gjohansson-ST gjohansson-ST linked a pull request Nov 12, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant