Skip to content

Commit

Permalink
add support for armed_vacation
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsfaber committed Jan 15, 2022
1 parent 9abf8cf commit cfe826a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
- [Configuration](#configuration)
- [Options](#options)
- [State configuration](#state-configuration)
- [!example result](#)
- [Say thank you](#say-thank-you)

## Introduction
Expand Down Expand Up @@ -113,9 +112,9 @@ Note that the alarm entity may not support all `armed_xxx` states. States which

| Name | Type | Applicable states | Description | Default |
| ------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | ------------------------- |
| hide | boolean | `armed_away`<br>`armed_home`<br>`armed_night`<br>`armed_custom_bypass` | Hides the button corresponding to the state. | `false` |
| button_label | string | `disarmed`<br>`armed_away`<br>`armed_home`<br>`armed_night`<br>`armed_custom_bypass` | Overwrites the text on the button.<br>Only useful if the button is not hidden. | (Use translation from HA) |
| state_label | string | `disarmed`<br>`triggered`<br>`arming`<br>`pending`<br>`armed_away`<br>`armed_home`<br>`armed_night`<br>`armed_custom_bypass` | Overwrites the text displayed in the card when the alarm is in this state. | (Use translation from HA) |
| hide | boolean | `armed_away`<br>`armed_home`<br>`armed_night`<br>`armed_vacation`<br>`armed_custom_bypass` | Hides the button corresponding to the state. | `false` |
| button_label | string | `disarmed`<br>`armed_away`<br>`armed_home`<br>`armed_night`<br>`armed_vacation`<br>`armed_custom_bypass` | Overwrites the text on the button.<br>Only useful if the button is not hidden. | (Use translation from HA) |
| state_label | string | `disarmed`<br>`triggered`<br>`arming`<br>`pending`<br>`armed_away`<br>`armed_home`<br>`armed_night`<br>`armed_vacation`<br>`armed_custom_bypass` | Overwrites the text displayed in the card when the alarm is in this state. | (Use translation from HA) |

**Example of using state configuration**

Expand All @@ -140,10 +139,11 @@ states:
Result:

![example result](https://github.com/nielsfaber/alarmo-card/blob/main/screenshots/state-config-example.png?raw=true "example result")

---

## Say thank you
If you want to make donation as appreciation of my work, you can buy me a coffee. Thank you!
If you want to make donation as appreciation of my work, you can do so via PayPal or buy me a coffee. Thank you!

<a href="https://www.paypal.com/donate/?business=CLL4T6Y8ACXNN&no_recurring=0&item_name=Thank+you+for+supporting+my+work+on+the+Alarmo+project%2E+Your+donation+is+much+appreciated%21&currency_code=EUR" target="_blank"><img src="https://pics.paypal.com/00/s/YzlhMzI2ZjYtZDQxMi00NzNiLThmZTktOTk3MmEyYTA2Zjc0/file.PNG" width="150" /></a>
<a href="https://www.buymeacoffee.com/vrdx7mi" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png"></a>

6 changes: 3 additions & 3 deletions dist/alarmo-card.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/const.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CardConfig } from './types';

export const CARD_VERSION = 'v1.2.2';
export const CARD_VERSION = 'v1.2.3';

export const BUTTONS = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '', '0', 'clear'];

Expand All @@ -14,13 +14,15 @@ export enum AlarmStates {
ArmedAway = 'armed_away',
ArmedHome = 'armed_home',
ArmedNight = 'armed_night',
ArmedVacation = 'armed_vacation',
ArmedCustomBypass = 'armed_custom_bypass',
}

export const ICONS: Record<AlarmStates, string> = {
[AlarmStates.ArmedAway]: 'hass:shield-lock',
[AlarmStates.ArmedHome]: 'hass:shield-home',
[AlarmStates.ArmedNight]: 'hass:shield-moon',
[AlarmStates.ArmedVacation]: 'hass:shield-airplane',
[AlarmStates.ArmedCustomBypass]: 'hass:security',
[AlarmStates.Disarmed]: 'hass:shield-off',
[AlarmStates.Arming]: 'hass:shield-outline',
Expand All @@ -32,6 +34,7 @@ export enum ArmActions {
ArmAway = 'arm_away',
ArmHome = 'arm_home',
ArmNight = 'arm_night',
ArmVacation = 'arm_vacation',
ArmCustomBypass = 'arm_custom_bypass',
Disarm = 'disarm',
}
Expand All @@ -40,6 +43,7 @@ export const ActionToState = {
[ArmActions.ArmAway]: AlarmStates.ArmedAway,
[ArmActions.ArmHome]: AlarmStates.ArmedHome,
[ArmActions.ArmNight]: AlarmStates.ArmedNight,
[ArmActions.ArmVacation]: AlarmStates.ArmedVacation,
[ArmActions.ArmCustomBypass]: AlarmStates.ArmedCustomBypass,
[ArmActions.Disarm]: AlarmStates.Disarmed,
};
Expand Down
1 change: 1 addition & 0 deletions src/data/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const calcSupportedActions = (stateObj: HassEntity) => {
if (supportedFeatures & 2) actions.push(ArmActions.ArmAway);
if (supportedFeatures & 1) actions.push(ArmActions.ArmHome);
if (supportedFeatures & 4) actions.push(ArmActions.ArmNight);
if (supportedFeatures & 32) actions.push(ArmActions.ArmVacation);
if (supportedFeatures & 16) actions.push(ArmActions.ArmCustomBypass);
return actions;
};
Expand Down

0 comments on commit cfe826a

Please sign in to comment.