econnect-python

API adapter used to control programmatically an Elmo alarm system

https://github.com/palazzem/econnect-python

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.1%) to scientific vocabulary

Keywords

alarm-system econnect home-automation python python3
Last synced: 6 months ago · JSON representation

Repository

API adapter used to control programmatically an Elmo alarm system

Basic Info
  • Host: GitHub
  • Owner: palazzem
  • License: bsd-3-clause
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 330 KB
Statistics
  • Stars: 9
  • Watchers: 5
  • Forks: 4
  • Open Issues: 4
  • Releases: 17
Topics
alarm-system econnect home-automation python python3
Created about 7 years ago · Last pushed 10 months ago
Metadata Files
Readme Contributing License

README.md

E-connect Python API

Testing Linting Building Coverage Status PyPI version

econnect-python is an API adapter used to control programmatically an Elmo-like alarm system. Through a generic configuration, the client allows:

  • Retrieving access tokens to make API calls
  • Obtaining/releasing the system Lock() to have exclusive control of the system
  • Arm/disarm all the alarms registered in the system
  • Query the system and get the status of your sectors and inputs

Requirements

  • Python 3.8+
  • requests

Supported Systems

This package targets Elmo-like alarm systems. The following systems are known to work: - Elmo e-Connect - IESS Metronet

Getting Started

This package is available on PyPI:

bash $ pip install econnect-python

Usage

```python from elmo import query from elmo.api.client import ElmoClient

Initialize a new client to authenticate your connection

and retrieve an access token used for the entire session.

client = ElmoClient() client.auth("username", "password")

To arm/disarm the system you must gain the exclusive Lock()

with client.lock("secret-code") as c: c.arm() # Arm all alarms c.disarm() # Disarm all alarms c.arm(sectors=[3, 4]) # Arm only sectors 3 and 4 c.disarm(sectors=3) # Disarm only sector 3

Query the system

sectors = client.query(query.SECTORS) inputs = client.query(query.INPUTS) ```

The access token is valid for 10 minutes, after which, you need to authenticate again to refresh the token. Obtaining the lock via client.lock("secret-code") is mandatory to arm or disarm the system, otherwise the API returns 403. secret-code is the numeric code you use to arm/disarm the system from the alarm panel.

Once the lock is obtained, other clients cannot connect to the alarm system and only a manual override on the terminal is allowed. Outside the context manager, the lock is automatically released.

Connecting to Systems

By default, the ElmoClient constructor will automatically connect to the Elmo e-Connect system. However, if you need to connect to a different system, the systems module provides a list of available alarm systems for you to choose from.

Here's how you can use it:

```python from elmo.api.client import ElmoClient from elmo.systems import ELMOECONNECT, IESS_METRONET

Connect to the default Elmo e-Connect system

client = ElmoClient()

Explicitly connect to the Elmo e-Connect system

client = ElmoClient(baseurl=ELMOE_CONNECT)

Connect to the IESS Metronet system

client = ElmoClient(baseurl=IESSMETRONET) ```

Note: The default constructor (with no parameters) remains unchanged to ensure backward compatibility and performs identically to the explicit call with ELMO_E_CONNECT.

Custom URLs

If https://connect.elmospa.com or https://metronet.iessonline.com are your authentication pages, no configuration is needed and you can skip this section.

On the other hand, if your authentication page is something similar to https://connect3.elmospa.com/nwd, you must configure your client as follows:

```python from elmo.api.client import ElmoClient

Override the default URL and domain

client = ElmoClient(base_url="https://connect3.elmospa.com", domain="nwd") client.auth("username", "password") ```

If your base_url or domain are not properly set, your credentials will not work and you will get a 403 Client Error as your username and password are not correct.

Contributing

We are very open to the community's contributions - be it a quick fix of a typo, or a completely new feature! You don't need to be a Python expert to provide meaningful improvements. To learn how to get started, check out our Contributor Guidelines first, and ask for help in our Discord channel if you have questions.

Development

We welcome external contributions, even though the project was initially intended for personal use. If you think some parts could be exposed with a more generic interface, please open a GitHub issue to discuss your suggestion.

Dev Environment

To create a virtual environment and install the project and its dependencies, execute the following commands in your terminal:

```bash

Create and activate a new virtual environment

python3 -m venv venv source venv/bin/activate

Upgrade pip and install all projects and their dependencies

pip install --upgrade pip pip install -e '.[all]'

Install pre-commit hooks

pre-commit install ```

Coding Guidelines

