Skip to content

Commit 9b1eca2

Browse files
authored
v1.0.1
version 1.0.1
2 parents 59ccd49 + 41febc6 commit 9b1eca2

File tree

3 files changed

+35
-12
lines changed

3 files changed

+35
-12
lines changed

CHANGELOG.rst

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
v1.0.0 (2022-09-13)
2+
*******************

pyobs_alpaca/dome.py

+32-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import asyncio
22
import logging
3+
import time
34
from typing import Tuple, Optional, Any
45

56
from pyobs.events import RoofOpenedEvent, RoofClosingEvent
@@ -63,6 +64,14 @@ async def open(self) -> None:
6364
# init status to IDLE
6465
await self._change_motion_status(MotionStatus.IDLE)
6566

67+
async def _send_open_dome(self) -> None:
68+
"""Send command to open dome."""
69+
try:
70+
await self._device.put("OpenShutter")
71+
except ConnectionError:
72+
await self._change_motion_status(MotionStatus.UNKNOWN)
73+
raise exc.InitError("Could not open dome.")
74+
6675
@timeout(1200000)
6776
async def init(self, **kwargs: Any) -> None:
6877
"""Open dome.
@@ -86,11 +95,8 @@ async def init(self, **kwargs: Any) -> None:
8695
await self._change_motion_status(MotionStatus.INITIALIZING)
8796

8897
# execute command
89-
try:
90-
await self._device.put("OpenShutter")
91-
except ConnectionError:
92-
await self._change_motion_status(MotionStatus.UNKNOWN)
93-
raise exc.InitError("Could not open dome.")
98+
await self._send_open_dome()
99+
time_attempt = time.time()
94100

95101
# wait for it
96102
status = None
@@ -109,11 +115,25 @@ async def init(self, **kwargs: Any) -> None:
109115
await self._change_motion_status(MotionStatus.UNKNOWN)
110116
raise exc.InitError("Could not open dome.")
111117

118+
# waited >10s?
119+
if time.time() - time_attempt > 10:
120+
await self._send_open_dome()
121+
time_attempt = time.time()
122+
112123
# set new status
113124
log.info("Dome opened.")
114125
await self._change_motion_status(MotionStatus.POSITIONED)
115126
await self.comm.send_event(RoofOpenedEvent())
116127

128+
async def _send_close_dome(self) -> None:
129+
"""Send command to open dome."""
130+
try:
131+
await self._device.put("CloseShutter")
132+
await self._device.put("SlewToAzimuth", Azimuth=0)
133+
except ConnectionError:
134+
await self._change_motion_status(MotionStatus.UNKNOWN)
135+
raise exc.ParkError("Could not close dome.")
136+
117137
@timeout(1200000)
118138
async def park(self, **kwargs: Any) -> None:
119139
"""Close dome.
@@ -134,12 +154,8 @@ async def park(self, **kwargs: Any) -> None:
134154
await self.comm.send_event(RoofClosingEvent())
135155

136156
# send command for closing shutter and rotate to South
137-
try:
138-
await self._device.put("CloseShutter")
139-
await self._device.put("SlewToAzimuth", Azimuth=0)
140-
except ConnectionError:
141-
await self._change_motion_status(MotionStatus.UNKNOWN)
142-
raise exc.ParkError("Could not close dome.")
157+
await self._send_close_dome()
158+
time_attempt = time.time()
143159

144160
# wait for it
145161
status = None
@@ -158,6 +174,11 @@ async def park(self, **kwargs: Any) -> None:
158174
await self._change_motion_status(MotionStatus.UNKNOWN)
159175
raise exc.ParkError("Could not close dome.")
160176

177+
# waited >10s?
178+
if time.time() - time_attempt > 10:
179+
await self._send_close_dome()
180+
time_attempt = time.time()
181+
161182
# set new status
162183
log.info("Dome closed.")
163184
await self._change_motion_status(MotionStatus.PARKED)

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pyobs-alpaca"
3-
version = "1.0.0"
3+
version = "1.0.1"
44
description = "pyobs module for ASCOM Alpaca"
55
authors = ["Tim-Oliver Husser <[email protected]>"]
66
license = "MIT"

0 commit comments

Comments
 (0)