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

feat: add client.query(q.PANEL) API to retrieve panel details #140

Merged
merged 4 commits into from
Feb 2, 2024

Conversation

palazzem
Copy link
Owner

@palazzem palazzem commented Feb 2, 2024

Related Issues

Proposed Changes:

This PR introduces two changes:

  1. When calling client.auth() (/api/login), the client stores the response that includes the panel details
  2. client.query(q.PANEL) returns the panel details response that is cached after the first call

Query Example

client.query(q.PANEL)

# Returns
{
    "last_id": 0,
    "panel": {
        "description": "T-800 1.0.1",
        "last_connection": "01/01/1984 13:27:28",
        "last_disconnection": "01/10/1984 13:27:18",
        "major": 1,
        "minor": 0,
        "source_ip": "10.0.0.1",
        "connection_type": "EthernetWiFi",
        "device_class": 92,
        "revision": 1,
        "build": 1,
        "brand": 0,
        "language": 0,
        "areas": 4,
        "sectors_per_area": 4,
        "total_sectors": 16,
        "inputs": 24,
        "outputs": 24,
        "operators": 64,
        "sectors_in_use": [
            True,
            True,
            True,
            True,
            False,
            False,
            False,
            False,
            False,
            False,
            False,
            False,
            False,
            False,
            False,
            False,
        ],
        "model": "T-800",
        "login_without_user_id": True,
        "additional_info_supported": 1,
        "is_fire_panel": False,
    },
}

Testing:

Authenticate the client and call the query method:

client.auth("username", "password")
client.query(q.PANEL)

Extra Notes (optional):

n/a

Checklist

  • Related issues and proposed changes are filled
  • Tests are defining the correct and expected behavior
  • Code is well-documented via docstrings

@coveralls
Copy link

Pull Request Test Coverage Report for Build 7758244806

  • 0 of 7 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 7746013940: 0.0%
Covered Lines: 381
Relevant Lines: 381

💛 - Coveralls

@palazzem palazzem merged commit c694e31 into main Feb 2, 2024
4 checks passed
@palazzem palazzem deleted the palazzem/feature-139 branch February 2, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Store panel details when calling /api/login API
2 participants