id
int64 0
843k
| repository_name
stringlengths 7
55
| file_path
stringlengths 9
332
| class_name
stringlengths 3
290
| human_written_code
stringlengths 12
4.36M
| class_skeleton
stringlengths 19
2.2M
| total_program_units
int64 1
9.57k
| total_doc_str
int64 0
4.2k
| AvgCountLine
float64 0
7.89k
| AvgCountLineBlank
float64 0
300
| AvgCountLineCode
float64 0
7.89k
| AvgCountLineComment
float64 0
7.89k
| AvgCyclomatic
float64 0
130
| CommentToCodeRatio
float64 0
176
| CountClassBase
float64 0
48
| CountClassCoupled
float64 0
589
| CountClassCoupledModified
float64 0
581
| CountClassDerived
float64 0
5.37k
| CountDeclInstanceMethod
float64 0
4.2k
| CountDeclInstanceVariable
float64 0
299
| CountDeclMethod
float64 0
4.2k
| CountDeclMethodAll
float64 0
4.2k
| CountLine
float64 1
115k
| CountLineBlank
float64 0
9.01k
| CountLineCode
float64 0
94.4k
| CountLineCodeDecl
float64 0
46.1k
| CountLineCodeExe
float64 0
91.3k
| CountLineComment
float64 0
27k
| CountStmt
float64 1
93.2k
| CountStmtDecl
float64 0
46.1k
| CountStmtExe
float64 0
90.2k
| MaxCyclomatic
float64 0
759
| MaxInheritanceTree
float64 0
16
| MaxNesting
float64 0
34
| SumCyclomatic
float64 0
6k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
141,548 |
Kane610/axis
|
axis/models/parameters/image.py
|
axis.models.parameters.image.ImageTextParamT
|
class ImageTextParamT(TypedDict):
"""Represent a text object."""
BGColor: str
ClockEnabled: str
Color: str
DateEnabled: str
Position: str
String: str
TextEnabled: str
TextSize: str
|
class ImageTextParamT(TypedDict):
'''Represent a text object.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.11 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 1 | 9 | 1 | 8 | 1 | 9 | 1 | 8 | 0 | 1 | 0 | 0 |
141,549 |
Kane610/axis
|
axis/models/parameters/image.py
|
axis.models.parameters.image.ImageTriggerDataParamT
|
class ImageTriggerDataParamT(TypedDict):
"""Represent a trigger data object."""
AudioEnabled: bool
MotionDetectionEnabled: bool
MotionLevelEnabled: bool
TamperingEnabled: bool
UserTriggers: str
|
class ImageTriggerDataParamT(TypedDict):
'''Represent a trigger data object.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 1 | 6 | 1 | 5 | 1 | 6 | 1 | 5 | 0 | 1 | 0 | 0 |
141,550 |
Kane610/axis
|
axis/models/parameters/io_port.py
|
axis.models.parameters.io_port.IOPortParam
|
class IOPortParam(ParamItem):
"""Represents a IO port."""
configurable: bool
"""Is port configurable."""
direction: PortDirection
"""Port is configured to act as input or output.
Read-only for non-configurable ports.
"""
input_trigger: str
"""When port should trigger.
closed=The input port triggers when the circuit is closed.
open=The input port triggers when the circuit is open.
"""
name: str
"""Return name relevant to direction."""
output_active: str
"""When is output port state active.
closed=The output port is active when the circuit is closed.
open=The output port is active when the circuit is open.
"""
@classmethod
def decode(cls, data: tuple[str, PortParamT]) -> Self:
"""Decode dict to class object."""
id, raw = data
direction = PortDirection(raw.get("Direction", "input"))
name = (
raw.get("Input", {}).get("Name", "")
if direction == PortDirection.IN
else raw.get("Output", {}).get("Name", "")
)
return cls(
id=id,
configurable=raw.get("Configurable") is True,
direction=direction,
input_trigger=raw.get("Input", {}).get("Trig", ""),
name=name,
output_active=raw.get("Output", {}).get("Active", ""),
)
@classmethod
def decode_to_dict(cls, data: list[Any]) -> dict[str, Self]:
"""Create objects from dict."""
return {
v.id: v
for v in cls.decode_to_list([(k[1:], v) for k, v in data[0].items()])
}
|
class IOPortParam(ParamItem):
'''Represents a IO port.'''
@classmethod
def decode(cls, data: tuple[str, PortParamT]) -> Self:
'''Decode dict to class object.'''
pass
@classmethod
def decode_to_dict(cls, data: list[Any]) -> dict[str, Self]:
'''Create objects from dict.'''
pass
| 5 | 3 | 12 | 0 | 11 | 1 | 2 | 0.55 | 1 | 7 | 2 | 0 | 0 | 0 | 2 | 26 | 55 | 10 | 29 | 8 | 24 | 16 | 13 | 6 | 10 | 2 | 6 | 0 | 3 |
141,551 |
Kane610/axis
|
axis/models/parameters/io_port.py
|
axis.models.parameters.io_port.PortAction
|
class PortAction(enum.StrEnum):
"""Port action."""
HIGH = "/"
LOW = "\\"
UNKNOWN = "unknown"
@classmethod
def _missing_(cls, value: object) -> "PortAction":
"""Set default enum member if an unknown value is provided."""
return cls.UNKNOWN
|
class PortAction(enum.StrEnum):
'''Port action.'''
@classmethod
def _missing_(cls, value: object) -> "PortAction":
'''Set default enum member if an unknown value is provided.'''
pass
| 3 | 2 | 3 | 0 | 2 | 1 | 1 | 0.29 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 69 | 11 | 2 | 7 | 6 | 4 | 2 | 6 | 5 | 4 | 1 | 3 | 0 | 1 |
141,552 |
Kane610/axis
|
axis/models/parameters/io_port.py
|
axis.models.parameters.io_port.PortDirection
|
class PortDirection(enum.StrEnum):
"""Port action."""
IN = "input"
OUT = "output"
UNKNOWN = "unknown"
@classmethod
def _missing_(cls, value: object) -> "PortDirection":
"""Set default enum member if an unknown value is provided."""
return cls.UNKNOWN
|
class PortDirection(enum.StrEnum):
'''Port action.'''
@classmethod
def _missing_(cls, value: object) -> "PortDirection":
'''Set default enum member if an unknown value is provided.'''
pass
| 3 | 2 | 3 | 0 | 2 | 1 | 1 | 0.29 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 69 | 11 | 2 | 7 | 6 | 4 | 2 | 6 | 5 | 4 | 1 | 3 | 0 | 1 |
141,553 |
Kane610/axis
|
axis/models/parameters/ptz.py
|
axis.models.parameters.ptz.PtzImageSource
|
class PtzImageSource:
"""Image source."""
ptz_enabled: bool
@classmethod
def decode(cls, data: PtzImageSourceParamT) -> Self:
"""Decode dictionary to class object."""
return cls(ptz_enabled=data["PTZEnabled"])
@classmethod
def from_dict(cls, data: dict[str, PtzImageSourceParamT]) -> dict[str, Self]:
"""Create objects from dict."""
return {k[1:]: cls.decode(v) for k, v in data.items()}
|
class PtzImageSource:
'''Image source.'''
@classmethod
def decode(cls, data: PtzImageSourceParamT) -> Self:
'''Decode dictionary to class object.'''
pass
@classmethod
def from_dict(cls, data: dict[str, PtzImageSourceParamT]) -> dict[str, Self]:
'''Create objects from dict.'''
pass
| 5 | 3 | 3 | 0 | 2 | 1 | 1 | 0.38 | 0 | 3 | 1 | 0 | 0 | 0 | 2 | 2 | 14 | 3 | 8 | 5 | 3 | 3 | 6 | 3 | 3 | 1 | 0 | 0 | 2 |
141,554 |
Kane610/axis
|
axis/models/mqtt.py
|
axis.models.mqtt.SslT
|
class SslT(TypedDict):
"""Represent a SSL object."""
validateServerCert: bool
CACertID: NotRequired[str]
clientCertID: NotRequired[str]
|
class SslT(TypedDict):
'''Represent a SSL object.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 1 | 4 | 1 | 3 | 1 | 4 | 1 | 3 | 0 | 1 | 0 | 0 |
141,555 |
Kane610/axis
|
axis/models/parameters/ptz.py
|
axis.models.parameters.ptz.PtzImageSourceParamT
|
class PtzImageSourceParamT(TypedDict):
"""PTZ image source description."""
PTZEnabled: bool
|
class PtzImageSourceParamT(TypedDict):
'''PTZ image source description.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
141,556 |
Kane610/axis
|
axis/models/parameters/ptz.py
|
axis.models.parameters.ptz.PtzLimitParamT
|
class PtzLimitParamT(TypedDict):
"""PTZ limit data description."""
MaxBrightness: NotRequired[int]
MaxFieldAngle: NotRequired[int]
MaxFocus: NotRequired[int]
MaxIris: NotRequired[int]
MaxPan: NotRequired[int]
MaxTilt: NotRequired[int]
MaxZoom: NotRequired[int]
MinBrightness: NotRequired[int]
MinFieldAngle: NotRequired[int]
MinFocus: NotRequired[int]
MinIris: NotRequired[int]
MinPan: NotRequired[int]
MinTilt: NotRequired[int]
MinZoom: NotRequired[int]
|
class PtzLimitParamT(TypedDict):
'''PTZ limit data description.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.07 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 17 | 1 | 15 | 1 | 14 | 1 | 15 | 1 | 14 | 0 | 1 | 0 | 0 |
141,557 |
Kane610/axis
|
axis/models/pir_sensor_configuration.py
|
axis.models.pir_sensor_configuration.ListSensorsResponseT
|
class ListSensorsResponseT(TypedDict):
"""ListSensors response."""
apiVersion: str
context: str
method: str
data: ListSensorsDataT
error: NotRequired[ErrorDataT]
|
class ListSensorsResponseT(TypedDict):
'''ListSensors response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 1 | 6 | 1 | 5 | 1 | 6 | 1 | 5 | 0 | 1 | 0 | 0 |
141,558 |
Kane610/axis
|
axis/models/pir_sensor_configuration.py
|
axis.models.pir_sensor_configuration.PirSensorConfiguration
|
class PirSensorConfiguration(ApiItem):
"""Pir sensor configuration representation."""
configurable: bool
sensitivity: float | None = None
@classmethod
def decode(cls, data: PirSensorConfigurationT) -> Self:
"""Decode dict to class object."""
return cls(
id=str(data["id"]),
configurable=data["sensitivityConfigurable"],
sensitivity=data.get("sensitivity"),
)
|
class PirSensorConfiguration(ApiItem):
'''Pir sensor configuration representation.'''
@classmethod
def decode(cls, data: PirSensorConfigurationT) -> Self:
'''Decode dict to class object.'''
pass
| 3 | 2 | 7 | 0 | 6 | 1 | 1 | 0.2 | 1 | 2 | 1 | 0 | 0 | 0 | 1 | 24 | 14 | 2 | 10 | 4 | 7 | 2 | 5 | 3 | 3 | 1 | 5 | 0 | 1 |
141,559 |
Kane610/axis
|
axis/models/pir_sensor_configuration.py
|
axis.models.pir_sensor_configuration.PirSensorConfigurationT
|
class PirSensorConfigurationT(TypedDict):
"""Pir sensor configuration representation."""
id: int
sensitivityConfigurable: bool
sensitivity: NotRequired[float]
|
class PirSensorConfigurationT(TypedDict):
'''Pir sensor configuration representation.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 1 | 4 | 1 | 3 | 1 | 4 | 1 | 3 | 0 | 1 | 0 | 0 |
141,560 |
Kane610/axis
|
axis/models/pir_sensor_configuration.py
|
axis.models.pir_sensor_configuration.SetSensitivityRequest
|
class SetSensitivityRequest(ApiRequest):
"""Request object for setting PIR sensor sensitivity."""
method = "post"
path = "/axis-cgi/pirsensor.cgi"
content_type = "application/json"
error_codes = sensor_specific_error_codes
id: int
sensitivity: float
api_version: str = API_VERSION
context: str = CONTEXT
@property
def content(self) -> bytes:
"""Initialize request data."""
return orjson.dumps(
{
"apiVersion": self.api_version,
"context": self.context,
"method": "setSensitivity",
"params": {
"id": self.id,
"sensitivity": self.sensitivity,
},
}
)
|
class SetSensitivityRequest(ApiRequest):
'''Request object for setting PIR sensor sensitivity.'''
@property
def content(self) -> bytes:
'''Initialize request data.'''
pass
| 3 | 2 | 13 | 0 | 12 | 1 | 1 | 0.09 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 5 | 28 | 4 | 22 | 9 | 19 | 2 | 11 | 8 | 9 | 1 | 1 | 0 | 1 |
141,561 |
Kane610/axis
|
axis/models/pir_sensor_configuration.py
|
axis.models.pir_sensor_configuration.SetSensitivityResponseT
|
class SetSensitivityResponseT(TypedDict):
"""SetSensitivity response."""
apiVersion: str
context: str
method: str
error: NotRequired[ErrorDataT]
|
class SetSensitivityResponseT(TypedDict):
'''SetSensitivity response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | 1 | 5 | 1 | 4 | 1 | 5 | 1 | 4 | 0 | 1 | 0 | 0 |
141,562 |
Kane610/axis
|
axis/models/port_cgi.py
|
axis.models.port_cgi.PortActionRequest
|
class PortActionRequest(ApiRequest):
r"""Request object for activate or deactivate an output.
Use the <wait> option to activate/deactivate the port for a
limited period of time.
<Port ID> = Port name. Default: Name from Output.Name
<a> = Action character. /=active, \=inactive
<wait> = Delay before the next action. Unit: milliseconds
Note: The :, / and \ characters must be percent-encoded in the URI.
See Percent encoding.
Example:
-------
To set output 1 to active, use 1:/.
In the URI, the action argument becomes action=1%3A%2F
"""
method = "get"
path = "/axis-cgi/io/port.cgi"
content_type = "text/plain"
port: str
action: str
@property
def params(self) -> dict[str, str]:
"""Request query parameters."""
return {"action": f"{int(self.port) + 1}:{self.action}"}
|
class PortActionRequest(ApiRequest):
'''Request object for activate or deactivate an output.
Use the <wait> option to activate/deactivate the port for a
limited period of time.
<Port ID> = Port name. Default: Name from Output.Name
<a> = Action character. /=active, \=inactive
<wait> = Delay before the next action. Unit: milliseconds
Note: The :, / and \ characters must be percent-encoded in the URI.
See Percent encoding.
Example:
-------
To set output 1 to active, use 1:/.
In the URI, the action argument becomes action=1%3A%2F
'''
@property
def params(self) -> dict[str, str]:
'''Request query parameters.'''
pass
| 3 | 2 | 3 | 0 | 2 | 1 | 1 | 1.56 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 5 | 29 | 6 | 9 | 6 | 6 | 14 | 8 | 5 | 6 | 1 | 1 | 0 | 1 |
141,563 |
Kane610/axis
|
axis/models/port_management.py
|
axis.models.port_management.GetPortsRequest
|
class GetPortsRequest(ApiRequest):
"""Request object for listing ports."""
method = "post"
path = "/axis-cgi/io/portmanagement.cgi"
content_type = "application/json"
error_codes = error_codes
api_version: str = API_VERSION
context: str = CONTEXT
@property
def content(self) -> bytes:
"""Initialize request data."""
return orjson.dumps(
{
"apiVersion": self.api_version,
"context": self.context,
"method": "getPorts",
}
)
|
class GetPortsRequest(ApiRequest):
'''Request object for listing ports.'''
@property
def content(self) -> bytes:
'''Initialize request data.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.13 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 5 | 21 | 3 | 16 | 9 | 13 | 2 | 9 | 8 | 7 | 1 | 1 | 0 | 1 |
141,564 |
Kane610/axis
|
axis/models/pir_sensor_configuration.py
|
axis.models.pir_sensor_configuration.ListSensorsResponse
|
class ListSensorsResponse(ApiResponse[dict[str, PirSensorConfiguration]]):
"""Response object for list sensors response."""
api_version: str
context: str
method: str
data: dict[str, PirSensorConfiguration]
# error: ErrorDataT | None = None
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
"""Prepare response data."""
data: ListSensorsResponseT = orjson.loads(bytes_data)
return cls(
api_version=data["apiVersion"],
context=data["context"],
method=data["method"],
data=PirSensorConfiguration.decode_to_dict(data["data"]["sensors"]),
)
|
class ListSensorsResponse(ApiResponse[dict[str, PirSensorConfiguration]]):
'''Response object for list sensors response.'''
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
'''Prepare response data.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.21 | 1 | 3 | 2 | 0 | 0 | 0 | 1 | 24 | 19 | 2 | 14 | 4 | 11 | 3 | 8 | 3 | 6 | 1 | 6 | 0 | 1 |
141,565 |
Kane610/axis
|
axis/models/port_management.py
|
axis.models.port_management.GetPortsResponse
|
class GetPortsResponse(ApiResponse[dict[str, Port]]):
"""Response object for listing ports."""
api_version: str
context: str
method: str
data: dict[str, Port]
# error: ErrorDataT | None = None
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
"""Prepare API description dictionary."""
data: GetPortsResponseT = orjson.loads(bytes_data)
return cls(
api_version=data["apiVersion"],
context=data["context"],
method=data["method"],
data=Port.decode_to_dict(data["data"].get("items", [])),
)
|
class GetPortsResponse(ApiResponse[dict[str, Port]]):
'''Response object for listing ports.'''
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
'''Prepare API description dictionary.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.21 | 1 | 3 | 2 | 0 | 0 | 0 | 1 | 24 | 19 | 2 | 14 | 4 | 11 | 3 | 8 | 3 | 6 | 1 | 6 | 0 | 1 |
141,566 |
Kane610/axis
|
axis/models/port_management.py
|
axis.models.port_management.GetSupportedVersionsRequest
|
class GetSupportedVersionsRequest(ApiRequest):
"""Request object for listing supported API versions."""
method = "post"
path = "/axis-cgi/io/portmanagement.cgi"
content_type = "application/json"
error_codes = error_codes
context: str = CONTEXT
@property
def content(self) -> bytes:
"""Initialize request data."""
return orjson.dumps(
{
"context": self.context,
"method": "getSupportedVersions",
}
)
|
class GetSupportedVersionsRequest(ApiRequest):
'''Request object for listing supported API versions.'''
@property
def content(self) -> bytes:
'''Initialize request data.'''
pass
| 3 | 2 | 8 | 0 | 7 | 1 | 1 | 0.14 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 5 | 19 | 3 | 14 | 8 | 11 | 2 | 8 | 7 | 6 | 1 | 1 | 0 | 1 |
141,567 |
Kane610/axis
|
axis/models/port_management.py
|
axis.models.port_management.GetSupportedVersionsResponse
|
class GetSupportedVersionsResponse(ApiResponse[list[str]]):
"""Response object for supported versions."""
api_version: str
context: str
method: str
data: list[str]
# error: ErrorDataT | None = None
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
"""Prepare API description dictionary."""
data: GetSupportedVersionsResponseT = orjson.loads(bytes_data)
return cls(
api_version=data["apiVersion"],
context=data["context"],
method=data["method"],
data=data.get("data", {}).get("apiVersions", []),
)
|
class GetSupportedVersionsResponse(ApiResponse[list[str]]):
'''Response object for supported versions.'''
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
'''Prepare API description dictionary.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.21 | 1 | 2 | 1 | 0 | 0 | 0 | 1 | 24 | 19 | 2 | 14 | 4 | 11 | 3 | 8 | 3 | 6 | 1 | 6 | 0 | 1 |
141,568 |
Kane610/axis
|
axis/models/port_management.py
|
axis.models.port_management.Port
|
class Port(ApiItem):
"""I/O port management port."""
configurable: bool
"""Is port configurable."""
direction: str
"""Direction of port.
<input|output>.
"""
name: str
"""Name of port."""
normal_state: str
"""Port normal state.
<open|closed>.
"""
state: str
"""State of port.
<open|closed>.
"""
usage: str
"""Usage of port."""
@classmethod
def decode(cls, data: PortItemT) -> Self:
"""Create object from dict."""
return cls(
id=data["port"],
configurable=data["configurable"],
direction=data["direction"],
name=data["name"],
normal_state=data["normalState"],
state=data["state"],
usage=data["usage"],
)
|
class Port(ApiItem):
'''I/O port management port.'''
@classmethod
def decode(cls, data: PortItemT) -> Self:
'''Create object from dict.'''
pass
| 3 | 2 | 11 | 0 | 10 | 1 | 1 | 0.78 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 24 | 42 | 10 | 18 | 3 | 15 | 14 | 9 | 2 | 7 | 1 | 5 | 0 | 1 |
141,569 |
Kane610/axis
|
axis/models/port_management.py
|
axis.models.port_management.PortConfiguration
|
class PortConfiguration:
"""Port configuration used with set_ports interface."""
port: str
usage: str | None = None
direction: str | None = None
name: str | None = None
normal_state: str | None = None
state: str | None = None
def to_dict(self) -> dict[str, str]:
"""Convert to dictionary with populated fields."""
data: dict[str, str] = {"port": self.port}
if self.usage is not None:
data["usage"] = self.usage
if self.direction is not None:
data["direction"] = self.direction
if self.name is not None:
data["name"] = self.name
if self.normal_state is not None:
data["normalState"] = self.normal_state
if self.state is not None:
data["state"] = self.state
return data
|
class PortConfiguration:
'''Port configuration used with set_ports interface.'''
def to_dict(self) -> dict[str, str]:
'''Convert to dictionary with populated fields.'''
pass
| 2 | 2 | 14 | 0 | 13 | 1 | 6 | 0.1 | 0 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 24 | 2 | 20 | 8 | 18 | 2 | 20 | 8 | 18 | 6 | 0 | 1 | 6 |
141,570 |
Kane610/axis
|
axis/models/port_management.py
|
axis.models.port_management.PortDataT
|
class PortDataT(TypedDict):
"""Port getPorts response."""
numberOfPorts: int
items: list[PortItemT]
|
class PortDataT(TypedDict):
'''Port getPorts response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 1 | 3 | 1 | 2 | 1 | 3 | 1 | 2 | 0 | 1 | 0 | 0 |
141,571 |
Kane610/axis
|
axis/models/port_management.py
|
axis.models.port_management.PortItemT
|
class PortItemT(TypedDict):
"""Port representation."""
port: str
configurable: bool
usage: str
name: str
direction: str
state: str
normalState: str
|
class PortItemT(TypedDict):
'''Port representation.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.13 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 1 | 8 | 1 | 7 | 1 | 8 | 1 | 7 | 0 | 1 | 0 | 0 |
141,572 |
Kane610/axis
|
axis/models/port_management.py
|
axis.models.port_management.PortSequence
|
class PortSequence:
"""Port sequence class."""
port: str
sequence: list[Sequence]
|
class PortSequence:
'''Port sequence class.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.33 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 1 | 3 | 1 | 2 | 1 | 3 | 1 | 2 | 0 | 0 | 0 | 0 |
141,573 |
Kane610/axis
|
axis/models/port_management.py
|
axis.models.port_management.GetPortsResponseT
|
class GetPortsResponseT(TypedDict):
"""Get ports response data."""
apiVersion: str
context: str
method: str
data: PortDataT
error: NotRequired[ErrorDataT]
|
class GetPortsResponseT(TypedDict):
'''Get ports response data.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 1 | 6 | 1 | 5 | 1 | 6 | 1 | 5 | 0 | 1 | 0 | 0 |
141,574 |
Kane610/axis
|
axis/models/pir_sensor_configuration.py
|
axis.models.pir_sensor_configuration.ListSensorsRequest
|
class ListSensorsRequest(ApiRequest):
"""Request object for listing PIR sensors."""
method = "post"
path = "/axis-cgi/pirsensor.cgi"
content_type = "application/json"
error_codes = general_error_codes
api_version: str = API_VERSION
context: str = CONTEXT
@property
def content(self) -> bytes:
"""Initialize request data."""
return orjson.dumps(
{
"apiVersion": self.api_version,
"context": self.context,
"method": "listSensors",
}
)
|
class ListSensorsRequest(ApiRequest):
'''Request object for listing PIR sensors.'''
@property
def content(self) -> bytes:
'''Initialize request data.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.13 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 5 | 21 | 3 | 16 | 9 | 13 | 2 | 9 | 8 | 7 | 1 | 1 | 0 | 1 |
141,575 |
Kane610/axis
|
axis/models/pir_sensor_configuration.py
|
axis.models.pir_sensor_configuration.ListSensorsDataT
|
class ListSensorsDataT(TypedDict):
"""List of Pir sensor configuration data."""
sensors: list[PirSensorConfigurationT]
|
class ListSensorsDataT(TypedDict):
'''List of Pir sensor configuration data.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
141,576 |
Kane610/axis
|
axis/models/pir_sensor_configuration.py
|
axis.models.pir_sensor_configuration.GetSupportedVersionsResponseT
|
class GetSupportedVersionsResponseT(TypedDict):
"""ListSensors response."""
apiVersion: str
context: str
method: str
data: ApiVersionsT
error: NotRequired[ErrorDataT]
|
class GetSupportedVersionsResponseT(TypedDict):
'''ListSensors response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 1 | 6 | 1 | 5 | 1 | 6 | 1 | 5 | 0 | 1 | 0 | 0 |
141,577 |
Kane610/axis
|
axis/models/parameters/ptz.py
|
axis.models.parameters.ptz.PtzParam
|
class PtzParam(ParamItem):
"""PTZ parameters."""
camera_default: int
"""PTZ default video channel.
When camera parameter is omitted in HTTP requests.
"""
number_of_cameras: int
"""Amount of video channels."""
number_of_serial_ports: int
"""Amount of serial ports."""
cam_ports: dict[str, int]
image_source: dict[str, PtzImageSource]
limits: dict[str, PtzLimit]
"""PTZ.Limit.L# are populated when a driver is installed on a video channel."""
support: dict[str, PtzSupport]
"""PTZ.Support.S# are populated when a driver is installed on a video channel."""
various: dict[str, PtzVarious]
"""PTZ.Various.V# are populated when a driver is installed on a video channel."""
@classmethod
def decode(cls, data: PtzParamT) -> Self:
"""Decode dictionary to class object."""
return cls(
id="ptz",
camera_default=data["CameraDefault"],
number_of_cameras=data.get("NbrOfCameras", 1),
number_of_serial_ports=data["NbrOfSerPorts"],
cam_ports=data["CamPorts"],
image_source=PtzImageSource.from_dict(data["ImageSource"]),
limits=PtzLimit.from_dict(data.get("Limit", {})),
support=PtzSupport.from_dict(data.get("Support", {})),
various=PtzVarious.from_dict(data.get("Various", {})),
)
|
class PtzParam(ParamItem):
'''PTZ parameters.'''
@classmethod
def decode(cls, data: PtzParamT) -> Self:
'''Decode dictionary to class object.'''
pass
| 3 | 2 | 13 | 0 | 12 | 1 | 1 | 0.45 | 1 | 5 | 5 | 0 | 0 | 0 | 1 | 25 | 42 | 10 | 22 | 3 | 19 | 10 | 11 | 2 | 9 | 1 | 6 | 0 | 1 |
141,578 |
Kane610/axis
|
axis/models/parameters/ptz.py
|
axis.models.parameters.ptz.PtzParamT
|
class PtzParamT(TypedDict):
"""PTZ representation."""
BoaProtPTZOperator: str
CameraDefault: int
NbrOfCameras: int
NbrOfSerPorts: int
CamPorts: dict[str, int]
ImageSource: dict[str, PtzImageSourceParamT]
Limit: NotRequired[dict[str, PtzLimitParamT]]
Preset: dict[str, PtzPresetParamT]
PTZDriverStatuses: dict[str, int]
Support: NotRequired[dict[str, PtzSupportParamT]]
UserAdv: dict[str, PtzUserAdvParamT]
UserCtlQueue: dict[str, PtzUserCtlQueueParamT]
Various: NotRequired[dict[str, PtzVariousParamT]]
|
class PtzParamT(TypedDict):
'''PTZ representation.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.07 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 16 | 1 | 14 | 1 | 13 | 1 | 14 | 1 | 13 | 0 | 1 | 0 | 0 |
141,579 |
Kane610/axis
|
axis/models/parameters/ptz.py
|
axis.models.parameters.ptz.PtzPresetParamT
|
class PtzPresetParamT(TypedDict):
"""PTZ preset data description."""
HomePosition: int
ImageSource: int
Name: str | None
Position: dict[str, PresetPositionT]
|
class PtzPresetParamT(TypedDict):
'''PTZ preset data description.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | 1 | 5 | 1 | 4 | 1 | 5 | 1 | 4 | 0 | 1 | 0 | 0 |
141,580 |
Kane610/axis
|
axis/models/parameters/ptz.py
|
axis.models.parameters.ptz.PtzSupport
|
class PtzSupport:
"""PTZ.Support.S# are populated when a driver is installed on a video channel.
A parameter in the group has the value true if the corresponding capability
is supported by the driver. The index # is the video channel number
which starts from 1.
An absolute operation means moving to a certain position,
a relative operation means moving relative to the current position.
Arguments referred to apply to PTZ control.
"""
absolute_brightness: bool
absolute_focus: bool
absolute_iris: bool
absolute_pan: bool
absolute_tilt: bool
absolute_zoom: bool
action_notification: bool
area_zoom: bool
auto_focus: bool
auto_ir_cut_filter: bool
auto_iris: bool
auxiliary: bool
back_light: bool
continuous_brightness: bool
continuous_focus: bool
continuous_iris: bool
continuous_pan: bool
continuous_tilt: bool
continuous_zoom: bool
device_preset: bool
digital_zoom: bool
generic_http: bool
ir_cut_filter: bool
joystick_emulation: bool
lens_offset: bool
osd_menu: bool
proportional_speed: bool
relative_brightness: bool
relative_focus: bool
relative_iris: bool
relative_pan: bool
relative_tilt: bool
relative_zoom: bool
server_preset: bool
speed_control: bool
@classmethod
def decode(cls, data: PtzSupportParamT) -> Self:
"""Decode dictionary to class object."""
return cls(
absolute_brightness=data["AbsoluteBrightness"],
absolute_focus=data["AbsoluteFocus"],
absolute_iris=data["AbsoluteIris"],
absolute_pan=data["AbsolutePan"],
absolute_tilt=data["AbsoluteTilt"],
absolute_zoom=data["AbsoluteZoom"],
action_notification=data["ActionNotification"],
area_zoom=data["AreaZoom"],
auto_focus=data["AutoFocus"],
auto_ir_cut_filter=data["AutoIrCutFilter"],
auto_iris=data["AutoIris"],
auxiliary=data["Auxiliary"],
back_light=data["BackLight"],
continuous_brightness=data["ContinuousBrightness"],
continuous_focus=data["ContinuousFocus"],
continuous_iris=data["ContinuousIris"],
continuous_pan=data["ContinuousPan"],
continuous_tilt=data["ContinuousTilt"],
continuous_zoom=data["ContinuousZoom"],
device_preset=data["DevicePreset"],
digital_zoom=data["DigitalZoom"],
generic_http=data["GenericHTTP"],
ir_cut_filter=data["IrCutFilter"],
joystick_emulation=data["JoyStickEmulation"],
lens_offset=data["LensOffset"],
osd_menu=data["OSDMenu"],
proportional_speed=data["ProportionalSpeed"],
relative_brightness=data["RelativeBrightness"],
relative_focus=data["RelativeFocus"],
relative_iris=data["RelativeIris"],
relative_pan=data["RelativePan"],
relative_tilt=data["RelativeTilt"],
relative_zoom=data["RelativeZoom"],
server_preset=data["ServerPreset"],
speed_control=data["SpeedCtl"],
)
@classmethod
def from_dict(cls, data: dict[str, PtzSupportParamT]) -> dict[str, Self]:
"""Create objects from dict."""
return {k[1:]: cls.decode(v) for k, v in data.items()}
|
class PtzSupport:
'''PTZ.Support.S# are populated when a driver is installed on a video channel.
A parameter in the group has the value true if the corresponding capability
is supported by the driver. The index # is the video channel number
which starts from 1.
An absolute operation means moving to a certain position,
a relative operation means moving relative to the current position.
Arguments referred to apply to PTZ control.
'''
@classmethod
def decode(cls, data: PtzSupportParamT) -> Self:
'''Decode dictionary to class object.'''
pass
@classmethod
def from_dict(cls, data: dict[str, PtzSupportParamT]) -> dict[str, Self]:
'''Create objects from dict.'''
pass
| 5 | 3 | 21 | 0 | 20 | 1 | 1 | 0.13 | 0 | 3 | 1 | 0 | 0 | 0 | 2 | 2 | 92 | 4 | 78 | 5 | 73 | 10 | 40 | 3 | 37 | 1 | 0 | 0 | 2 |
141,581 |
Kane610/axis
|
axis/models/parameters/ptz.py
|
axis.models.parameters.ptz.PtzSupportParamT
|
class PtzSupportParamT(TypedDict):
"""PTZ support data description."""
AbsoluteBrightness: bool
AbsoluteFocus: bool
AbsoluteIris: bool
AbsolutePan: bool
AbsoluteTilt: bool
AbsoluteZoom: bool
ActionNotification: bool
AreaZoom: bool
AutoFocus: bool
AutoIrCutFilter: bool
AutoIris: bool
Auxiliary: bool
BackLight: bool
ContinuousBrightness: bool
ContinuousFocus: bool
ContinuousIris: bool
ContinuousPan: bool
ContinuousTilt: bool
ContinuousZoom: bool
DevicePreset: bool
DigitalZoom: bool
GenericHTTP: bool
IrCutFilter: bool
JoyStickEmulation: bool
LensOffset: bool
OSDMenu: bool
ProportionalSpeed: bool
RelativeBrightness: bool
RelativeFocus: bool
RelativeIris: bool
RelativePan: bool
RelativeTilt: bool
RelativeZoom: bool
ServerPreset: bool
SpeedCtl: bool
|
class PtzSupportParamT(TypedDict):
'''PTZ support data description.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.03 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 38 | 1 | 36 | 1 | 35 | 1 | 36 | 1 | 35 | 0 | 1 | 0 | 0 |
141,582 |
Kane610/axis
|
axis/models/parameters/ptz.py
|
axis.models.parameters.ptz.PtzUserAdvParamT
|
class PtzUserAdvParamT(TypedDict):
"""PTZ user adv data description."""
MoveSpeed: int
|
class PtzUserAdvParamT(TypedDict):
'''PTZ user adv data description.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
141,583 |
Kane610/axis
|
axis/models/parameters/ptz.py
|
axis.models.parameters.ptz.PtzUserCtlQueueParamT
|
class PtzUserCtlQueueParamT(TypedDict):
"""PTZ user control queue data description."""
Priority: int
TimeoutTime: int
TimeoutType: str
UseCookie: str
UserGroup: str
|
class PtzUserCtlQueueParamT(TypedDict):
'''PTZ user control queue data description.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 1 | 6 | 1 | 5 | 1 | 6 | 1 | 5 | 0 | 1 | 0 | 0 |
141,584 |
Kane610/axis
|
axis/models/parameters/ptz.py
|
axis.models.parameters.ptz.PtzVarious
|
class PtzVarious:
"""PTZ.Various.V# are populated when a driver is installed on a video channel.
The index # is the video channel number which starts from 1.
The group consists of several different types of parameters for the video channel.
To distinguish the parameter types, the group is presented as
three different categories below. The Enabled parameters determine
if a specific feature can be controlled using ptz.cgi (see section PTZ control).
"""
control_queueing: bool
control_queue_limit: int
control_queue_poll_time: int
home_preset_set: bool | None
locked: bool
max_proportional_speed: int | None
pan_enabled: bool | None
proportional_speed_enabled: bool | None
return_to_overview: int | None
speed_control_enabled: bool | None
tilt_enabled: bool | None
zoom_enabled: bool | None
@classmethod
def decode(cls, data: PtzVariousParamT) -> Self:
"""Decode dictionary to class object."""
return cls(
control_queueing=data["CtlQueueing"],
control_queue_limit=data["CtlQueueLimit"],
control_queue_poll_time=data["CtlQueuePollTime"],
home_preset_set=data.get("HomePresetSet"),
locked=data.get("Locked", False),
max_proportional_speed=data.get("MaxProportionalSpeed"),
pan_enabled=data.get("PanEnabled"),
proportional_speed_enabled=data.get("ProportionalSpeedEnabled"),
return_to_overview=data.get("ReturnToOverview"),
speed_control_enabled=data.get("SpeedCtlEnabled"),
tilt_enabled=data.get("TiltEnabled"),
zoom_enabled=data.get("ZoomEnabled"),
)
@classmethod
def from_dict(cls, data: dict[str, PtzVariousParamT]) -> dict[str, Self]:
"""Create objects from dict."""
return {k[1:]: cls.decode(v) for k, v in data.items()}
|
class PtzVarious:
'''PTZ.Various.V# are populated when a driver is installed on a video channel.
The index # is the video channel number which starts from 1.
The group consists of several different types of parameters for the video channel.
To distinguish the parameter types, the group is presented as
three different categories below. The Enabled parameters determine
if a specific feature can be controlled using ptz.cgi (see section PTZ control).
'''
@classmethod
def decode(cls, data: PtzVariousParamT) -> Self:
'''Decode dictionary to class object.'''
pass
@classmethod
def from_dict(cls, data: dict[str, PtzVariousParamT]) -> dict[str, Self]:
'''Create objects from dict.'''
pass
| 5 | 3 | 10 | 0 | 9 | 1 | 1 | 0.28 | 0 | 3 | 1 | 0 | 0 | 0 | 2 | 2 | 45 | 4 | 32 | 5 | 27 | 9 | 17 | 3 | 14 | 1 | 0 | 0 | 2 |
141,585 |
Kane610/axis
|
axis/models/parameters/ptz.py
|
axis.models.parameters.ptz.PtzVariousParamT
|
class PtzVariousParamT(TypedDict):
"""PTZ various configurations data description."""
CtlQueueing: bool
CtlQueueLimit: int
CtlQueuePollTime: int
HomePresetSet: bool
Locked: NotRequired[bool]
MaxProportionalSpeed: NotRequired[int]
PanEnabled: NotRequired[bool]
ProportionalSpeedEnabled: NotRequired[bool]
ReturnToOverview: int
SpeedCtlEnabled: NotRequired[bool]
TiltEnabled: NotRequired[bool]
ZoomEnabled: NotRequired[bool]
|
class PtzVariousParamT(TypedDict):
'''PTZ various configurations data description.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.08 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 15 | 1 | 13 | 1 | 12 | 1 | 13 | 1 | 12 | 0 | 1 | 0 | 0 |
141,586 |
Kane610/axis
|
axis/models/parameters/stream_profile.py
|
axis.models.parameters.stream_profile.ProfileParamT
|
class ProfileParamT(TypedDict):
"""Profile descriptions."""
Description: str
Name: str
Parameters: str
|
class ProfileParamT(TypedDict):
'''Profile descriptions.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 1 | 4 | 1 | 3 | 1 | 4 | 1 | 3 | 0 | 1 | 0 | 0 |
141,587 |
Kane610/axis
|
axis/models/parameters/stream_profile.py
|
axis.models.parameters.stream_profile.StreamProfileParam
|
class StreamProfileParam(ParamItem):
"""Stream profile parameters."""
max_groups: int
"""Maximum number of supported stream profiles."""
stream_profiles: list[StreamProfile]
"""List of stream profiles."""
@classmethod
def decode(cls, data: dict[str, Any]) -> Self:
"""Decode dictionary to class object."""
max_groups = int(data.get("MaxGroups", 0))
raw_profiles = dict(data)
raw_profiles.pop("MaxGroups", None)
stream_profiles = [
StreamProfile(
id=profile["Name"],
description=profile["Description"],
parameters=profile["Parameters"],
)
for profile in cast(dict[str, ProfileParamT], raw_profiles).values()
]
return cls(
id="stream profiles",
max_groups=max_groups,
stream_profiles=stream_profiles,
)
|
class StreamProfileParam(ParamItem):
'''Stream profile parameters.'''
@classmethod
def decode(cls, data: dict[str, Any]) -> Self:
'''Decode dictionary to class object.'''
pass
| 3 | 2 | 21 | 3 | 17 | 1 | 1 | 0.19 | 1 | 6 | 2 | 0 | 0 | 0 | 1 | 25 | 31 | 6 | 21 | 6 | 18 | 4 | 9 | 5 | 7 | 1 | 6 | 0 | 1 |
141,588 |
Kane610/axis
|
axis/models/parameters/stream_profile.py
|
axis.models.parameters.stream_profile.StreamProfileParamT
|
class StreamProfileParamT(TypedDict):
"""Represent a property object."""
MaxGroups: int
S0: NotRequired[ProfileParamT]
S1: NotRequired[ProfileParamT]
S2: NotRequired[ProfileParamT]
S3: NotRequired[ProfileParamT]
|
class StreamProfileParamT(TypedDict):
'''Represent a property object.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 1 | 6 | 1 | 5 | 1 | 6 | 1 | 5 | 0 | 1 | 0 | 0 |
141,589 |
Kane610/axis
|
axis/models/pir_sensor_configuration.py
|
axis.models.pir_sensor_configuration.GetSensitivityDataT
|
class GetSensitivityDataT(TypedDict):
"""Sensitivity data."""
sensitivity: float
|
class GetSensitivityDataT(TypedDict):
'''Sensitivity data.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
141,590 |
Kane610/axis
|
axis/models/pir_sensor_configuration.py
|
axis.models.pir_sensor_configuration.GetSensitivityRequest
|
class GetSensitivityRequest(ApiRequest):
"""Request object for getting PIR sensor sensitivity."""
method = "post"
path = "/axis-cgi/pirsensor.cgi"
content_type = "application/json"
error_codes = sensor_specific_error_codes
id: int
api_version: str = API_VERSION
context: str = CONTEXT
@property
def content(self) -> bytes:
"""Initialize request data."""
return orjson.dumps(
{
"apiVersion": self.api_version,
"context": self.context,
"method": "getSensitivity",
"params": {
"id": self.id,
},
}
)
|
class GetSensitivityRequest(ApiRequest):
'''Request object for getting PIR sensor sensitivity.'''
@property
def content(self) -> bytes:
'''Initialize request data.'''
pass
| 3 | 2 | 12 | 0 | 11 | 1 | 1 | 0.1 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 5 | 26 | 4 | 20 | 9 | 17 | 2 | 10 | 8 | 8 | 1 | 1 | 0 | 1 |
141,591 |
Kane610/axis
|
axis/models/pir_sensor_configuration.py
|
axis.models.pir_sensor_configuration.GetSensitivityResponse
|
class GetSensitivityResponse(ApiResponse[float | None]):
"""Response object for get sensitivity response."""
api_version: str
context: str
method: str
data: float | None
# error: ErrorDataT | None = None
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
"""Prepare response data."""
data: GetSensitivityResponseT = orjson.loads(bytes_data)
return cls(
api_version=data["apiVersion"],
context=data["context"],
method=data["method"],
data=data["data"]["sensitivity"],
)
|
class GetSensitivityResponse(ApiResponse[float | None]):
'''Response object for get sensitivity response.'''
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
'''Prepare response data.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.21 | 1 | 2 | 1 | 0 | 0 | 0 | 1 | 24 | 19 | 2 | 14 | 4 | 11 | 3 | 8 | 3 | 6 | 1 | 6 | 0 | 1 |
141,592 |
Kane610/axis
|
axis/models/pir_sensor_configuration.py
|
axis.models.pir_sensor_configuration.GetSensitivityResponseT
|
class GetSensitivityResponseT(TypedDict):
"""GetSensitivity response."""
apiVersion: str
context: str
method: str
data: GetSensitivityDataT
error: NotRequired[ErrorDataT]
|
class GetSensitivityResponseT(TypedDict):
'''GetSensitivity response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 1 | 6 | 1 | 5 | 1 | 6 | 1 | 5 | 0 | 1 | 0 | 0 |
141,593 |
Kane610/axis
|
axis/models/pir_sensor_configuration.py
|
axis.models.pir_sensor_configuration.GetSupportedVersionsRequest
|
class GetSupportedVersionsRequest(ApiRequest):
"""Request object for listing supported API versions."""
method = "post"
path = "/axis-cgi/pirsensor.cgi"
content_type = "application/json"
error_codes = general_error_codes
context: str = CONTEXT
@property
def content(self) -> bytes:
"""Initialize request data."""
return orjson.dumps(
{
"context": self.context,
"method": "getSupportedVersions",
}
)
|
class GetSupportedVersionsRequest(ApiRequest):
'''Request object for listing supported API versions.'''
@property
def content(self) -> bytes:
'''Initialize request data.'''
pass
| 3 | 2 | 8 | 0 | 7 | 1 | 1 | 0.14 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 5 | 19 | 3 | 14 | 8 | 11 | 2 | 8 | 7 | 6 | 1 | 1 | 0 | 1 |
141,594 |
Kane610/axis
|
axis/models/parameters/ptz.py
|
axis.models.parameters.ptz.PtzLimit
|
class PtzLimit:
"""PTZ.Limit.L# are populated when a driver is installed on a video channel.
Index # is the video channel number, starting on 1.
When it is possible to obtain the current position from the driver,
for example the current pan position, it is possible to apply limit restrictions
to the requested operation. For instance, if an absolute pan to position 150
is requested, but the upper limit is set to 140, the new pan position will be 140.
This is the purpose of all but MinFieldAngle and MaxFieldAngle in this group.
The purpose of those two parameters is to calibrate image centering.
"""
max_brightness: int | None
min_brightness: int | None
max_field_angle: int | None
min_field_angle: int | None
max_focus: int | None
min_focus: int | None
max_iris: int | None
min_iris: int | None
max_pan: int | None
min_pan: int | None
max_tilt: int | None
min_tilt: int | None
max_zoom: int | None
min_zoom: int | None
@classmethod
def decode(cls, data: PtzLimitParamT) -> Self:
"""Decode dictionary to class object."""
return cls(
max_zoom=data.get("MaxZoom"),
min_zoom=data.get("MinZoom"),
max_brightness=data.get("MaxBrightness"),
min_brightness=data.get("MinBrightness"),
max_field_angle=data.get("MaxFieldAngle"),
min_field_angle=data.get("MinFieldAngle"),
max_focus=data.get("MaxFocus"),
min_focus=data.get("MinFocus"),
max_iris=data.get("MaxIris"),
min_iris=data.get("MinIris"),
max_pan=data.get("MaxPan"),
min_pan=data.get("MinPan"),
max_tilt=data.get("MaxTilt"),
min_tilt=data.get("MinTilt"),
)
@classmethod
def from_dict(cls, data: dict[str, PtzLimitParamT]) -> dict[str, Self]:
"""Create objects from dict."""
return {k[1:]: cls.decode(v) for k, v in data.items()}
|
class PtzLimit:
'''PTZ.Limit.L# are populated when a driver is installed on a video channel.
Index # is the video channel number, starting on 1.
When it is possible to obtain the current position from the driver,
for example the current pan position, it is possible to apply limit restrictions
to the requested operation. For instance, if an absolute pan to position 150
is requested, but the upper limit is set to 140, the new pan position will be 140.
This is the purpose of all but MinFieldAngle and MaxFieldAngle in this group.
The purpose of those two parameters is to calibrate image centering.
'''
@classmethod
def decode(cls, data: PtzLimitParamT) -> Self:
'''Decode dictionary to class object.'''
pass
@classmethod
def from_dict(cls, data: dict[str, PtzLimitParamT]) -> dict[str, Self]:
'''Create objects from dict.'''
pass
| 5 | 3 | 11 | 0 | 10 | 1 | 1 | 0.31 | 0 | 3 | 1 | 0 | 0 | 0 | 2 | 2 | 51 | 4 | 36 | 5 | 31 | 11 | 19 | 3 | 16 | 1 | 0 | 0 | 2 |
141,595 |
Kane610/axis
|
axis/rtsp.py
|
axis.rtsp.RTPClient
|
class RTPClient:
"""Data connection to device.
When data is received send a signal on callback to whoever is interested.
"""
def __init__(
self, loop: Any, callback: Callable[[Signal], None] | None = None
) -> None:
"""Configure and bind socket.
We need to bind the port for RTSP before setting up the endpoint
since it will block until a connection has been set up and
the port is needed for setting up the RTSP session.
"""
self.loop = loop
self.client = self.UDPClient(callback)
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.sock.bind(("", 0))
self.port = self.sock.getsockname()[1]
self.rtcp_port = self.port + 1
async def start(self) -> None:
"""Start RTP client."""
await self.loop.create_datagram_endpoint(lambda: self.client, sock=self.sock)
def stop(self) -> None:
"""Close transport from receiving any more packages."""
if self.client.transport:
self.client.transport.close()
@property
def data(self) -> bytes:
"""Refer to most recently received data."""
try:
return self.client.data.popleft()
except IndexError:
return b""
class UDPClient:
"""Datagram recepient for device data."""
def __init__(self, callback: Callable[[Signal], None] | None) -> None:
"""Signal events to subscriber using callback."""
self.callback = callback
self.data: deque[bytes] = deque()
self.transport: asyncio.BaseTransport | None = None
self.fragment: bool = False
def connection_made(self, transport: asyncio.BaseTransport) -> None:
"""Execute when port is up and listening.
Save reference to transport for future control.
"""
_LOGGER.debug("Stream listener online")
self.transport = transport
def connection_lost(self, exc: Exception | None) -> None:
"""Signal retry if RTSP session fails to get a response."""
_LOGGER.debug("Stream recepient offline")
def datagram_received(self, data: bytes, addr: Any) -> None:
"""Signals when new data is available."""
if self.callback:
payload = data[RTP_HEADER_SIZE:]
# if the previous packet was a fragment, then merge it
if self.fragment:
previous = self.data.pop()
self.data.append(previous + payload)
else:
self.data.append(payload)
# check whether the RTP marker bit is set, if not it is a fragment
self.fragment = (data[1] & 0b1 << 7) == 0
if not self.fragment:
self.callback(Signal.DATA)
|
class RTPClient:
'''Data connection to device.
When data is received send a signal on callback to whoever is interested.
'''
def __init__(
self, loop: Any, callback: Callable[[Signal], None] | None = None
) -> None:
'''Configure and bind socket.
We need to bind the port for RTSP before setting up the endpoint
since it will block until a connection has been set up and
the port is needed for setting up the RTSP session.
'''
pass
async def start(self) -> None:
'''Start RTP client.'''
pass
def stop(self) -> None:
'''Close transport from receiving any more packages.'''
pass
@property
def data(self) -> bytes:
'''Refer to most recently received data.'''
pass
class UDPClient:
'''Datagram recepient for device data.'''
def __init__(
self, loop: Any, callback: Callable[[Signal], None] | None = None
) -> None:
'''Signal events to subscriber using callback.'''
pass
def connection_made(self, transport: asyncio.BaseTransport) -> None:
'''Execute when port is up and listening.
Save reference to transport for future control.
'''
pass
def connection_lost(self, exc: Exception | None) -> None:
'''Signal retry if RTSP session fails to get a response.'''
pass
def datagram_received(self, data: bytes, addr: Any) -> None:
'''Signals when new data is available.'''
pass
| 11 | 10 | 8 | 1 | 5 | 2 | 2 | 0.47 | 0 | 7 | 2 | 0 | 4 | 5 | 4 | 4 | 77 | 14 | 43 | 24 | 30 | 20 | 39 | 21 | 29 | 4 | 0 | 2 | 13 |
141,596 |
Kane610/axis
|
axis/interfaces/parameters/brand.py
|
axis.interfaces.parameters.brand.BrandParameterHandler
|
class BrandParameterHandler(ParamHandler[BrandParam]):
"""Handler for brand parameters."""
parameter_group = ParameterGroup.BRAND
parameter_item = BrandParam
|
class BrandParameterHandler(ParamHandler[BrandParam]):
'''Handler for brand parameters.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 25 | 5 | 1 | 3 | 3 | 2 | 1 | 3 | 3 | 2 | 0 | 3 | 0 | 0 |
141,597 |
Kane610/deconz
|
pydeconz/models/light/range_extender.py
|
pydeconz.models.light.range_extender.RangeExtender
|
class RangeExtender(LightBase):
"""ZigBee range extender."""
|
class RangeExtender(LightBase):
'''ZigBee range extender.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 15 | 2 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 3 | 0 | 0 |
141,598 |
Kane610/deconz
|
pydeconz/models/scene.py
|
pydeconz.models.scene.Scene
|
class Scene(APIItem):
"""deCONZ scene representation.
Dresden Elektroniks documentation of scenes in deCONZ
http://dresden-elektronik.github.io/deconz-rest-doc/scenes/
"""
raw: TypedScene
resource_group = ResourceGroup.SCENE
_group_resource_id: str = ""
_group_deconz_id: str = ""
@property
def group_id(self) -> str:
"""Group ID representation.
Scene resource ID is a string combined of group ID and scene ID; "gid_scid".
"""
if self._group_resource_id == "":
self._group_resource_id = self.resource_id.split("_")[0]
return self._group_resource_id
@property
def group_deconz_id(self) -> str:
"""Group deCONZ ID representation."""
if self._group_deconz_id == "":
self._group_deconz_id = f"/{ResourceGroup.GROUP}/{self.group_id}"
return self._group_deconz_id
@property
def deconz_id(self) -> str:
"""Id to call scene over API e.g. /groups/1/scenes/1."""
return f"{self.group_deconz_id}/{self.resource_group}/{self.id}"
@property
def id(self) -> str:
"""Scene ID."""
return self.raw["id"]
@property
def light_count(self) -> int:
"""Lights in group."""
return self.raw["lightcount"]
@property
def transition_time(self) -> int:
"""Transition time for scene."""
return self.raw["transitiontime"]
@property
def name(self) -> str:
"""Scene name."""
return self.raw["name"]
|
class Scene(APIItem):
'''deCONZ scene representation.
Dresden Elektroniks documentation of scenes in deCONZ
http://dresden-elektronik.github.io/deconz-rest-doc/scenes/
'''
@property
def group_id(self) -> str:
'''Group ID representation.
Scene resource ID is a string combined of group ID and scene ID; "gid_scid".
'''
pass
@property
def group_deconz_id(self) -> str:
'''Group deCONZ ID representation.'''
pass
@property
def deconz_id(self) -> str:
'''Id to call scene over API e.g. /groups/1/scenes/1.'''
pass
@property
def id(self) -> str:
'''Scene ID.'''
pass
@property
def light_count(self) -> int:
'''Lights in group.'''
pass
@property
def transition_time(self) -> int:
'''Transition time for scene.'''
pass
@property
def name(self) -> str:
'''Scene name.'''
pass
| 15 | 8 | 4 | 0 | 3 | 1 | 1 | 0.43 | 1 | 3 | 1 | 0 | 7 | 0 | 7 | 13 | 54 | 11 | 30 | 18 | 15 | 13 | 23 | 11 | 15 | 2 | 1 | 1 | 9 |
141,599 |
Kane610/deconz
|
pydeconz/models/light/siren.py
|
pydeconz.models.light.siren.TypedSirenState
|
class TypedSirenState(TypedDict):
"""Siren state type definition."""
alert: Literal["lselect", "select", "none"]
|
class TypedSirenState(TypedDict):
'''Siren state type definition.'''
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
141,600 |
Kane610/deconz
|
pydeconz/models/light/siren.py
|
pydeconz.models.light.siren.TypedSiren
|
class TypedSiren(TypedDict):
"""Siren type definition."""
state: TypedSirenState
|
class TypedSiren(TypedDict):
'''Siren type definition.'''
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
141,601 |
Kane610/deconz
|
pydeconz/models/light/siren.py
|
pydeconz.models.light.siren.Siren
|
class Siren(LightBase):
"""Siren class."""
raw: TypedSiren
@property
def is_on(self) -> bool:
"""If device is sounding."""
return self.raw["state"]["alert"] == LightAlert.LONG.value
|
class Siren(LightBase):
'''Siren class.'''
@property
def is_on(self) -> bool:
'''If device is sounding.'''
pass
| 3 | 2 | 3 | 0 | 2 | 1 | 1 | 0.4 | 1 | 2 | 1 | 0 | 1 | 0 | 1 | 16 | 9 | 2 | 5 | 3 | 2 | 2 | 4 | 2 | 2 | 1 | 3 | 0 | 1 |
141,602 |
Kane610/deconz
|
pydeconz/models/light/lock.py
|
pydeconz.models.light.lock.TypedLockState
|
class TypedLockState(TypedDict):
"""Lock state type definition."""
on: bool
|
class TypedLockState(TypedDict):
'''Lock state type definition.'''
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
141,603 |
Kane610/deconz
|
pydeconz/models/light/lock.py
|
pydeconz.models.light.lock.TypedLock
|
class TypedLock(TypedDict):
"""Lock type definition."""
state: TypedLockState
|
class TypedLock(TypedDict):
'''Lock type definition.'''
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
141,604 |
Kane610/deconz
|
pydeconz/models/scene.py
|
pydeconz.models.scene.TypedScene
|
class TypedScene(TypedDict):
"""Scene type definition."""
id: str
lightcount: int
transitiontime: int
name: str
|
class TypedScene(TypedDict):
'''Scene type definition.'''
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | 1 | 5 | 1 | 4 | 1 | 5 | 1 | 4 | 0 | 1 | 0 | 0 |
141,605 |
Kane610/deconz
|
pydeconz/models/light/lock.py
|
pydeconz.models.light.lock.Lock
|
class Lock(LightBase):
"""Lock class."""
raw: TypedLock
@property
def is_locked(self) -> bool:
"""State of lock."""
return self.raw["state"]["on"]
|
class Lock(LightBase):
'''Lock class.'''
@property
def is_locked(self) -> bool:
'''State of lock.'''
pass
| 3 | 2 | 3 | 0 | 2 | 1 | 1 | 0.4 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 16 | 9 | 2 | 5 | 3 | 2 | 2 | 4 | 2 | 2 | 1 | 3 | 0 | 1 |
141,606 |
Kane610/deconz
|
pydeconz/models/light/light.py
|
pydeconz.models.light.light.TypedLightState
|
class TypedLightState(TypedDict):
"""Light state type definition."""
alert: NotRequired[
Literal[
"none",
"select",
"lselect",
"blink",
"breathe",
"channelchange",
"finish",
"okay",
"stop",
]
]
bri: int
colormode: NotRequired[
Literal[
"ct",
"effect",
"gradient",
"hs",
"xy",
]
]
ct: int
effect: NotRequired[
Literal[
"candle",
"carnival",
"colorloop",
"collide",
"cosmos",
"enchant",
"fading",
"fire",
"fireplace",
"fireworks",
"flag",
"glisten",
"glow",
"loop",
"none",
"opal",
"prism",
"rainbow",
"snake",
"snow",
"sparkle",
"sparkles",
"steady",
"strobe",
"sunbeam",
"sunrise",
"sunset",
"twinkle",
"underwater",
"updown",
"vintage",
"waves",
]
]
gradient: NotRequired[TypedLightStateGradient]
hue: int
on: bool
sat: int
speed: Literal[0, 1, 2, 3, 4, 5, 6]
xy: tuple[float, float]
|
class TypedLightState(TypedDict):
'''Light state type definition.'''
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.01 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 69 | 1 | 67 | 1 | 66 | 1 | 12 | 1 | 11 | 0 | 1 | 0 | 0 |
141,607 |
Kane610/deconz
|
pydeconz/models/light/light.py
|
pydeconz.models.light.light.TypedLightCapabilitiesColor
|
class TypedLightCapabilitiesColor(TypedDict):
"""Light capabilities color type definition."""
effects: NotRequired[list[str]]
|
class TypedLightCapabilitiesColor(TypedDict):
'''Light capabilities color type definition.'''
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
141,608 |
Kane610/deconz
|
pydeconz/models/light/light.py
|
pydeconz.models.light.light.TypedLightCapabilities
|
class TypedLightCapabilities(TypedDict):
"""Light capabilities type definition."""
color: NotRequired[TypedLightCapabilitiesColor]
|
class TypedLightCapabilities(TypedDict):
'''Light capabilities type definition.'''
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
141,609 |
Kane610/deconz
|
pydeconz/models/light/light.py
|
pydeconz.models.light.light.TypedLight
|
class TypedLight(TypedDict):
"""Light type definition."""
capabilities: NotRequired[TypedLightCapabilities]
colorcapabilities: NotRequired[int]
ctmax: int
ctmin: int
state: TypedLightState
|
class TypedLight(TypedDict):
'''Light type definition.'''
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 1 | 6 | 1 | 5 | 1 | 6 | 1 | 5 | 0 | 1 | 0 | 0 |
141,610 |
Kane610/deconz
|
pydeconz/models/light/light.py
|
pydeconz.models.light.light.LightFanSpeed
|
class LightFanSpeed(enum.IntEnum):
"""Possible fan speeds.
Supported values:
- 0 - fan is off
- 1 - 25%
- 2 - 50%
- 3 - 75%
- 4 - 100%
- 5 - Auto
- 6 - "comfort-breeze"
"""
OFF = 0
PERCENT_25 = 1
PERCENT_50 = 2
PERCENT_75 = 3
PERCENT_100 = 4
AUTO = 5
COMFORT_BREEZE = 6
|
class LightFanSpeed(enum.IntEnum):
'''Possible fan speeds.
Supported values:
- 0 - fan is off
- 1 - 25%
- 2 - 50%
- 3 - 75%
- 4 - 100%
- 5 - Auto
- 6 - "comfort-breeze"
'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 55 | 20 | 2 | 8 | 8 | 7 | 10 | 8 | 8 | 7 | 0 | 3 | 0 | 0 |
141,611 |
Kane610/deconz
|
pydeconz/models/light/light.py
|
pydeconz.models.light.light.LightEffect
|
class LightEffect(enum.StrEnum):
"""Effect of the light.
Supported values:
- "colorloop" — cycle through hue values 0-360
- "none" — no effect
- "candle"
- "carnival"
- "collide"
- "cosmos"
- "enchant"
- "fading"
- "fire"
- "fireplace"
- "fireworks"
- "flag"
- "glisten"
- "glow"
- "loop"
- "opal"
- "prism"
- "rainbow"
- "snake"
- "snow"
- "sparkle"
- "sparkles"
- "steady"
- "strobe"
- "sunbeam"
- "sunrise"
- "sunset"
- "twinkle"
- "underwater"
- "updown"
- "vintage"
- "waves"
"""
COLOR_LOOP = "colorloop"
NONE = "none"
# Specific to Hue lights
CANDLE = "candle"
COSMOS = "cosmos"
ENCHANT = "enchant"
FIRE = "fire"
# 'fireplace' has been renamed 'fire' in deCONZ since Oct. 2024.
# https://github.com/dresden-elektronik/deconz-rest-plugin/pull/7956/commits/893777970ff7e25a7352ddf4fd11a82c1e5bbc5b
# Keeping it to remain compatible with older versions of deCONZ.
FIREPLACE = "fireplace"
# 'loop' has been renamed 'prism' in deCONZ since Sept. 2023.
# https://github.com/dresden-elektronik/deconz-rest-plugin/pull/7206/commits/9be934389e62583bc7f17b1bb2c7dff718f5f938
# Keeping it to remain compatible with older versions of deCONZ.
LOOP = "loop"
GLISTEN = "glisten"
OPAL = "opal"
PRISM = "prism"
SPARKLE = "sparkle"
SUNBEAM = "sunbeam"
SUNRISE = "sunrise"
SUNSET = "sunset"
UNDERWATER = "underwater"
# Specific to Lidl christmas light (TS0601)
CARNIVAL = "carnival"
COLLIDE = "collide"
FADING = "fading"
FIREWORKS = "fireworks"
FLAG = "flag"
GLOW = "glow"
RAINBOW = "rainbow"
SNAKE = "snake"
SNOW = "snow"
SPARKLES = "sparkles"
STEADY = "steady"
STROBE = "strobe"
TWINKLE = "twinkle"
UPDOWN = "updown"
VINTAGE = "vintage"
WAVES = "waves"
UNKNOWN = "unknown"
@classmethod
def _missing_(cls, value: object) -> LightEffect:
"""Set default enum member if an unknown value is provided."""
LOGGER.warning("Unexpected light effect type %s", value)
return cls.UNKNOWN
|
class LightEffect(enum.StrEnum):
'''Effect of the light.
Supported values:
- "colorloop" — cycle through hue values 0-360
- "none" — no effect
- "candle"
- "carnival"
- "collide"
- "cosmos"
- "enchant"
- "fading"
- "fire"
- "fireplace"
- "fireworks"
- "flag"
- "glisten"
- "glow"
- "loop"
- "opal"
- "prism"
- "rainbow"
- "snake"
- "snow"
- "sparkle"
- "sparkles"
- "steady"
- "strobe"
- "sunbeam"
- "sunrise"
- "sunset"
- "twinkle"
- "underwater"
- "updown"
- "vintage"
- "waves"
'''
@classmethod
def _missing_(cls, value: object) -> LightEffect:
'''Set default enum member if an unknown value is provided.'''
pass
| 3 | 2 | 4 | 0 | 3 | 1 | 1 | 1.16 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 69 | 90 | 8 | 38 | 36 | 35 | 44 | 37 | 35 | 35 | 1 | 3 | 0 | 1 |
141,612 |
Kane610/deconz
|
pydeconz/models/light/light.py
|
pydeconz.models.light.light.TypedLightStateGradient
|
class TypedLightStateGradient(TypedDict):
"""Light state gradient definition."""
color_adjustment: int
offset: int
offset_adjustment: int
points: list[list[int]]
segments: int
style: Literal[
"linear",
"mirrored",
]
|
class TypedLightStateGradient(TypedDict):
'''Light state gradient definition.'''
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 1 | 10 | 1 | 9 | 1 | 7 | 1 | 6 | 0 | 1 | 0 | 0 |
141,613 |
Kane610/deconz
|
pydeconz/models/sensor/__init__.py
|
pydeconz.models.sensor.SensorBase
|
class SensorBase(DeconzDevice):
"""deCONZ sensor representation.
Dresden Elektroniks documentation of sensors in deCONZ
http://dresden-elektronik.github.io/deconz-rest-doc/sensors/
"""
resource_group = ResourceGroup.SENSOR
@property
def battery(self) -> int | None:
"""Battery status of sensor."""
raw: dict[str, int] = self.raw["config"]
return raw.get("battery")
@property
def ep(self) -> int | None:
"""Endpoint of sensor."""
raw: dict[str, int] = self.raw
return raw.get("ep")
@property
def low_battery(self) -> bool | None:
"""Low battery."""
raw: dict[str, bool] = self.raw["state"]
return raw.get("lowbattery")
@property
def on(self) -> bool | None:
"""Declare if the sensor is on or off."""
raw: dict[str, bool] = self.raw["config"]
return raw.get("on")
@property
def reachable(self) -> bool:
"""Declare if the sensor is reachable."""
raw: dict[str, bool] = self.raw["config"]
return raw.get("reachable", True)
@property
def tampered(self) -> bool | None:
"""Tampered."""
raw: dict[str, bool] = self.raw["state"]
return raw.get("tampered")
@property
def internal_temperature(self) -> float | None:
"""Extra temperature available on some Xiaomi devices."""
raw: dict[str, int] = self.raw["config"]
if temperature := raw.get("temperature"):
return round(temperature / 100, 1)
return None
|
class SensorBase(DeconzDevice):
'''deCONZ sensor representation.
Dresden Elektroniks documentation of sensors in deCONZ
http://dresden-elektronik.github.io/deconz-rest-doc/sensors/
'''
@property
def battery(self) -> int | None:
'''Battery status of sensor.'''
pass
@property
def ep(self) -> int | None:
'''Endpoint of sensor.'''
pass
@property
def low_battery(self) -> bool | None:
'''Low battery.'''
pass
@property
def on(self) -> bool | None:
'''Declare if the sensor is on or off.'''
pass
@property
def reachable(self) -> bool:
'''Declare if the sensor is reachable.'''
pass
@property
def tampered(self) -> bool | None:
'''Tampered.'''
pass
@property
def internal_temperature(self) -> float | None:
'''Extra temperature available on some Xiaomi devices.'''
pass
| 15 | 8 | 4 | 0 | 3 | 1 | 1 | 0.34 | 1 | 5 | 0 | 29 | 7 | 0 | 7 | 20 | 52 | 9 | 32 | 24 | 17 | 11 | 25 | 16 | 17 | 2 | 2 | 1 | 8 |
141,614 |
Kane610/deconz
|
pydeconz/models/sensor/air_purifier.py
|
pydeconz.models.sensor.air_purifier.AirPurifier
|
class AirPurifier(SensorBase):
"""Air purifier sensor."""
raw: TypedAirPurifier
@property
def device_run_time(self) -> int:
"""Device run time in minutes."""
return self.raw["state"]["deviceruntime"]
@property
def fan_mode(self) -> AirPurifierFanMode:
"""Fan mode."""
return AirPurifierFanMode(self.raw["config"]["mode"])
@property
def fan_speed(self) -> int:
"""Fan speed."""
return self.raw["state"]["speed"]
@property
def filter_life_time(self) -> int:
"""Filter life time in minutes."""
return self.raw["config"]["filterlifetime"]
@property
def filter_run_time(self) -> int:
"""Filter run time in minutes."""
return self.raw["state"]["filterruntime"]
@property
def led_indication(self) -> bool:
"""Led indicator."""
return self.raw["config"]["ledindication"]
@property
def locked(self) -> bool:
"""Locked configuration."""
return self.raw["config"]["locked"]
@property
def replace_filter(self) -> bool:
"""Replace filter property."""
return self.raw["state"]["replacefilter"]
|
class AirPurifier(SensorBase):
'''Air purifier sensor.'''
@property
def device_run_time(self) -> int:
'''Device run time in minutes.'''
pass
@property
def fan_mode(self) -> AirPurifierFanMode:
'''Fan mode.'''
pass
@property
def fan_speed(self) -> int:
'''Fan speed.'''
pass
@property
def filter_life_time(self) -> int:
'''Filter life time in minutes.'''
pass
@property
def filter_run_time(self) -> int:
'''Filter run time in minutes.'''
pass
@property
def led_indication(self) -> bool:
'''Led indicator.'''
pass
@property
def locked(self) -> bool:
'''Locked configuration.'''
pass
@property
def replace_filter(self) -> bool:
'''Replace filter property.'''
pass
| 17 | 9 | 3 | 0 | 2 | 1 | 1 | 0.35 | 1 | 3 | 1 | 0 | 8 | 0 | 8 | 28 | 44 | 9 | 26 | 17 | 9 | 9 | 18 | 9 | 9 | 1 | 3 | 0 | 8 |
141,615 |
Kane610/deconz
|
pydeconz/models/sensor/air_purifier.py
|
pydeconz.models.sensor.air_purifier.AirPurifierFanMode
|
class AirPurifierFanMode(enum.StrEnum):
"""Air purifier supported fan modes."""
OFF = "off"
AUTO = "auto"
SPEED_1 = "speed_1"
SPEED_2 = "speed_2"
SPEED_3 = "speed_3"
SPEED_4 = "speed_4"
SPEED_5 = "speed_5"
|
class AirPurifierFanMode(enum.StrEnum):
'''Air purifier supported fan modes.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.13 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 68 | 10 | 1 | 8 | 8 | 7 | 1 | 8 | 8 | 7 | 0 | 3 | 0 | 0 |
141,616 |
Kane610/deconz
|
pydeconz/models/sensor/ancillary_control.py
|
pydeconz.models.sensor.ancillary_control.TypedAncillaryControlState
|
class TypedAncillaryControlState(TypedDict):
"""Ancillary control state type definition."""
action: Literal[
"armed_away",
"armed_night",
"armed_stay",
"disarmed",
"emergency",
"fire",
"invalid_code",
"panic",
]
panel: NotRequired[
Literal[
"armed_away",
"armed_night",
"armed_stay",
"arming_away",
"arming_night",
"arming_stay",
"disarmed",
"entry_delay",
"exit_delay",
"in_alarm",
"not_ready",
]
]
seconds_remaining: int
|
class TypedAncillaryControlState(TypedDict):
'''Ancillary control state type definition.'''
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.04 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 29 | 1 | 27 | 1 | 26 | 1 | 4 | 1 | 3 | 0 | 1 | 0 | 0 |
141,617 |
Kane610/deconz
|
pydeconz/models/sensor/ancillary_control.py
|
pydeconz.models.sensor.ancillary_control.TypedAncillaryControl
|
class TypedAncillaryControl(TypedDict):
"""Ancillary control type definition."""
state: TypedAncillaryControlState
|
class TypedAncillaryControl(TypedDict):
'''Ancillary control type definition.'''
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
141,618 |
Kane610/deconz
|
pydeconz/models/sensor/ancillary_control.py
|
pydeconz.models.sensor.ancillary_control.AncillaryControlPanel
|
class AncillaryControlPanel(enum.StrEnum):
"""Mirror of alarm system state.armstate attribute."""
ARMED_AWAY = "armed_away"
ARMED_NIGHT = "armed_night"
ARMED_STAY = "armed_stay"
ARMING_AWAY = "arming_away"
ARMING_NIGHT = "arming_night"
ARMING_STAY = "arming_stay"
DISARMED = "disarmed"
ENTRY_DELAY = "entry_delay"
EXIT_DELAY = "exit_delay"
IN_ALARM = "in_alarm"
NOT_READY = "not_ready"
UNKNOWN = "unknown"
@classmethod
def _missing_(cls, value: object) -> AncillaryControlPanel:
"""Set default enum member if an unknown value is provided."""
LOGGER.warning("Unexpected panel mode %s", value)
return cls.UNKNOWN
|
class AncillaryControlPanel(enum.StrEnum):
'''Mirror of alarm system state.armstate attribute.'''
@classmethod
def _missing_(cls, value: object) -> AncillaryControlPanel:
'''Set default enum member if an unknown value is provided.'''
pass
| 3 | 2 | 4 | 0 | 3 | 1 | 1 | 0.12 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 69 | 22 | 3 | 17 | 15 | 14 | 2 | 16 | 14 | 14 | 1 | 3 | 0 | 1 |
141,619 |
Kane610/deconz
|
pydeconz/models/sensor/ancillary_control.py
|
pydeconz.models.sensor.ancillary_control.AncillaryControlAction
|
class AncillaryControlAction(enum.StrEnum):
"""Last action a user invoked on the keypad."""
ARMED_AWAY = "armed_away"
ARMED_NIGHT = "armed_night"
ARMED_STAY = "armed_stay"
ALREADY_DISARMED = "already_disarmed"
DISARMED = "disarmed"
EMERGENCY = "emergency"
FIRE = "fire"
INVALID_CODE = "invalid_code"
PANIC = "panic"
|
class AncillaryControlAction(enum.StrEnum):
'''Last action a user invoked on the keypad.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 68 | 12 | 1 | 10 | 10 | 9 | 1 | 10 | 10 | 9 | 0 | 3 | 0 | 0 |
141,620 |
Kane610/deconz
|
pydeconz/models/sensor/ancillary_control.py
|
pydeconz.models.sensor.ancillary_control.AncillaryControl
|
class AncillaryControl(SensorBase):
"""Ancillary control sensor."""
raw: TypedAncillaryControl
@property
def action(self) -> AncillaryControlAction:
"""Last action a user invoked on the keypad."""
return AncillaryControlAction(self.raw["state"]["action"])
@property
def panel(self) -> AncillaryControlPanel | None:
"""Mirror of alarm system state.armstate attribute.
It reflects what is shown on the panel
(when activated by the keypad’s proximity sensor).
"""
if "panel" in self.raw["state"]:
return AncillaryControlPanel(self.raw["state"]["panel"])
return None
@property
def seconds_remaining(self) -> int:
"""Remaining time of "exit_delay" and "entry_delay" states.
In all other states the value is 0.
"""
return self.raw["state"].get("seconds_remaining", 0)
|
class AncillaryControl(SensorBase):
'''Ancillary control sensor.'''
@property
def action(self) -> AncillaryControlAction:
'''Last action a user invoked on the keypad.'''
pass
@property
def panel(self) -> AncillaryControlPanel | None:
'''Mirror of alarm system state.armstate attribute.
It reflects what is shown on the panel
(when activated by the keypad’s proximity sensor).
'''
pass
@property
def seconds_remaining(self) -> int:
'''Remaining time of "exit_delay" and "entry_delay" states.
In all other states the value is 0.
'''
pass
| 7 | 4 | 6 | 1 | 3 | 3 | 1 | 0.69 | 1 | 3 | 2 | 0 | 3 | 0 | 3 | 23 | 28 | 6 | 13 | 7 | 6 | 9 | 10 | 4 | 6 | 2 | 3 | 1 | 4 |
141,621 |
Kane610/deconz
|
pydeconz/models/sensor/alarm.py
|
pydeconz.models.sensor.alarm.TypedAlarmState
|
class TypedAlarmState(TypedDict):
"""Alarm state type definition."""
alarm: bool
|
class TypedAlarmState(TypedDict):
'''Alarm state type definition.'''
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
141,622 |
Kane610/deconz
|
pydeconz/models/sensor/alarm.py
|
pydeconz.models.sensor.alarm.TypedAlarm
|
class TypedAlarm(TypedDict):
"""Alarm type definition."""
state: TypedAlarmState
|
class TypedAlarm(TypedDict):
'''Alarm type definition.'''
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
141,623 |
Kane610/deconz
|
pydeconz/models/sensor/alarm.py
|
pydeconz.models.sensor.alarm.Alarm
|
class Alarm(SensorBase):
"""Alarm sensor."""
raw: TypedAlarm
@property
def alarm(self) -> bool:
"""Alarm."""
return self.raw["state"]["alarm"]
|
class Alarm(SensorBase):
'''Alarm sensor.'''
@property
def alarm(self) -> bool:
'''Alarm.'''
pass
| 3 | 2 | 3 | 0 | 2 | 1 | 1 | 0.4 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 21 | 9 | 2 | 5 | 3 | 2 | 2 | 4 | 2 | 2 | 1 | 3 | 0 | 1 |
141,624 |
Kane610/deconz
|
pydeconz/models/sensor/air_quality.py
|
pydeconz.models.sensor.air_quality.TypedAirQualityState
|
class TypedAirQualityState(TypedDict):
"""Air quality state type definition."""
airquality: Literal[
"excellent",
"good",
"moderate",
"poor",
"unhealthy",
"out of scale",
]
airquality_co2_density: int
airquality_formaldehyde_density: int
airqualityppb: int
pm2_5: int
|
class TypedAirQualityState(TypedDict):
'''Air quality state type definition.'''
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.08 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 15 | 1 | 13 | 1 | 12 | 1 | 6 | 1 | 5 | 0 | 1 | 0 | 0 |
141,625 |
Kane610/deconz
|
pydeconz/models/sensor/air_quality.py
|
pydeconz.models.sensor.air_quality.TypedAirQuality
|
class TypedAirQuality(TypedDict):
"""Air quality type definition."""
state: TypedAirQualityState
|
class TypedAirQuality(TypedDict):
'''Air quality type definition.'''
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
141,626 |
Kane610/deconz
|
pydeconz/models/sensor/air_quality.py
|
pydeconz.models.sensor.air_quality.AirQualityValue
|
class AirQualityValue(enum.StrEnum):
"""Air quality.
Supported values:
- "excellent"
- "good"
- "moderate"
- "poor"
- "unhealthy"
- "out of scale"
"""
EXCELLENT = "excellent"
GOOD = "good"
MODERATE = "moderate"
POOR = "poor"
UNHEALTHY = "unhealthy"
OUT_OF_SCALE = "out of scale"
UNKNOWN = "unknown"
@classmethod
def _missing_(cls, value: object) -> AirQualityValue:
"""Set default enum member if an unknown value is provided."""
LOGGER.warning("Unexpected air quality value %s", value)
return cls.UNKNOWN
|
class AirQualityValue(enum.StrEnum):
'''Air quality.
Supported values:
- "excellent"
- "good"
- "moderate"
- "poor"
- "unhealthy"
- "out of scale"
'''
@classmethod
def _missing_(cls, value: object) -> AirQualityValue:
'''Set default enum member if an unknown value is provided.'''
pass
| 3 | 2 | 4 | 0 | 3 | 1 | 1 | 0.83 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 69 | 26 | 4 | 12 | 10 | 9 | 10 | 11 | 9 | 9 | 1 | 3 | 0 | 1 |
141,627 |
Kane610/deconz
|
pydeconz/models/sensor/air_quality.py
|
pydeconz.models.sensor.air_quality.AirQuality
|
class AirQuality(SensorBase):
"""Air quality sensor."""
raw: TypedAirQuality
@property
def air_quality(self) -> str: # AirQualityValue:
"""Air quality."""
return AirQualityValue(self.raw["state"].get("airquality", "unknown"))
@property
def air_quality_co2(self) -> int | None:
"""Chemical compound gas carbon dioxid (CO2) (ppb)."""
return self.raw["state"].get("airquality_co2_density")
@property
def air_quality_formaldehyde(self) -> int | None:
"""Chemical compound gas formaldehyde / methanal (CH2O) (µg/m³)."""
return self.raw["state"].get("airquality_formaldehyde_density")
@property
def air_quality_ppb(self) -> int | None:
"""Air quality PPB TVOC."""
return self.raw["state"].get("airqualityppb")
@property
def pm_2_5(self) -> int | None:
"""Air quality PM2.5 (µg/m³)."""
return self.raw["state"].get("pm2_5")
@property
def supports_air_quality(self) -> bool:
"""Support Air quality reporting."""
return "airquality" in self.raw["state"]
|
class AirQuality(SensorBase):
'''Air quality sensor.'''
@property
def air_quality(self) -> str:
'''Air quality.'''
pass
@property
def air_quality_co2(self) -> int | None:
'''Chemical compound gas carbon dioxid (CO2) (ppb).'''
pass
@property
def air_quality_formaldehyde(self) -> int | None:
'''Chemical compound gas formaldehyde / methanal (CH2O) (µg/m³).'''
pass
@property
def air_quality_ppb(self) -> int | None:
'''Air quality PPB TVOC.'''
pass
@property
def pm_2_5(self) -> int | None:
'''Air quality PM2.5 (µg/m³).'''
pass
@property
def supports_air_quality(self) -> bool:
'''Support Air quality reporting.'''
pass
| 13 | 7 | 3 | 0 | 2 | 1 | 1 | 0.4 | 1 | 4 | 1 | 0 | 6 | 0 | 6 | 26 | 34 | 7 | 20 | 13 | 7 | 8 | 14 | 7 | 7 | 1 | 3 | 0 | 6 |
141,628 |
Kane610/deconz
|
pydeconz/models/sensor/air_purifier.py
|
pydeconz.models.sensor.air_purifier.TypedAirPurifierState
|
class TypedAirPurifierState(TypedDict):
"""Air purifier state type definition."""
deviceruntime: int
filterruntime: int
replacefilter: bool
speed: int
|
class TypedAirPurifierState(TypedDict):
'''Air purifier state type definition.'''
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | 1 | 5 | 1 | 4 | 1 | 5 | 1 | 4 | 0 | 1 | 0 | 0 |
141,629 |
Kane610/deconz
|
pydeconz/models/sensor/air_purifier.py
|
pydeconz.models.sensor.air_purifier.TypedAirPurifierConfig
|
class TypedAirPurifierConfig(TypedDict):
"""Air purifier config type definition."""
filterlifetime: int
ledindication: bool
locked: bool
mode: Literal[
"off",
"auto",
"speed_1",
"speed_2",
"speed_3",
"speed_4",
"speed_5",
]
on: bool
reachable: bool
|
class TypedAirPurifierConfig(TypedDict):
'''Air purifier config type definition.'''
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.07 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 17 | 1 | 15 | 1 | 14 | 1 | 7 | 1 | 6 | 0 | 1 | 0 | 0 |
141,630 |
Kane610/deconz
|
pydeconz/models/sensor/air_purifier.py
|
pydeconz.models.sensor.air_purifier.TypedAirPurifier
|
class TypedAirPurifier(TypedDict):
"""Air purifier type definition."""
config: TypedAirPurifierConfig
state: TypedAirPurifierState
|
class TypedAirPurifier(TypedDict):
'''Air purifier type definition.'''
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 1 | 3 | 1 | 2 | 1 | 3 | 1 | 2 | 0 | 1 | 0 | 0 |
141,631 |
Kane610/deconz
|
pydeconz/models/light/light.py
|
pydeconz.models.light.light.LightColorMode
|
class LightColorMode(enum.StrEnum):
"""Color mode of the light.
Supported values:
- "ct" — color temperature.
- "hs" — hue and saturation.
- "xy" — CIE xy values.
- "effect"
- "gradient"
"""
CT = "ct"
HS = "hs"
XY = "xy"
# Specific to Hue gradient lights
EFFECT = "effect"
GRADIENT = "gradient"
UNKNOWN = "unknown"
@classmethod
def _missing_(cls, value: object) -> LightColorMode:
"""Set default enum member if an unknown value is provided."""
LOGGER.warning("Unexpected light color mode %s", value)
return cls.UNKNOWN
|
class LightColorMode(enum.StrEnum):
'''Color mode of the light.
Supported values:
- "ct" — color temperature.
- "hs" — hue and saturation.
- "xy" — CIE xy values.
- "effect"
- "gradient"
'''
@classmethod
def _missing_(cls, value: object) -> LightColorMode:
'''Set default enum member if an unknown value is provided.'''
pass
| 3 | 2 | 4 | 0 | 3 | 1 | 1 | 0.91 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 69 | 26 | 5 | 11 | 9 | 8 | 10 | 10 | 8 | 8 | 1 | 3 | 0 | 1 |
141,632 |
Kane610/deconz
|
pydeconz/models/sensor/battery.py
|
pydeconz.models.sensor.battery.Battery
|
class Battery(SensorBase):
"""Battery sensor."""
raw: TypedBattery
@property
def battery(self) -> int:
"""Battery."""
return self.raw["state"]["battery"]
|
class Battery(SensorBase):
'''Battery sensor.'''
@property
def battery(self) -> int:
'''Battery.'''
pass
| 3 | 2 | 3 | 0 | 2 | 1 | 1 | 0.4 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 21 | 9 | 2 | 5 | 3 | 2 | 2 | 4 | 2 | 2 | 1 | 3 | 0 | 1 |
141,633 |
Kane610/deconz
|
pydeconz/models/light/light.py
|
pydeconz.models.light.light.LightColorCapability
|
class LightColorCapability(enum.IntFlag):
"""Bit field of features supported by a light device."""
HUE_SATURATION = 0
ENHANCED_HUE = 1
COLOR_LOOP = 2
XY_ATTRIBUTES = 4
COLOR_TEMPERATURE = 8
UNKNOWN = 1111
@classmethod
def _missing_(cls, value: object) -> LightColorCapability:
"""Set default enum member if an unknown value is provided."""
LOGGER.warning("Unexpected light color capability %s", value)
return cls.UNKNOWN
|
class LightColorCapability(enum.IntFlag):
'''Bit field of features supported by a light device.'''
@classmethod
def _missing_(cls, value: object) -> LightColorCapability:
'''Set default enum member if an unknown value is provided.'''
pass
| 3 | 2 | 4 | 0 | 3 | 1 | 1 | 0.18 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 56 | 16 | 3 | 11 | 9 | 8 | 2 | 10 | 8 | 8 | 1 | 3 | 0 | 1 |
141,634 |
Kane610/deconz
|
pydeconz/models/light/light.py
|
pydeconz.models.light.light.Light
|
class Light(LightBase):
"""deCONZ light representation.
Dresden Elektroniks documentation of lights in deCONZ
http://dresden-elektronik.github.io/deconz-rest-doc/lights/
"""
raw: TypedLight
@property
def alert(self) -> LightAlert | None:
"""Temporary alert effect."""
if "alert" in self.raw["state"]:
return LightAlert(self.raw["state"]["alert"])
return None
@property
def brightness(self) -> int | None:
"""Brightness of the light.
Depending on the light type 0 might not mean visible "off"
but minimum brightness.
"""
return self.raw["state"].get("bri")
@property
def supported_effects(self) -> list[LightEffect] | None:
"""List of effects supported by a light."""
if (
"capabilities" in self.raw
and "color" in self.raw["capabilities"]
and "effects" in self.raw["capabilities"]["color"]
):
return list(map(LightEffect, self.raw["capabilities"]["color"]["effects"]))
return None
@property
def color_capabilities(self) -> LightColorCapability | None:
"""Bit field to specify color capabilities of light."""
if "colorcapabilities" in self.raw:
return LightColorCapability(self.raw["colorcapabilities"])
return None
@property
def color_temp(self) -> int | None:
"""Mired color temperature of the light. (2000K - 6500K)."""
return self.raw["state"].get("ct")
@property
def gradient(self) -> TypedLightStateGradient | None:
"""The currently active gradient (for Hue Gradient lights)."""
return self.raw["state"].get("gradient")
@property
def hue(self) -> int | None:
"""Color hue of the light.
The hue parameter in the HSV color model is between 0°-360°
and is mapped to 0..65535 to get 16-bit resolution.
"""
return self.raw["state"].get("hue")
@property
def saturation(self) -> int | None:
"""Color saturation of the light.
There 0 means no color at all and 255 is the greatest saturation
of the color.
"""
return self.raw["state"].get("sat")
@property
def xy(self) -> tuple[float, float] | None:
"""CIE xy color space coordinates as array [x, y] of real values (0..1)."""
x, y = self.raw["state"].get("xy", (None, None))
if x is None or y is None:
return None
if x > 1:
x = x / 65555
if y > 1:
y = y / 65555
return (x, y)
@property
def color_mode(self) -> LightColorMode | None:
"""Color mode of light."""
if "colormode" in self.raw["state"]:
return LightColorMode(self.raw["state"]["colormode"])
return None
@property
def on(self) -> bool:
"""Device state."""
return self.raw["state"]["on"]
@property
def max_color_temp(self) -> int | None:
"""Max value for color temperature."""
if (ctmax := self.raw.get("ctmax")) is not None and ctmax > 650:
ctmax = 650
return ctmax
@property
def min_color_temp(self) -> int | None:
"""Min value for color temperature."""
if (ctmin := self.raw.get("ctmin")) is not None and ctmin < 140:
ctmin = 140
return ctmin
@property
def effect(self) -> LightEffect | None:
"""Effect of the light."""
if "effect" in self.raw["state"]:
return LightEffect(self.raw["state"]["effect"])
return None
@property
def fan_speed(self) -> LightFanSpeed:
"""Speed of the fan."""
return LightFanSpeed(self.raw["state"]["speed"])
@property
def supports_fan_speed(self) -> bool:
"""Speed of the fan."""
return "speed" in self.raw["state"]
|
class Light(LightBase):
'''deCONZ light representation.
Dresden Elektroniks documentation of lights in deCONZ
http://dresden-elektronik.github.io/deconz-rest-doc/lights/
'''
@property
def alert(self) -> LightAlert | None:
'''Temporary alert effect.'''
pass
@property
def brightness(self) -> int | None:
'''Brightness of the light.
Depending on the light type 0 might not mean visible "off"
but minimum brightness.
'''
pass
@property
def supported_effects(self) -> list[LightEffect] | None:
'''List of effects supported by a light.'''
pass
@property
def color_capabilities(self) -> LightColorCapability | None:
'''Bit field to specify color capabilities of light.'''
pass
@property
def color_temp(self) -> int | None:
'''Mired color temperature of the light. (2000K - 6500K).'''
pass
@property
def gradient(self) -> TypedLightStateGradient | None:
'''The currently active gradient (for Hue Gradient lights).'''
pass
@property
def hue(self) -> int | None:
'''Color hue of the light.
The hue parameter in the HSV color model is between 0°-360°
and is mapped to 0..65535 to get 16-bit resolution.
'''
pass
@property
def saturation(self) -> int | None:
'''Color saturation of the light.
There 0 means no color at all and 255 is the greatest saturation
of the color.
'''
pass
@property
def xy(self) -> tuple[float, float] | None:
'''CIE xy color space coordinates as array [x, y] of real values (0..1).'''
pass
@property
def color_mode(self) -> LightColorMode | None:
'''Color mode of light.'''
pass
@property
def on(self) -> bool:
'''Device state.'''
pass
@property
def max_color_temp(self) -> int | None:
'''Max value for color temperature.'''
pass
@property
def min_color_temp(self) -> int | None:
'''Min value for color temperature.'''
pass
@property
def effect(self) -> LightEffect | None:
'''Effect of the light.'''
pass
@property
def fan_speed(self) -> LightFanSpeed:
'''Speed of the fan.'''
pass
@property
def supports_fan_speed(self) -> bool:
'''Speed of the fan.'''
pass
| 33 | 17 | 6 | 0 | 4 | 2 | 2 | 0.39 | 1 | 12 | 6 | 0 | 16 | 0 | 16 | 31 | 129 | 25 | 75 | 36 | 42 | 29 | 55 | 18 | 38 | 4 | 3 | 1 | 26 |
141,635 |
Kane610/deconz
|
pydeconz/models/alarm_system.py
|
pydeconz.models.alarm_system.AlarmSystemDeviceTrigger
|
class AlarmSystemDeviceTrigger(enum.StrEnum):
"""Specifies arm modes in which the device triggers alarms."""
ACTION = "state/action"
BUTTON_EVENT = "state/buttonevent"
ON = "state/on"
OPEN = "state/open"
PRESENCE = "state/presence"
VIBRATION = "state/vibration"
|
class AlarmSystemDeviceTrigger(enum.StrEnum):
'''Specifies arm modes in which the device triggers alarms.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.14 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 68 | 9 | 1 | 7 | 7 | 6 | 1 | 7 | 7 | 6 | 0 | 3 | 0 | 0 |
141,636 |
Kane610/deconz
|
pydeconz/models/alarm_system.py
|
pydeconz.models.alarm_system.AlarmSystemArmState
|
class AlarmSystemArmState(enum.StrEnum):
"""The current alarm system state."""
ARMED_AWAY = "armed_away"
ARMED_NIGHT = "armed_night"
ARMED_STAY = "armed_stay"
ARMING_AWAY = "arming_away"
ARMING_NIGHT = "arming_night"
ARMING_STAY = "arming_stay"
DISARMED = "disarmed"
ENTRY_DELAY = "entry_delay"
EXIT_DELAY = "exit_delay"
IN_ALARM = "in_alarm"
|
class AlarmSystemArmState(enum.StrEnum):
'''The current alarm system state.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.09 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 68 | 13 | 1 | 11 | 11 | 10 | 1 | 11 | 11 | 10 | 0 | 3 | 0 | 0 |
141,637 |
Kane610/deconz
|
pydeconz/models/alarm_system.py
|
pydeconz.models.alarm_system.AlarmSystemArmMode
|
class AlarmSystemArmMode(enum.StrEnum):
"""The target arm mode."""
ARMED_AWAY = "armed_away"
ARMED_NIGHT = "armed_night"
ARMED_STAY = "armed_stay"
DISARMED = "disarmed"
|
class AlarmSystemArmMode(enum.StrEnum):
'''The target arm mode.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 68 | 7 | 1 | 5 | 5 | 4 | 1 | 5 | 5 | 4 | 0 | 3 | 0 | 0 |
141,638 |
Kane610/deconz
|
pydeconz/models/alarm_system.py
|
pydeconz.models.alarm_system.AlarmSystemArmMask
|
class AlarmSystemArmMask(enum.StrEnum):
"""The target arm mode."""
ARMED_AWAY = "A"
ARMED_NIGHT = "N"
ARMED_STAY = "S"
NONE = "none"
|
class AlarmSystemArmMask(enum.StrEnum):
'''The target arm mode.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 68 | 7 | 1 | 5 | 5 | 4 | 1 | 5 | 5 | 4 | 0 | 3 | 0 | 0 |
141,639 |
Kane610/deconz
|
pydeconz/models/alarm_system.py
|
pydeconz.models.alarm_system.AlarmSystem
|
class AlarmSystem(APIItem):
"""deCONZ alarm system representation.
Dresden Elektroniks documentation of alarm systems in deCONZ
https://dresden-elektronik.github.io/deconz-rest-doc/endpoints/alarmsystems/
"""
raw: TypedAlarmSystem
resource_group = ResourceGroup.ALARM
@property
def arm_state(self) -> AlarmSystemArmState:
"""Alarm system state.
Can be different from the config.armmode during state transitions.
"""
return AlarmSystemArmState(self.raw["state"]["armstate"])
@property
def seconds_remaining(self) -> int:
"""Remaining time while armstate in "exit_delay" or "entry_delay" state.
In all other states the value is 0.
Supported values:
0-255.
"""
return self.raw["state"]["seconds_remaining"]
@property
def pin_configured(self) -> bool:
"""Is PIN code configured."""
return self.raw["config"]["configured"]
@property
def arm_mode(self) -> AlarmSystemArmMode:
"""Target arm mode."""
return AlarmSystemArmMode(self.raw["config"]["armmode"])
@property
def armed_away_entry_delay(self) -> int:
"""Delay in seconds before an alarm is triggered.
Supported values:
0-255.
"""
return self.raw["config"]["armed_away_entry_delay"]
@property
def armed_away_exit_delay(self) -> int:
"""Delay in seconds before an alarm is armed.
Supported values:
0-255.
"""
return self.raw["config"]["armed_away_exit_delay"]
@property
def armed_away_trigger_duration(self) -> int:
"""Duration of alarm trigger.
Supported values:
0-255.
"""
return self.raw["config"]["armed_away_trigger_duration"]
@property
def armed_night_entry_delay(self) -> int:
"""Delay in seconds before an alarm is triggered.
Supported values:
0-255.
"""
return self.raw["config"]["armed_night_entry_delay"]
@property
def armed_night_exit_delay(self) -> int:
"""Delay in seconds before an alarm is armed.
Supported values:
0-255.
"""
return self.raw["config"]["armed_night_exit_delay"]
@property
def armed_night_trigger_duration(self) -> int:
"""Duration of alarm trigger.
Supported values:
0-255.
"""
return self.raw["config"]["armed_night_trigger_duration"]
@property
def armed_stay_entry_delay(self) -> int:
"""Delay in seconds before an alarm is triggered.
Supported values:
0-255.
"""
return self.raw["config"]["armed_stay_entry_delay"]
@property
def armed_stay_exit_delay(self) -> int:
"""Delay in seconds before an alarm is armed.
Supported values:
0-255.
"""
return self.raw["config"]["armed_stay_exit_delay"]
@property
def armed_stay_trigger_duration(self) -> int:
"""Duration of alarm trigger.
Supported values:
0-255.
"""
return self.raw["config"]["armed_stay_trigger_duration"]
@property
def disarmed_entry_delay(self) -> int:
"""Delay in seconds before an alarm is triggered.
Supported values:
0-255.
"""
return self.raw["config"]["disarmed_entry_delay"]
@property
def disarmed_exit_delay(self) -> int:
"""Delay in seconds before an alarm is armed.
Supported values:
0-255.
"""
return self.raw["config"]["disarmed_exit_delay"]
@property
def devices(self) -> dict[str, Any]:
"""Devices associated with the alarm system.
The keys refer to the uniqueid of a light, sensor, or keypad.
Dictionary values:
- armmask - A combination of arm modes in which the device triggers alarms.
A — armed_away
N — armed_night
S — armed_stay
"none" — for keypads and keyfobs
- trigger - Specifies arm modes in which the device triggers alarms.
"state/presence"
"state/open"
"state/vibration"
"state/buttonevent"
"state/on"
"""
return self.raw["devices"]
|
class AlarmSystem(APIItem):
'''deCONZ alarm system representation.
Dresden Elektroniks documentation of alarm systems in deCONZ
https://dresden-elektronik.github.io/deconz-rest-doc/endpoints/alarmsystems/
'''
@property
def arm_state(self) -> AlarmSystemArmState:
'''Alarm system state.
Can be different from the config.armmode during state transitions.
'''
pass
@property
def seconds_remaining(self) -> int:
'''Remaining time while armstate in "exit_delay" or "entry_delay" state.
In all other states the value is 0.
Supported values:
0-255.
'''
pass
@property
def pin_configured(self) -> bool:
'''Is PIN code configured.'''
pass
@property
def arm_mode(self) -> AlarmSystemArmMode:
'''Target arm mode.'''
pass
@property
def armed_away_entry_delay(self) -> int:
'''Delay in seconds before an alarm is triggered.
Supported values:
0-255.
'''
pass
@property
def armed_away_exit_delay(self) -> int:
'''Delay in seconds before an alarm is armed.
Supported values:
0-255.
'''
pass
@property
def armed_away_trigger_duration(self) -> int:
'''Duration of alarm trigger.
Supported values:
0-255.
'''
pass
@property
def armed_night_entry_delay(self) -> int:
'''Delay in seconds before an alarm is triggered.
Supported values:
0-255.
'''
pass
@property
def armed_night_exit_delay(self) -> int:
'''Delay in seconds before an alarm is armed.
Supported values:
0-255.
'''
pass
@property
def armed_night_trigger_duration(self) -> int:
'''Duration of alarm trigger.
Supported values:
0-255.
'''
pass
@property
def armed_stay_entry_delay(self) -> int:
'''Delay in seconds before an alarm is triggered.
Supported values:
0-255.
'''
pass
@property
def armed_stay_exit_delay(self) -> int:
'''Delay in seconds before an alarm is armed.
Supported values:
0-255.
'''
pass
@property
def armed_stay_trigger_duration(self) -> int:
'''Duration of alarm trigger.
Supported values:
0-255.
'''
pass
@property
def disarmed_entry_delay(self) -> int:
'''Delay in seconds before an alarm is triggered.
Supported values:
0-255.
'''
pass
@property
def disarmed_exit_delay(self) -> int:
'''Delay in seconds before an alarm is armed.
Supported values:
0-255.
'''
pass
@property
def devices(self) -> dict[str, Any]:
'''Devices associated with the alarm system.
The keys refer to the uniqueid of a light, sensor, or keypad.
Dictionary values:
- armmask - A combination of arm modes in which the device triggers alarms.
A — armed_away
N — armed_night
S — armed_stay
"none" — for keypads and keyfobs
- trigger - Specifies arm modes in which the device triggers alarms.
"state/presence"
"state/open"
"state/vibration"
"state/buttonevent"
"state/on"
'''
pass
| 33 | 17 | 7 | 1 | 2 | 4 | 1 | 1.43 | 1 | 7 | 2 | 0 | 16 | 0 | 16 | 22 | 157 | 33 | 51 | 34 | 18 | 73 | 35 | 18 | 18 | 1 | 1 | 0 | 16 |
141,640 |
Kane610/deconz
|
pydeconz/models/__init__.py
|
pydeconz.models.ResourceType
|
class ResourceType(enum.StrEnum):
"""Resource types."""
# Group resources
GROUP = "LightGroup"
# Light resources
# Configuration tool
CONFIGURATION_TOOL = "Configuration tool"
# Cover
LEVEL_CONTROLLABLE_OUTPUT = "Level controllable output"
WINDOW_COVERING_CONTROLLER = "Window covering controller"
WINDOW_COVERING_DEVICE = "Window covering device"
# Light
COLOR_DIMMABLE_LIGHT = "Color dimmable light"
COLOR_LIGHT = "Color light"
COLOR_TEMPERATURE_LIGHT = "Color temperature light"
EXTENDED_COLOR_LIGHT = "Extended color light"
DIMMABLE_LIGHT = "Dimmable light"
DIMMABLE_PLUGIN_UNIT = "Dimmable plug-in unit"
DIMMER_SWITCH = "Dimmer switch"
FAN = "Fan"
ON_OFF_LIGHT = "On/Off light"
ON_OFF_OUTPUT = "On/Off output"
ON_OFF_PLUGIN_UNIT = "On/Off plug-in unit"
SMART_PLUG = "Smart plug"
# Lock
DOOR_LOCK = "Door Lock"
# Range extender
RANGE_EXTENDER = "Range extender"
# Siren
WARNING_DEVICE = "Warning device"
# Sensor resources
# Air purifier
ZHA_AIR_PURIFIER = "ZHAAirPurifier"
# Air quality
ZHA_AIR_QUALITY = "ZHAAirQuality"
# Alarm
ZHA_ALARM = "ZHAAlarm"
# Ancillary control
ZHA_ANCILLARY_CONTROL = "ZHAAncillaryControl"
# Battery
ZHA_BATTERY = "ZHABattery"
# Carbon dioxide
ZHA_CARBON_DIOXIDE = "ZHACarbonDioxide"
# Carbon monoxide
ZHA_CARBON_MONOXIDE = "ZHACarbonMonoxide"
# Consumption
ZHA_CONSUMPTION = "ZHAConsumption"
# Daylight
DAYLIGHT = "Daylight"
CLIP_DAYLIGHT_OFFSET = "CLIPDaylightOffset"
# Door lock
ZHA_DOOR_LOCK = "ZHADoorLock"
# Fire
ZHA_FIRE = "ZHAFire"
# Formaldehyde
ZHA_FORMALDEHYDE = "ZHAFormaldehyde"
# Generic flag
CLIP_GENERIC_FLAG = "CLIPGenericFlag"
# Generic status
CLIP_GENERIC_STATUS = "CLIPGenericStatus"
# Humidity
ZHA_HUMIDITY = "ZHAHumidity"
CLIP_HUMIDITY = "CLIPHumidity"
# Light level
ZHA_LIGHT_LEVEL = "ZHALightLevel"
CLIP_LIGHT_LEVEL = "CLIPLightLevel"
# Moisture
ZHA_MOISTURE = "ZHAMoisture"
# Open close
ZHA_OPEN_CLOSE = "ZHAOpenClose"
CLIP_OPEN_CLOSE = "CLIPOpenClose"
# Particulate matter
ZHA_PARTICULATE_MATTER = "ZHAParticulateMatter"
# Power
ZHA_POWER = "ZHAPower"
# Presence
ZHA_PRESENCE = "ZHAPresence"
CLIP_PRESENCE = "CLIPPresence"
# Pressure
ZHA_PRESSURE = "ZHAPressure"
CLIP_PRESSURE = "CLIPPressure"
# Relative rotary
ZHA_RELATIVE_ROTARY = "ZHARelativeRotary"
# Switch
ZHA_SWITCH = "ZHASwitch"
ZGP_SWITCH = "ZGPSwitch"
CLIP_SWITCH = "CLIPSwitch"
# Temperature
ZHA_TEMPERATURE = "ZHATemperature"
CLIP_TEMPERATURE = "CLIPTemperature"
# Thermostat
ZHA_THERMOSTAT = "ZHAThermostat"
CLIP_THERMOSTAT = "CLIPThermostat"
# Time
ZHA_TIME = "ZHATime"
# Vibration
ZHA_VIBRATION = "ZHAVibration"
# Water
ZHA_WATER = "ZHAWater"
UNKNOWN = "unknown"
@classmethod
def _missing_(cls, value: object) -> ResourceType:
"""Set default enum member if an unknown value is provided."""
LOGGER.warning("Unsupported device type %s", value)
return cls.UNKNOWN
|
class ResourceType(enum.StrEnum):
'''Resource types.'''
@classmethod
def _missing_(cls, value: object) -> ResourceType:
'''Set default enum member if an unknown value is provided.'''
pass
| 3 | 2 | 4 | 0 | 3 | 1 | 1 | 0.62 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 69 | 146 | 41 | 65 | 63 | 62 | 40 | 64 | 62 | 62 | 1 | 3 | 0 | 1 |
141,641 |
Kane610/deconz
|
pydeconz/models/alarm_system.py
|
pydeconz.models.alarm_system.TypedAlarmSystem
|
class TypedAlarmSystem(TypedDict):
"""Alarm system type definition."""
name: str
config: TypedAlarmSystemConfig
state: TypedAlarmSystemState
devices: dict[str, TypedAlarmSystemDevices]
|
class TypedAlarmSystem(TypedDict):
'''Alarm system type definition.'''
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | 1 | 5 | 1 | 4 | 1 | 5 | 1 | 4 | 0 | 1 | 0 | 0 |
141,642 |
Kane610/deconz
|
pydeconz/models/__init__.py
|
pydeconz.models.ResourceGroup
|
class ResourceGroup(enum.StrEnum):
"""Primary endpoints resources are exposed from."""
ALARM = "alarmsystems"
CONFIG = "config"
GROUP = "groups"
LIGHT = "lights"
SCENE = "scenes"
SENSOR = "sensors"
|
class ResourceGroup(enum.StrEnum):
'''Primary endpoints resources are exposed from.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.14 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 68 | 9 | 1 | 7 | 7 | 6 | 1 | 7 | 7 | 6 | 0 | 3 | 0 | 0 |
141,643 |
Kane610/deconz
|
pydeconz/interfaces/sensors.py
|
pydeconz.interfaces.sensors.VibrationHandler
|
class VibrationHandler(APIHandler[Vibration]):
"""Handler for vibration sensor."""
resource_group = ResourceGroup.SENSOR
resource_type = ResourceType.ZHA_VIBRATION
item_cls = Vibration
|
class VibrationHandler(APIHandler[Vibration]):
'''Handler for vibration sensor.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 15 | 6 | 1 | 4 | 4 | 3 | 1 | 4 | 4 | 3 | 0 | 2 | 0 | 0 |
141,644 |
Kane610/deconz
|
pydeconz/interfaces/sensors.py
|
pydeconz.interfaces.sensors.TimeHandler
|
class TimeHandler(APIHandler[Time]):
"""Handler for time sensor."""
resource_group = ResourceGroup.SENSOR
resource_type = ResourceType.ZHA_TIME
item_cls = Time
|
class TimeHandler(APIHandler[Time]):
'''Handler for time sensor.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 15 | 6 | 1 | 4 | 4 | 3 | 1 | 4 | 4 | 3 | 0 | 2 | 0 | 0 |
141,645 |
Kane610/deconz
|
pydeconz/interfaces/sensors.py
|
pydeconz.interfaces.sensors.ThermostatHandler
|
class ThermostatHandler(APIHandler[Thermostat]):
"""Handler for thermostat sensor."""
resource_group = ResourceGroup.SENSOR
resource_types = {
ResourceType.ZHA_THERMOSTAT,
ResourceType.CLIP_THERMOSTAT,
}
item_cls = Thermostat
async def set_config(
self,
id: str,
cooling_setpoint: int | None = None,
enable_schedule: bool | None = None,
external_sensor_temperature: int | None = None,
external_window_open: bool | None = None,
fan_mode: ThermostatFanMode | None = None,
flip_display: bool | None = None,
heating_setpoint: int | None = None,
locked: bool | None = None,
mode: ThermostatMode | None = None,
mounting_mode: bool | None = None,
on: bool | None = None,
preset: ThermostatPreset | None = None,
schedule: list[str] | None = None,
set_valve: bool | None = None,
swing_mode: ThermostatSwingMode | None = None,
temperature_measurement: ThermostatTemperatureMeasurement | None = None,
window_open_detection: bool | None = None,
) -> dict[str, Any]:
"""Change config of thermostat.
Supported values:
- cooling_setpoint [int] 700-3500
- enable_schedule [bool] True/False
- external_sensor_temperature [int] -32768-32767
- external_window_open [bool] True/False
- fan_mode [ThermostatFanMode]
- "auto"
- "high"
- "low"
- "medium"
- "off"
- "on"
- "smart"
- flip_display [bool] True/False
- heating_setpoint [int] 500-3200
- locked [bool] True/False
- mode [ThermostatMode]
- "auto"
- "cool"
- "dry"
- "emergency heating"
- "fan only"
- "heat"
- "off"
- "precooling"
- "sleep"
- mounting_mode [bool] True/False
- on [bool] True/False
- preset [ThermostatPreset]
- "auto"
- "boost"
- "comfort"
- "complex"
- "eco"
- "holiday"
- "manual"
- schedule [list]
- set_valve [bool] True/False
- swing_mode [ThermostatSwingMode]
- "fully closed"
- "fully open"
- "half open"
- "quarter open"
- "three quarters open"
- temperature_measurement [ThermostatTemperatureMeasurement]
- "air sensor"
- "floor protection"
- "floor sensor"
- window_open_detection [bool] True/False
"""
data: dict[str, Any] = {
key: value
for key, value in {
"coolsetpoint": cooling_setpoint,
"schedule_on": enable_schedule,
"externalsensortemp": external_sensor_temperature,
"externalwindowopen": external_window_open,
"displayflipped": flip_display,
"heatsetpoint": heating_setpoint,
"locked": locked,
"mountingmode": mounting_mode,
"on": on,
"schedule": schedule,
"setvalve": set_valve,
"windowopen_set": window_open_detection,
}.items()
if value is not None
}
if fan_mode is not None:
data["fanmode"] = fan_mode
if mode is not None:
data["mode"] = mode
if preset is not None:
data["preset"] = preset
if swing_mode is not None:
data["swingmode"] = swing_mode
if temperature_measurement is not None:
data["temperaturemeasurement"] = temperature_measurement
return await self.gateway.request_with_retry(
"put",
path=f"{self.path}/{id}/config",
json=data,
)
|
class ThermostatHandler(APIHandler[Thermostat]):
'''Handler for thermostat sensor.'''
async def set_config(
self,
id: str,
cooling_setpoint: int | None = None,
enable_schedule: bool | None = None,
external_sensor_temperature: int | None = None,
external_window_open: bool | None = None,
fan_mode: ThermostatFanMode | None = None,
flip_display: bool | None = None,
heating_setpoint: int | None = None,
locked: bool | None = None,
mode: ThermostatMode | None = None,
mounting_mode: bool | None = None,
on: bool | None = None,
preset: ThermostatPreset | None = None,
schedule: list[str] | None = None,
set_valve: bool | None = None,
swing_mode: ThermostatSwingMode | None = None,
temperature_measurement: ThermostatTemperatureMeasurement | None = None,
window_open_detection: bool | None = None,
) -> dict[str, Any]:
'''Change config of thermostat.
Supported values:
- cooling_setpoint [int] 700-3500
- enable_schedule [bool] True/False
- external_sensor_temperature [int] -32768-32767
- external_window_open [bool] True/False
- fan_mode [ThermostatFanMode]
- "auto"
- "high"
- "low"
- "medium"
- "off"
- "on"
- "smart"
- flip_display [bool] True/False
- heating_setpoint [int] 500-3200
- locked [bool] True/False
- mode [ThermostatMode]
- "auto"
- "cool"
- "dry"
- "emergency heating"
- "fan only"
- "heat"
- "off"
- "precooling"
- "sleep"
- mounting_mode [bool] True/False
- on [bool] True/False
- preset [ThermostatPreset]
- "auto"
- "boost"
- "comfort"
- "complex"
- "eco"
- "holiday"
- "manual"
- schedule [list]
- set_valve [bool] True/False
- swing_mode [ThermostatSwingMode]
- "fully closed"
- "fully open"
- "half open"
- "quarter open"
- "three quarters open"
- temperature_measurement [ThermostatTemperatureMeasurement]
- "air sensor"
- "floor protection"
- "floor sensor"
- window_open_detection [bool] True/False
'''
pass
| 2 | 2 | 106 | 1 | 54 | 51 | 6 | 0.85 | 1 | 11 | 5 | 0 | 1 | 0 | 1 | 16 | 116 | 3 | 61 | 26 | 39 | 52 | 17 | 6 | 15 | 6 | 2 | 1 | 6 |
141,646 |
Kane610/deconz
|
pydeconz/interfaces/sensors.py
|
pydeconz.interfaces.sensors.TemperatureHandler
|
class TemperatureHandler(APIHandler[Temperature]):
"""Handler for temperature sensor."""
resource_group = ResourceGroup.SENSOR
resource_types = {
ResourceType.ZHA_TEMPERATURE,
ResourceType.CLIP_TEMPERATURE,
}
item_cls = Temperature
|
class TemperatureHandler(APIHandler[Temperature]):
'''Handler for temperature sensor.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.14 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 15 | 9 | 1 | 7 | 4 | 6 | 1 | 4 | 4 | 3 | 0 | 2 | 0 | 0 |
141,647 |
Kane610/deconz
|
pydeconz/interfaces/sensors.py
|
pydeconz.interfaces.sensors.SwitchHandler
|
class SwitchHandler(APIHandler[Switch]):
"""Handler for switch sensor."""
resource_group = ResourceGroup.SENSOR
resource_types = {
ResourceType.ZHA_SWITCH,
ResourceType.ZGP_SWITCH,
ResourceType.CLIP_SWITCH,
}
item_cls = Switch
async def set_config(
self,
id: str,
device_mode: SwitchDeviceMode | None = None,
mode: SwitchMode | None = None,
window_covering_type: SwitchWindowCoveringType | None = None,
) -> dict[str, Any]:
"""Change config of presence sensor.
Supported values:
- device_mode [SwitchDeviceMode]
- "dualpushbutton"
- "dualrocker"
- "singlepushbutton"
- "singlerocker"
- mode [SwitchMode]
- "momentary"
- "rocker"
- window_covering_type [SwitchWindowCoveringType] 0-9
"""
data: dict[str, int | str] = {}
if device_mode is not None:
data["devicemode"] = device_mode
if mode is not None:
data["mode"] = mode
if window_covering_type is not None:
data["windowcoveringtype"] = window_covering_type
return await self.gateway.request_with_retry(
"put",
path=f"{self.path}/{id}/config",
json=data,
)
|
class SwitchHandler(APIHandler[Switch]):
'''Handler for switch sensor.'''
async def set_config(
self,
id: str,
device_mode: SwitchDeviceMode | None = None,
mode: SwitchMode | None = None,
window_covering_type: SwitchWindowCoveringType | None = None,
) -> dict[str, Any]:
'''Change config of presence sensor.
Supported values:
- device_mode [SwitchDeviceMode]
- "dualpushbutton"
- "dualrocker"
- "singlepushbutton"
- "singlerocker"
- mode [SwitchMode]
- "momentary"
- "rocker"
- window_covering_type [SwitchWindowCoveringType] 0-9
'''
pass
| 2 | 2 | 32 | 1 | 19 | 12 | 4 | 0.48 | 1 | 7 | 3 | 0 | 1 | 0 | 1 | 16 | 43 | 3 | 27 | 12 | 19 | 13 | 13 | 6 | 11 | 4 | 2 | 1 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.