From 1940d9a377c78f0991cf35e887b35b1c22381efa Mon Sep 17 00:00:00 2001
From: Khole <kjtech6@outlook.com>
Date: Mon, 22 Aug 2022 08:20:12 +0100
Subject: [PATCH] Hive Add ability to trigger the alarm (#76985)

* Add ability to trigger the alarm

* Add mapping for sos state when triggered manually

* Update homeassistant/components/hive/alarm_control_panel.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/components/hive/alarm_control_panel.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Fix linter issues

Co-authored-by: Erik Montnemery <erik@montnemery.com>
---
 homeassistant/components/hive/alarm_control_panel.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/homeassistant/components/hive/alarm_control_panel.py b/homeassistant/components/hive/alarm_control_panel.py
index 48b59e351be..5f0b3d8f03c 100644
--- a/homeassistant/components/hive/alarm_control_panel.py
+++ b/homeassistant/components/hive/alarm_control_panel.py
@@ -27,6 +27,7 @@ HIVETOHA = {
     "home": STATE_ALARM_DISARMED,
     "asleep": STATE_ALARM_ARMED_NIGHT,
     "away": STATE_ALARM_ARMED_AWAY,
+    "sos": STATE_ALARM_TRIGGERED,
 }
 
 
@@ -49,6 +50,7 @@ class HiveAlarmControlPanelEntity(HiveEntity, AlarmControlPanelEntity):
     _attr_supported_features = (
         AlarmControlPanelEntityFeature.ARM_NIGHT
         | AlarmControlPanelEntityFeature.ARM_AWAY
+        | AlarmControlPanelEntityFeature.TRIGGER
     )
 
     async def async_alarm_disarm(self, code: str | None = None) -> None:
@@ -63,6 +65,10 @@ class HiveAlarmControlPanelEntity(HiveEntity, AlarmControlPanelEntity):
         """Send arm away command."""
         await self.hive.alarm.setMode(self.device, "away")
 
+    async def async_alarm_trigger(self, code=None) -> None:
+        """Send alarm trigger command."""
+        await self.hive.alarm.setMode(self.device, "sos")
+
     async def async_update(self) -> None:
         """Update all Node data from Hive."""
         await self.hive.session.updateData(self.device)