Giter VIP home page Giter VIP logo

eldes's Introduction

hacs_badge

Eldes Alarm

Custom component for Home Assistant. This component is designed to integrate the Eldes security systems including sensors, outputs, etc.

Installation

You have two options for installation:

HACS

  • In the HACS panel, go to integrations and click the big orange '+' button. Search for 'Eldes Alarm' and click 'Download this repository with HACS'.

Manually

  • Copy "eldes_alarm" folder to the "/config/custom_components" folder.
  • Restart HA server.

Usage

Events

Event attributes

  • alarms -> holds events with alarms
  • user_actions -> holds events with user action like arm and disarm
  • events -> holds all other events

Display events

To display events used another integration: lovelace-home-feed-card

Example config for lovelace-home-feed-card

type: custom:home-feed-card
title: Alarm Feed
card_id: main_feed
show_notification_title: true
show_empty: false
scrollbars_enabled: false
show_icons: false
entities:
  - entity: sensor.events
    list_attribute: user_actions
    multiple_items: true
    timestamp_property: event_time
    max_items: 5
    content_template: '{{type}} set by {{name}}'
  - entity: sensor.events
    list_attribute: alarms
    multiple_items: true
    timestamp_property: event_time
    max_items: 2
    content_template: '!!!!! ALARM !!!!! {{message}}'

Screenshot 2022-02-20 at 17 36 50

Supported devices

eldes's People

Contributors

augustas2 avatar evaliukonis avatar martinl avatar samuolis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

eldes's Issues

No bypass alarm API - System fails to arm if any zones have errors

If using the eldes security app, when trying to arm alarm an error modal is displayed if e.g. a window is not closed and allows to bypass the zones to arm the system anyway.
Is it possible to add this API to the integration so that HA could always make sure to arm the alarm regardless if someone forgot to close a window, etc? Right now it just tries to arm and times out after failing.

Screenshot_20220222-091137

Multiple devices/locations support

I have multiple Eldes devices in different locations. It would be nice if I could select which devices/locations to add or enable in HA. Currently I could delete the other devices but control entity still shows multiple items. Also, we are getting arm/disarm events for all devices which are not relevant to specific HA instance. Otherwise the integration works well and looks nice and is very easy to set up when compared to some other alarm panel brands.

Integration stopped working

Hi, a few days ago the integration stopped working - any insight on how to troubleshoot?

Žiūriu čia visi lietuviškai rašo :) Iki šiol veikė stabiliai, sistemoje nieko nekeičiau.

This error originated from a custom integration.

Logger: custom_components.eldes_alarm
Source: custom_components/eldes_alarm/init.py:69
integration: Eldes Alarm (documentation, issues)
First occurred: 06:49:18 (457 occurrences)
Last logged: 17:02:48

Unknown error occurred during Eldes update request: 403, message='', url=URL('https://cloud.eldesalarms.com:8083/api/device/list')
Unknown error occurred during Eldes update request: 400, message='', url=URL('https://cloud.eldesalarms.com:8083/api/device/partition/list?imei=357788108511576')
Traceback (most recent call last):
File "/config/custom_components/eldes_alarm/init.py", line 69, in async_update_data
return await async_get_devices(hass, entry, eldes_client)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/eldes_alarm/init.py", line 104, in async_get_devices
devices = await eldes_client.get_devices()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/eldes_alarm/core/eldes_cloud.py", line 113, in get_devices
response = await self._api_call(url, "GET")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/eldes_alarm/core/eldes_cloud.py", line 58, in _api_call
req.raise_for_status()
File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1060, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 403, message='', url=URL('https://cloud.eldesalarms.com:8083/api/device/list')

Immediate status request after armed alarm

Hello and thank you for this integration!
it would be useful that when the alarm is armed / disarmed, a request for the status of the alarm is immediately made to understand whether it has actually been activated or not.

At this moment if I armed the alarm, but there are open zones and it does not activate, HA shows the status only after the pooling time set in the configuration.

PIN code requirement

My cloud authentication requires PIN code to enter, otherwise it doesn't work. I tested and debugged it with curl.

For this module to work, I need to modify code, examples below. CODE is 4 digit pin code that I use to switch on and off alarm from the keyboard.

Get Partitions:

    async def get_device_partitions(self, imei):
        """Gets device partitions/zones."""
        data = {
            'imei': imei,
            'pin': 'CODE'
        }
            
        url = f"{API_URL}{API_PATHS['DEVICE']}partition/list?imei={imei}"
        
        response = await self._api_call(url, "POST", data)
        result = await response.json()
        partitions = result.get("partitions", [])

        # Replace Eldes state with HA state name
        for partitionIndex, _ in enumerate(partitions):
            partitions[partitionIndex]["state"] = ALARM_STATES_MAP[partitions[partitionIndex].get("state", STATE_ALARM_DISARMED)]
                
        _LOGGER.debug(
            "get_device_partitions result: %s",
            partitions
        )
        
        return partitions

