Skip to content

Commit 6047ab6

Browse files
authored
Merge pull request #191 from tahvane1/async
async fixes to io
2 parents ca20e1b + e3c4c8f commit 6047ab6

File tree

3 files changed

+120
-149
lines changed

3 files changed

+120
-149
lines changed

custom_components/jablotron80/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
"""The Detailed Hello World Push integration."""
2-
31
import asyncio
42
from homeassistant.components.alarm_control_panel import (
53
DOMAIN as PLATFORM_ALARM_CONTROL_PANEL,

custom_components/jablotron80/alarm_control_panel.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ async def async_alarm_disarm(self, code=None) -> None:
122122
# just one zone so input code without any "kinks"
123123
# todo check if you can get disarming from serial line
124124
self._zones[0].status = JablotronZone.STATUS_DISARMING
125-
self._cu.disarm(code)
125+
await self._cu.disarm(code)
126126
else:
127-
self._cu.disarm(code)
127+
await self._cu.disarm(code)
128128

129129
async def async_alarm_arm_home(self, code=None) -> None:
130130
if not self._cu.is_code_required_for_arm():
@@ -134,12 +134,12 @@ async def async_alarm_arm_home(self, code=None) -> None:
134134
if code == None:
135135
return
136136
if self._cu.mode == JA80CentralUnit.SYSTEM_MODE_PARTIAL:
137-
self._cu.arm(code, "A")
137+
await self._cu.arm(code, "A")
138138
elif self._cu.mode == JA80CentralUnit.SYSTEM_MODE_SPLIT:
139139
if self._main_zone == 0:
140-
self._cu.arm(code, "A")
140+
await self._cu.arm(code, "A")
141141
else:
142-
self._cu.arm(code, "B")
142+
await self._cu.arm(code, "B")
143143

144144
async def async_alarm_arm_away(self, code=None) -> None:
145145
if not self._cu.is_code_required_for_arm():
@@ -151,15 +151,15 @@ async def async_alarm_arm_away(self, code=None) -> None:
151151
if self._cu.mode == JA80CentralUnit.SYSTEM_MODE_UNSPLIT:
152152
# if we have received a code use it to arm the system
153153
if len(code) > 0:
154-
self._cu.arm(code)
154+
await self._cu.arm(code)
155155
# otherwise simulate an ABC key press (zone C means all zones)
156156
else:
157-
self._cu.arm(code, "C")
157+
await self._cu.arm(code, "C")
158158
elif self._cu.mode in [
159159
JA80CentralUnit.SYSTEM_MODE_PARTIAL,
160160
JA80CentralUnit.SYSTEM_MODE_SPLIT,
161161
]:
162-
self._cu.arm(code, "C")
162+
await self._cu.arm(code, "C")
163163

164164
async def async_alarm_arm_night(self, code=None) -> None:
165165
if not self._cu.is_code_required_for_arm():
@@ -169,7 +169,7 @@ async def async_alarm_arm_night(self, code=None) -> None:
169169
if code == None:
170170
return
171171
if self._cu.mode == JA80CentralUnit.SYSTEM_MODE_PARTIAL:
172-
self._cu.arm(code, "B")
172+
await self._cu.arm(code, "B")
173173

174174
async def async_alarm_trigger(self, code=None) -> None:
175175
if self.alarm_state == AlarmControlPanelState.DISARMED:

0 commit comments

Comments
 (0)