Skip to content

Commit 1425da2

Browse files
committed
Move constants
1 parent 0dfbaf4 commit 1425da2

1 file changed

Lines changed: 26 additions & 21 deletions

File tree

dingz/constants.py

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
1-
"""Constants used by the Python API for interacting with Dingz devices."""
1+
"""Constants used by the Python API for interacting with dingz units."""
2+
import pkg_resources
23

3-
API = '/api/v1/'
4+
try:
5+
__version__ = pkg_resources.get_distribution("setuptools").version
6+
except Exception:
7+
__version__ = "unknown"
48

5-
# Status endpoints
6-
PUCK = 'f{API}puck'
7-
INFO = 'f{API}info'
8-
TEMPERATURE = 'f{API}temp'
9-
DIMMER = 'f{API}dimmer'
10-
MOTION = 'f{API}/motion'
11-
DEVICE_INFO = 'f{API}device'
12-
LIGHT = 'f{API}light'
13-
14-
# Special endpoints
15-
LOG = '/log'
16-
FIRMWARE = '/load'
9+
TIMEOUT = 10
1710

11+
USER_AGENT = f"PythonDingz/{__version__}"
12+
API = "/api/v1/"
1813

14+
# Status endpoints
15+
PUCK = "puck"
16+
INFO = "info"
17+
TEMPERATURE = "temp"
18+
DIMMER = "dimmer"
19+
MOTION = "motion"
20+
DEVICE_INFO = "device"
21+
LIGHT = "light"
1922

20-
SETTINGS = 'f{API}settings'
21-
FRONT_LED = 'f{API}led/get'
22-
BUTTON_ACTIONS = 'f{API}action'
23+
# Special endpoints
24+
LOG = "/log"
25+
FIRMWARE = "/load"
2326

27+
SETTINGS = "settings"
28+
FRONT_LED = "led/get"
29+
BUTTON_ACTIONS = "action"
2430

2531
# Configuration endpoints
26-
PIR_CONFIGURATION = 'f{API}pir_config'
27-
THERMOSTAT_CONFIGURATION = 'f{API}thermostat_config'
28-
INPUT_CONFIGURATION = 'f{API}input_config'
29-
32+
PIR_CONFIGURATION = "pir_config"
33+
THERMOSTAT_CONFIGURATION = "thermostat_config"
34+
INPUT_CONFIGURATION = "input_config"

0 commit comments

Comments
 (0)