Get Outputs:

    async def get_device_outputs(self, imei):
        """Gets device outputs/automations."""
        data = {
            'imei': imei,
            'pin': 'CODE'
        }

        url = f"{API_URL}{API_PATHS['DEVICE']}list-outputs/{imei}"

        response = await self._api_call(url, "POST", data)
        result = await response.json()
        outputs = result.get("deviceOutputs", [])

        _LOGGER.debug(
            "get_device_outputs result: %s",
            outputs
        )

        return outputs

Set Alarm:

    async def set_alarm(self, mode, imei, zone_id):
        """Sets alarm to provided mode."""
        data = {
            'imei': imei,
            'pin': 'CODE',
            'partitionIndex': zone_id
        }
            
        url = f"{API_URL}{API_PATHS['DEVICE']}action/{mode}"
            
        response = await self._api_call(url, "POST", data)
        result = await response.text()
        
        _LOGGER.debug(
            "set_alarm result: %s",
            result
        )
            
        return result

Turn On Output:

    async def turn_on_output(self, imei, output_id):
        """Turns on output."""
        data = {
            'pin': 'CODE'
        }

        url = f"{API_URL}{API_PATHS['DEVICE']}control/enable/{imei}/{output_id}"

        response = await self._api_call(url, "PUT", data)

        _LOGGER.debug(
            "turn_on_output response: %s",
            response
        )

        return response

Turn Off Output:

    async def turn_off_output(self, imei, output_id):
        """Turns off output."""
        data = {
            'pin': 'CODE'
        }

        url = f"{API_URL}{API_PATHS['DEVICE']}control/disable/{imei}/{output_id}"

        response = await self._api_call(url, "PUT", data)

        _LOGGER.debug(
            "turn_off_output response: %s",
            response
        )

        return response

Get Temperatures:

    async def get_temperatures(self, imei):
        """Gets device information."""
        data = {
            'imei': imei,
            'pin': 'CODE'
        }
            
        url = f"{API_URL}{API_PATHS['DEVICE']}temperatures?imei={imei}"
            
        response = await self._api_call(url, "POST", data)
        result = await response.json()
        temperatures = result.get("temperatureDetailsList", [])

        _LOGGER.debug(
            "get_temperatures result: %s",
            temperatures
        )

        return temperatures

Get Events:

    async def get_events(self, size):
        """Gets device events."""
        data = {
            "": "",
            'pin': 'CODE',
            "size": size,
            "start": 0
        }

        url = f"{API_URL}{API_PATHS['DEVICE']}event/list"
            
        response = await self._api_call(url, "POST", data)
        result = await response.json()
        events = result.get("eventDetails", [])
        
        _LOGGER.debug(
            "get_events result: %s",
            events
        )

        return events

I understand that it is not correct problem solving, would be better to enter code on ELDES configuration and use as variable, but I don't know how to do it not breaking module.

Module failure if alarm is offline

I have two ELDES alarms on the cloud. When both are working, everything is OK with HA.
But I had a case recently, when one (remote) system was offline because of electricity failure for prolonged time.
I wasn't able to see anything on Home assistant even related with another working alarm system.

What is expected - when one system is not working, other system should be functional.

Problem was seen even in this window:
image

Error was like this:

2023-10-13 18:32:26.779 ERROR (MainThread) [custom_components.eldes_alarm.core.eldes_cloud] Client error on API https://cloud.eldesalarms.com:8083/api/device/partition/list?imei=IMEINUMBER request 400, message='', url=URL('https://cloud.eldesalarms.com:8083/api/device/partition/list?imei=IMEINUMBER')

As second alarm system wasn't functioning, it still was discoverable on the cloud, but was not possible to read partitions list (as well as controls and temperature sensors).

Maybe it would be possible to change code to handle such case?

Integration is using deprecated `DEVICE_CLASS_*` constants

This custom integration uses deprecated DEVICE_CLASS_* constants in its codebase.

The DEVICE_CLASS_* constants have been deprecated and replaced in Home Assistant Core 2021.12 (over a year ago). I would highly suggest updating/migrating this integration to the new enums.

For example, for the device classes supported by the sensor platform, there is now a SensorDeviceClass enum. So if a sensor previously used the DEVICE_CLASS_ENERGY constant, it should now use SensorDeviceClass.ENERGY. Other platforms (like binary_sensor, and number) provide similar enumerations for their supported device classes.

