palazzem / econnect-python

API adapter used to control programmatically an Elmo alarm system
BSD 3-Clause "New" or "Revised" License
8 stars 5 forks source link

Expose an API to retrieve the global state of the alarm system #115

Closed palazzem closed 1 year ago

palazzem commented 1 year ago

Is your feature request related to a problem? Please describe.

ElmoClient retrieves the state of all inputs and sectors. Furthermore, it can arm/disarm a combination of sectors. What is missing is retrieving the state to understand if:

Describe the solution you'd like

Expose an API to get the global state so that the results can be exposed to home automation integrations (e.g. as a binary_sensor.

Describe alternatives you've considered

The external integration may map some inputs to identify them as "the alarm is triggered if these are on". But that's suboptimal and forces users to do extra configuration that may not be trivial.

Additional context

n/a

palazzem commented 1 year ago

The API (url: https://connect.elmospa.com/api/statusadv) exposes the following values:

    "PanelAnomalies": {
        "HasAnomaly": false,
        "PanelTamper": 0,
        "PanelNoPower": 0,
        "PanelLowBattery": 0,
        "GsmAnomaly": 0,
        "GsmLowBalance": 0,
        "PstnAnomaly": 0,
        "SystemTest": 0,
        "ModuleRegistration": 0,
        "RfInterference": 0,
        "InputFailure": 0,
        "InputAlarm": 0,
        "InputBypass": 0,
        "InputLowBattery": 0,
        "InputNoSupervision": 0,
        "DeviceTamper": 0,
        "DeviceFailure": 0,
        "DeviceNoPower": 0,
        "DeviceLowBattery": 0,
        "DeviceNoSupervision": 0,
        "DeviceSystemBlock": 0
    },
    "PanelLeds": {
        "InputsLed": 2,
        "AnomaliesLed": 1,
        "AlarmLed": 0,
        "TamperLed": 0
    },

We may try to mock this response and see how the API behaves.

palazzem commented 1 year ago

Altering these values, triggers the UI to show that there are alarms. We need to make a change and collect this new API. The API collection must triggered when there is an update using the poll() API.