To maintain a consistent codebase, we utilize flake8 and black. Consistency is crucial as it helps readability, reduces errors, and facilitates collaboration among developers.

To ensure that every commit adheres to our coding standards, we've integrated pre-commit hooks. These hooks automatically run flake8 and black before each commit, ensuring that all code changes are automatically checked and formatted.

For details on how to set up your development environment to make use of these hooks, please refer to the Development section of our documentation.

Testing

Ensuring the robustness and reliability of our code is paramount. Therefore, all contributions must include at least one test to verify the intended behavior.

To run tests locally, execute the test suite using pytest with the following command: bash pytest tests/ --cov --cov-branch -vv

For a comprehensive test that mirrors the Continuous Integration (CI) environment across all supported Python versions, use tox: bash tox

Note: To use tox effectively, ensure you have all the necessary Python versions installed. If any versions are missing, tox will provide relevant warnings.

Owner

  • Name: Emanuele Palazzetti
  • Login: palazzem
  • Kind: user
  • Location: Paris, France
  • Company: Former Director of Engineering @Datadog

Coding Python and Go. Former Director of Engineering @DataDog | Code is not software until it's deployed.

GitHub Events

Total
  • Create event: 15
  • Release event: 5
  • Issues event: 6
  • Watch event: 1
  • Delete event: 16
  • Issue comment event: 13
  • Push event: 20
  • Pull request event: 22
Last Year
  • Create event: 15
  • Release event: 5
  • Issues event: 6
  • Watch event: 1
  • Delete event: 16
  • Issue comment event: 13
  • Push event: 20
  • Pull request event: 22

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 232
  • Total Committers: 7
  • Avg Commits per committer: 33.143
  • Development Distribution Score (DDS): 0.409
Past Year
  • Commits: 57
  • Committers: 2
  • Avg Commits per committer: 28.5
  • Development Distribution Score (DDS): 0.07
Top Committers
Name Email Commits
Emanuele Palazzetti e****i@g****m 137
Emanuele Palazzetti h****o@p****e 75
Emanuele Palazzetti e****i@d****m 7
Alessandro Manighetti 7****x 4
Alberto a****6@g****m 4
Emanuele Palazzetti m****u@d****m 3
Davide Cavestro d****o@g****m 2
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 61
  • Total pull requests: 106
  • Average time to close issues: 3 months
  • Average time to close pull requests: 8 days
  • Total issue authors: 4
  • Total pull request authors: 5
  • Average comments per issue: 1.13
  • Average comments per pull request: 0.73
  • Merged pull requests: 102
  • Bot issues: 0
  • Bot pull requests: 3
Past Year
  • Issues: 2
  • Pull requests: 12
  • Average time to close issues: about 8 hours
  • Average time to close pull requests: 5 minutes
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.5
  • Average comments per pull request: 1.08
  • Merged pull requests: 12
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • palazzem (52)
  • eliciogiuseppe (3)
  • davidecavestro (2)
  • xtimmy86x (2)
Pull Request Authors
  • palazzem (114)
  • xtimmy86x (7)
  • dependabot[bot] (3)
  • markin (1)
  • davidecavestro (1)
Top Labels
Issue Labels
type:feature (18) topic:client (10) component/api (8) topic:api (8) component/client (7) topic:ha-integration (7) kind/enhancement (6) type:bug (6) type:refactor (6) dev/tooling (4) breaking change (3) documentation (3) topic:packaging (3) kind/feature-request (3) kind/feature (2) dev/testing (2) topic:tests (2) topic:tools (2) kind/bug (2) type:docs (1)
Pull Request Labels
type:feature (37) topic:packaging (30) kind/enhancement (26) component/client (26) topic:api (24) type:fix (23) topic:client (19) breaking change (11) topic:tools (10) dev/testing (10) kind/feature (5) type:refactor (5) dev/tooling (4) component/api (4) topic:tests (4) documentation (3) type:bug (3) dependencies (2) community (2) type:docs (1) topic:ha-integration (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 698 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 36
  • Total maintainers: 1
pypi.org: econnect-python

API adapter used to control programmatically an Elmo alarm system

  • Versions: 36
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 698 Last month
Rankings
Dependent packages count: 10.0%
Downloads: 10.4%
Forks count: 15.3%
Average: 15.3%
Stargazers count: 19.3%
Dependent repos count: 21.7%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/building.yaml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/linting.yaml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/testing.yaml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • coverallsapp/github-action v2 composite
pyproject.toml pypi
  • requests [security]