rf-protocols 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ """Library to decode and encode radio frequency signals."""
2
+
3
+ from .commands import ModulationType, OOKCommand, RadioFrequencyCommand, Timing
4
+
5
+ __all__ = [
6
+ "ModulationType",
7
+ "OOKCommand",
8
+ "RadioFrequencyCommand",
9
+ "Timing",
10
+ ]
@@ -0,0 +1,80 @@
1
+ """Common RF command definitions."""
2
+
3
+ import abc
4
+ from dataclasses import dataclass
5
+ from enum import StrEnum
6
+ from typing import override
7
+
8
+
9
+ class ModulationType(StrEnum):
10
+ """RF modulation type."""
11
+
12
+ OOK = "OOK"
13
+
14
+
15
+ @dataclass(frozen=True, slots=True)
16
+ class Timing:
17
+ """High/low signal timing for OOK modulation."""
18
+
19
+ high_us: int
20
+ low_us: int
21
+
22
+
23
+ class RadioFrequencyCommand(abc.ABC):
24
+ """Base class for RF commands."""
25
+
26
+ frequency: int
27
+ repeat_count: int
28
+ modulation: ModulationType
29
+ symbol_rate: int | None
30
+ output_power: float | None
31
+
32
+ def __init__(
33
+ self,
34
+ *,
35
+ frequency: int,
36
+ modulation: ModulationType,
37
+ repeat_count: int = 0,
38
+ symbol_rate: int | None = None,
39
+ output_power: float | None = None,
40
+ ) -> None:
41
+ """Initialize the RF command."""
42
+ self.frequency = frequency
43
+ self.modulation = modulation
44
+ self.repeat_count = repeat_count
45
+ self.symbol_rate = symbol_rate
46
+ self.output_power = output_power
47
+
48
+ @abc.abstractmethod
49
+ def get_raw_timings(self) -> list[Timing]:
50
+ """Get raw timings for OOK commands."""
51
+
52
+
53
+ class OOKCommand(RadioFrequencyCommand):
54
+ """OOK command with raw timings."""
55
+
56
+ timings: list[Timing]
57
+
58
+ def __init__(
59
+ self,
60
+ *,
61
+ frequency: int,
62
+ timings: list[Timing],
63
+ repeat_count: int = 0,
64
+ symbol_rate: int | None = None,
65
+ output_power: float | None = None,
66
+ ) -> None:
67
+ """Initialize the OOK command."""
68
+ super().__init__(
69
+ frequency=frequency,
70
+ modulation=ModulationType.OOK,
71
+ repeat_count=repeat_count,
72
+ symbol_rate=symbol_rate,
73
+ output_power=output_power,
74
+ )
75
+ self.timings = timings
76
+
77
+ @override
78
+ def get_raw_timings(self) -> list[Timing]:
79
+ """Get raw timings."""
80
+ return self.timings
@@ -0,0 +1,19 @@
1
+ Metadata-Version: 2.4
2
+ Name: rf-protocols
3
+ Version: 0.0.1
4
+ Summary: Library to decode and encode radio frequency signals.
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/home-assistant-libs/rf-protocols
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.13.0
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Provides-Extra: dev
13
+ Requires-Dist: pytest; extra == "dev"
14
+ Requires-Dist: prek; extra == "dev"
15
+ Dynamic: license-file
16
+
17
+ # Python RF Protocols for Home Assistant
18
+
19
+ Python package to decode and encode radio frequency signals for use in Home Assistant.
@@ -0,0 +1,7 @@
1
+ rf_protocols/__init__.py,sha256=A6fDLZLWnR3kqlmZkr3B4ypUwZ0yPpiOhLRdTCdJmTc,239
2
+ rf_protocols/commands.py,sha256=RW8LzrdeRCm8drTdJDn324kGgCJV-qE1uN0rLOA46JI,1911
3
+ rf_protocols-0.0.1.dist-info/licenses/LICENSE,sha256=oaPjui5ki5qjpewrjX0k1Qg5PaPVc83QpgCX7VbKx6E,1076
4
+ rf_protocols-0.0.1.dist-info/METADATA,sha256=CsnuXWfFe7TgbGMFaTG9mpFr8YVujqshLtRSpMEhQh4,647
5
+ rf_protocols-0.0.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
6
+ rf_protocols-0.0.1.dist-info/top_level.txt,sha256=YAKSQ0xrIVumaK94bUe1vHlOYAvhnvrix5Rwf10K-CU,13
7
+ rf_protocols-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Home Assistant Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ rf_protocols