Given that your integration is great as it is, and it can perfectly control the alarm system as a whole as HA mandates, here’s my two cents:
I’d like to have fine-grained entities that go beyond binary sensors and the alarm service function (alarm_arm_home, alarm_arm_night and so on).
They should model sectors and inputs as switches.
This way I could toggle them both from Lovelace UI and automations with their very specific semantic: arming every single sector independently and enable/disable every single input.
To be honest this is what I failed to achieve with the android app - based on your e-connect client - I’ve never published cause I was not happy with Kivy implementation details getting in the way (surely my fault).
Anyway I see your integration acting both
as a bridge between HA model and e-connect API
as some UI to control the alarm system.
IMHO exposing the switches would give you greater flexisibility for the 1st point while keeping your UI-related codebase minimal (2nd one).
So many exotic use cases would be easily covered with existing stuff (your UI, the whole set of generic switch-related UI widgets or even Alarmo ones).
Thanks for your feedback! So to summarize steps you are proposing:
Convert all binary sensors in switches (it means we have the Alarm Panel entity, and then only switches)
For sectors: when the switch is ON, the alarm for that sector must be activated (viceversa for OFF)
For inputs: when the switch is OFF, that input should be excluded (disabled) and viceversa
So the use case is:
You use the alarm panel widget as a generic panel, where you turn on/off the alarm based on a preset configuration
You use sectors as switches to enable/disable a specific alarm (one at a time)
You use inputs as switches to enable/exclude the input (e.g. you want to disable the alarm sensor for a specific window or door)
@davidecavestro did I get it correct? It seems a great improvement to me!
Edit: I forgot to mention that I should check the feasibility. Arming/disarming requires the secret code that is not stored anywhere. You can store the code directly in your automation (I do that to enable/disable the alarm from automations) but in the Lovelace UI you don’t have this opportunity. A possible solution is to store it as a secret in the configuration panel, but I don’t know how much secure is that configuration (I can investigate though).
I confirm you got it right, these are my use cases
I must admit I’m not sure if the switches should replace or complement sensors.
I mean: an input can be enabled or excluded by user (actionable switch) and has an open or closed state (as detected by hardware sensor).
It seems a tri-state or even two binary props… or a switch and a sensor.
OTOH sectors can be armed/disarmed but I don’t know if - from the e-connect api standpoint - they have a concept of being in a triggered state or not.
Maybe sensors should be responsible of triggering the alarm and switches just control arming.
Really not sure, just brainstorming…
Cool, I think I can provide switches to support this legit use case, and then I ask for guidance to HA core maintainers to see if we should provide both (binary sensors and switches) or not.
Let me take a look at this, then in a few days I may ship a new version that you can try out! In the meantime, feel free to share any other feedback you have!
more simple in the meanwhile. Why not to map all standard states? referring to manual alarm documentation
armed_custom_bypass/armed_home/armed_away/armed_night/disarmed/triggered
anyhow what is missing is the armed_away status I think. You are assuming by default that is all sectors (1 to 4).
I suggest you should work on “less data connection”. I’ve sim with 200 mb/month (easycontroll by Vodafone) but this integration is using 10-15mb per day… I’ve disinstalled waiting for such a modification. Anyhow, thanks for the great job!!!
After creating the folder in the custom_component folder and restarting HA, i have the expected warning in the log, but i cannot find “e-connect alarm” when I do “Add integration”.
Any idea on why and how to solve?
I have HA core 2021.12.4.
The warning i have (also for other custom components) is:
2022-01-10 14:08:54 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration econnect_alarm which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
OTOH the error message you got seems very specific to a CredentialError, that can be raised just from here for an incorrect username or password (possibly related to the empty domain path coming from the config UI?)
Anyway you could try to temporarily edit the validate_credentials function within file [HASS_BASE]/custom_components/econnect_alarm/helpers.py
maybe adding some simple log
or just forcing to have no domain, instead of picking a (presumably empty) CONF_DOMAIN from data
Question: when the alarm is on and an alarm event occurs, is there any attribute or event that i can intercept to be notified that the alarm is ringing?
Never tried, but I’d expect the state of the alarm panel entity (i.e. alarm_control_panel.alarm_panel) switches to triggered.
If not you could use an automation anche check for any binary sensor activated while the panel state is armed_away/armed_night.