The migration thus only consists of replacing constants with an enumeration member and is, therefore, very low impact and should be fairly straightforward.

If I can help resolve any questions regarding this change or migration, feel free to ask or respond to this issue. I'm happy to help!

Kindest regards,

../Frenck

ESIM320

It would be nice to add support for ESIM320. With this I would be able to open the gate automatically 😀

Help with start compounent

Hello everyone , Maybe stupid questions , but how to start this component , I installed it on HA over HACS, looked files code , but it is not my level of knowledge. Any help with next steps ? Do I need to install some addditional compounens/integrations to start it ?

Failed to setup

ERROR 1:

Logger: custom_components.eldes_alarm.core.eldes_cloud
Source: custom_components/eldes_alarm/core/eldes_cloud.py:62
Integration: Eldes Alarm (documentation, issues)
First occurred: 18:56:36 (204 occurrences)
Last logged: 21:01:06

Client error on API https://cloud.eldesalarms.com:8083/api/device/info?imei=**************** request 400, message='', url=URL('https://cloud.eldesalarms.com:8083/api/device/info?imei=****************')
Client error on API https://cloud.eldesalarms.com:8083/api/device/list request 403, message='', url=URL('https://cloud.eldesalarms.com:8083/api/device/list')

ERROR 2:

This error originated from a custom integration.

Logger: custom_components.eldes_alarm
Source: custom_components/eldes_alarm/core/eldes_cloud.py:58
Integration: Eldes Alarm (documentation, issues)
First occurred: 18:56:37 (102 occurrences)
Last logged: 21:01:06

Unknown error occurred during Eldes update request: 400, message='', url=URL('https://cloud.eldesalarms.com:8083/api/device/info?imei=*')
Unknown error occurred during Eldes update request: 403, message='', url=URL('https://cloud.eldesalarms.com:8083/api/device/list')
Traceback (most recent call last):
File "/config/custom_components/eldes_alarm/init.py", line 67, in async_update_data
return await async_get_devices(hass, entry, eldes_client)
File "/config/custom_components/eldes_alarm/init.py", line 105, in async_get_devices
device["info"] = await eldes_client.get_device_info(device["imei"])
File "/config/custom_components/eldes_alarm/core/eldes_cloud.py", line 128, in get_device_info
response = await self._api_call(url, "GET")
File "/config/custom_components/eldes_alarm/core/eldes_cloud.py", line 58, in _api_call
req.raise_for_status()
File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1004, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message='', url=URL('https://cloud.eldesalarms.com:8083/api/device/info?imei=
')

Switch error after HA restart

Not sure what it's all about, but I see an error in log after HA restart. Might be some initial check that does not go through. No issues other than that - all is working as expected.

Logger: homeassistant.components.switch
Source: custom_components/eldes_alarm/switch.py:64
Integration: Switch ([documentation](https://www.home-assistant.io/integrations/switch), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+switch%22))
First occurred: 00:04:07 (2 occurrences)
Last logged: 00:04:07

Error adding entities for domain switch with platform eldes_alarm
Error while setting up eldes_alarm platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 521, in _async_add_entity
    original_icon=entity.icon,
  File "/config/custom_components/eldes_alarm/switch.py", line 64, in icon
    return OUTPUT_ICONS_MAP[self.data["outputs"][self.entity_index].get("iconName", "ICON_1")]
KeyError: None

Error adding entities for domain switch with platform eldes_alarm

Logger: homeassistant.components.switch
Source: custom_components/eldes_alarm/switch.py:65
Integration: Switch (documentation, issues)
First occurred: 08:57:11 (2 occurrences)
Last logged: 08:57:11

Error adding entities for domain switch with platform eldes_alarm
Error while setting up eldes_alarm platform for switch
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 615, in _async_add_entity
original_icon=entity.icon,
File "/config/custom_components/eldes_alarm/switch.py", line 65, in icon
return OUTPUT_ICONS_MAP[self.data["outputs"][self.entity_index]["iconName"]]
KeyError: None

Arming requires code

Arming does not function after update to HA2024.6.0

Error:
Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:283
integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 23:08:14 (1 occurrences)
Last logged: 23:08:14

[139997023508880] Arming requires a code but none was given for alarm_control_panel.zonename

Not working because changed cloud API

All requests require a pin.
events/list renamed to event/list and need IMEI in payload, also have size parameter to reduce size.

If you need help I can share some changes. Can not create pull request because need fast fix and hardcoded IMEI to code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.