home-assistant / architecture

Repo to discuss Home Assistant architecture
315 stars 99 forks source link

alarm-control-panel: Vacation Mode #413

Closed posixx closed 3 years ago

posixx commented 4 years ago

Context

Multiple alarmpanel vendors have a vacation mode apart from existing modes like away, night and home:

We like to have this extra alarm status / mode added to the alarm-control-panel entity so users are able to do specific automation actions based on them being away for a longer time like close main water valves, specific light scenes or extra ventliation during specific hours

Proposal

Adding the extra vacation mode to the alarm-control-panel entity as well as the MQTT alarm class. This PR is already opened and tested: https://github.com/home-assistant/core/pull/38284 and contains the following modifications:

Services Add the following service:

alarm_arm_vacation:
  description: Send the alarm the command for arm vacation.
  fields:
    entity_id:
      description: Name of alarm control panel to arm vacation.
      example: "alarm_control_panel.downstairs"
    code:
      description: An optional code to arm vacation the alarm control panel with.
      example: "1234"

Along with a SUPPORT_ALARM_ARM_VACATION flag.

States Add the state STATE_ALARM_ARMED_VACATION

Device automations Add an arm_vacation device action Add an is_armed_vacation device condition Add an armed_vacation device trigger

UI Add an "Arm Vacation" button to the alarm control panel card Add an icon to represent the armed vacation state to the card and details dialog.

Consequences

All existing alarmpanels that have integrations within HA will not be impacted by adding this new alarm state. The integration component of the alarmpanel determines if this state is used or not.

Currently it is impossible to have automation actions based on vacation without some extra manual interaction. With this new state the alarmpanel this will be possible.

posixx commented 4 years ago

Ho does this work; when will this be discussed / follow'd up?

MartinHjelmare commented 4 years ago

There's unfortunately no formal process or timeline for that. There needs to be some interest from organization members to look at this and comment.

My initial thought is that 4/29 seems a bit low coverage for this feature to be added. Have you reviewed all existing integrations with alarm control panel platforms to gather the correct possible support level for this feature?

posixx commented 4 years ago

No i didn't. I don't know all integrations, i'm sure there will be more supporting vacation mode., i just searched google for some examples.

@frenck suggested to open an architectural change request for this, but this change has no impact at all on all 29 alarm implementations other than making the new status available to panels that support it.

MartinHjelmare commented 4 years ago

Before adding a new feature to an entity integration we want to assess the support for this feature among both existing integrations and for other devices of the same device type in the wild.

It's easier to accept new features that we know are supported by a majority or at least large part of the integrations. So I'd advice to try and gather more data on this.

posixx commented 4 years ago

Apart from the list i provided i scanned the current alarm integrations and found the following to be supporting some sort of vacation mode:

So 11 out of 29 intergrations are supporting vacation mode (didn't count in MQTT as that would be implemented with my pull request). Apart from that; home and/or night modes aren't supported either on a lot of panels which do not support vacation mode, so if these modes are supported by HA so should vacation mode in my opinion. The use cases for vacation mode are much higher than for instance, home mode.

MartinHjelmare commented 4 years ago

With 11/29 I'm ok with adding it. We should get some more opinions from other members before moving ahead.

frenck commented 4 years ago

For Verisure this is not a valid use-case. Verisure vacation/holiday mode is a setting for the alarm dispatch center to know who to contact between a certain period. It cannot be activated or read out from the alarm panel itself.

Nevertheless, I don't see much harm in adding such a mode.

posixx commented 4 years ago

According to this python module it should have some information available: https://github.com/persandstrom/python-verisure,

frenck commented 4 years ago

Yes, but it isn't an alarm panel state.

posixx commented 4 years ago

Ok clear!

posixx commented 4 years ago

Hello, any updates on implementing vacation mode?

austinmroczek commented 4 years ago

totalconnect API has no concept of vacation mode as described here. There would be no impact to totalconnect by implementing this.

OnFreund commented 4 years ago

Risco doesn't have a formal vacation mode (AFAIK), but it has 6 different arming modes, and the user can set one of them to something that would make sense when going on vacation. The integration is planned to allow custom mapping of HA arming modes to Risco arming modes (https://github.com/home-assistant/core/pull/39218). In short - this could make sense for the Risco integration.

bdraco commented 4 years ago

Seems fine to me. ElkM1 supports this and I'd be happy to add it.

posixx commented 3 years ago

at what period a decision will be made for this? My pull request is becoming stale again,.

posixx commented 3 years ago

bunp..

posixx commented 3 years ago

As there seems no interest in this i've made a workaround and use a flag within my alarm to detect vacation mode.

frenck commented 3 years ago

I was looking throught the open PRs and came across https://github.com/home-assistant/core/pull/38284.

Yet, @posixx, this one is closed?

As there seems no interest

I believe the verdict in this issue was rather approving.

3 Members (myself, @MartinHjelmare & @bdraco) approved of adding it and the reasoning for it with the overview of the integrations that could support it; was IMHO enough to go forward?

MartinHjelmare commented 3 years ago

Please also describe the frontend source changes needed for this feature. A frontend PR that implements this is required before we can merge the core PR.

posixx commented 3 years ago

There is no frontend change, just adding a alarm status. You can see all you need in the PR https://github.com/home-assistant/core/pull/38284

MartinHjelmare commented 3 years ago

As I understand the core PR, it's adding a new service and a new state. This should normally be exposed by the frontend.

It would help this architecture issue if we outline the proposed changes to the entity model here in the PR description. See eg this other issue: https://github.com/home-assistant/architecture/issues/375

posixx commented 3 years ago

I'm sorry i don't understand what i need to add where..

MartinHjelmare commented 3 years ago

First, in this PR description, outline the new alarm control panel state and service and corresponding entity method that you propose to add.

Second, please describe how these new features will be exposed in the frontend. Normally, entity services are available to be run via the GUI. If we don't want this, please explain why so we can decide on this too.

posixx commented 3 years ago

@MartinHjelmare i tired to determine what you want me to add to this PR but i don't get it at all. The extra alarmstate is completely the same as, for instance, the nightmode implementation. There are no differences apart from the alarm state value.

I would opt to use the nightmode implementations (core aswell as frontend) as reference for this new alarmstate.

MartinHjelmare commented 3 years ago

For arm away mode there's a button in the lovelace card to activate this mode. Should we add this for the vacation mode? This is the sort of discussion I'm after.

You haven't specifically described the APIs, and named them, that you want to add besides opening the core PR. I'd like you to do that here in the architecture issue top post so it's easier to understand and talk about this here.

Please describe the API in terms of service and state, which are core building blocks in Home Assistant.

posixx commented 3 years ago

Ok i updated the description of this PR.

I would opt for adding the button in lovelace to activate vacation mode. Also make visibility of this button customizable just as other states.

OnFreund commented 3 years ago

Sorry for interjecting, but I believe I understand what both sides here are after, so I'll try to tackle this:

Services Add the following service:

alarm_arm_vacation:
  description: Send the alarm the command for arm vacation.
  fields:
    entity_id:
      description: Name of alarm control panel to arm vacation.
      example: "alarm_control_panel.downstairs"
    code:
      description: An optional code to arm vacation the alarm control panel with.
      example: "1234"

Along with a SUPPORT_ALARM_ARM_VACATION flag.

States Add the state STATE_ALARM_ARMED_VACATION

Device automations

UI

Hope this helps.

posixx commented 3 years ago

Many thanks @OnFreund i updated the comments!

posixx commented 3 years ago

Ok when will this proposal going forward?