File: endpoint.py

package info (click to toggle)
python-yolink-api 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 184 kB
  • sloc: python: 1,147; makefile: 2
file content (42 lines) | stat: -rw-r--r-- 999 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""SVR info."""

from dataclasses import dataclass
from enum import Enum


@dataclass(repr=True)
class Endpoint:
    """SVR endpoint."""

    name: str
    host: str
    url: str
    mqtt_broker_host: str
    mqtt_broker_port: int = 8003

    def __init__(self, name: str, host: str, url: str, mqtt_host: str, mqtt_port: int):
        """Init SVR Endpoint."""
        self.name = name
        self.host = host
        self.url = url
        self.mqtt_broker_host = mqtt_host
        self.mqtt_broker_port = mqtt_port


class Endpoints(Enum):
    """YoLink SVR Endpoints."""

    US: Endpoint = Endpoint(
        name="US",
        host="api.yosmart.com",
        url="https://api.yosmart.com/open/yolink/v2/api",
        mqtt_host="mqtt.api.yosmart.com",
        mqtt_port=8003,
    )
    EU: Endpoint = Endpoint(
        name="EU",
        host="api-eu.yosmart.com",
        url="https://api-eu.yosmart.com/open/yolink/v2/api",
        mqtt_host="api-eu.yosmart.com",
        mqtt_port=8003,
    )