Skip to content

Commit

Permalink
Check if pulses to binary consersion went successfull
Browse files Browse the repository at this point in the history
  • Loading branch information
rrooggiieerr committed Jan 24, 2024
1 parent 30f6870 commit 224c97e
Show file tree
Hide file tree
Showing 22 changed files with 76 additions and 29 deletions.
6 changes: 5 additions & 1 deletion rfcontrol/protocols/_skeleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ def decode(pulses):

# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)
# Binary is now something like:

if binary is None:
return None

# Binary is now something like:
#

# Now we extract the data from that string.
Expand Down
3 changes: 3 additions & 0 deletions rfcontrol/protocols/dimmer1.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ def decode(pulses: str):
# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)

if binary is None:
return None

# Binary is now something like:
# 001000111101001000100110100100000001

Expand Down
3 changes: 3 additions & 0 deletions rfcontrol/protocols/dimmer2.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ def decode(pulses):
# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)

if binary is None:
return None

# Binary is now something like:
#

Expand Down
4 changes: 4 additions & 0 deletions rfcontrol/protocols/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def decode(pulses):

# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)

if binary is None:
return None

# Binary is now something like:
#

Expand Down
4 changes: 4 additions & 0 deletions rfcontrol/protocols/generic2.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def decode(pulses):

# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)

if binary is None:
return None

# Binary is now something like:
# 11011110111110000011111101111111

Expand Down
7 changes: 4 additions & 3 deletions rfcontrol/protocols/pir1.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ def decode(pulses):

# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)

if binary is None:
return None

# Binary is now something like:
# 101000001000
# | 10100 | 00010 | 0 | 0 |
# | Unit | ID | fixed | State|

if binary is None:
return None

# Now we extract the data from that string.
decoded = {
"id": int(binary[0:5], 2),
Expand Down
7 changes: 4 additions & 3 deletions rfcontrol/protocols/pir2.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ def decode(pulses):

# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)

if binary is None:
return None

# Binary is now something like:
# 101000001000
# | 10100 | 00010 | 0 | 0 |
# | Unit | ID | fixed | State|

if binary is None:
return None

# Now we extract the data from that string.
decoded = {
"id": int(binary[0:5], 2),
Expand Down
5 changes: 3 additions & 2 deletions rfcontrol/protocols/pir3.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ def decode(pulses):

# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)
# Binary is now something like:
# 10010011000011100010101001101100

if binary is None:
return None

# Binary is now something like:
# 10010011000011100010101001101100

# Now we extract the data from that string.
decoded = {
"id": int(binary[0:16], 2),
Expand Down
5 changes: 3 additions & 2 deletions rfcontrol/protocols/pir6.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ def decode(pulses):

# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)
# Binary is now something like:
# 001100001110100011000011

if binary is None:
return None

# Binary is now something like:
# 001100001110100011000011

# Now we extract the data from that string.
decoded = {
"id": int(binary[2:25], 2),
Expand Down
5 changes: 3 additions & 2 deletions rfcontrol/protocols/switch1.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ def decode(pulses):

# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)
# Binary is now something like:
# 00100011110100100010011010010000

if binary is None:
return None

# Binary is now something like:
# 00100011110100100010011010010000

# Now we extract the data from that string.
# | 00100011110100100010011010 | 0 | 1 | 0000 |
# | ID | All | State | Unit |
Expand Down
5 changes: 3 additions & 2 deletions rfcontrol/protocols/switch10.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ def decode(pulses):
# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)
logger.debug(binary)
# Binary is now something like:
# 11000111100 1011110001111001101001101110101010110101100011

if binary is None:
return None

# Binary is now something like:
# 11000111100 1011110001111001101001101110101010110101100011

# Now we extract the data from that string.
# | 11000111100 10111100011110011010011011101010 1011 01 01 100011
# | ? | systemcode | Group | State | group2 | Unit
Expand Down
4 changes: 4 additions & 0 deletions rfcontrol/protocols/switch11.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ def decode(pulses):

# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)

if binary is None:
return None

# Binary is now something like:
# 1011111111011111111110

Expand Down
5 changes: 3 additions & 2 deletions rfcontrol/protocols/switch2.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ def decode(pulses):

# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)
# Binary is now something like:
# 110011000010

if binary is None:
return None

# Binary is now something like:
# 110011000010

# Now we extract the data from that string.
# | 11001 | 10000 | 1 | 0 |
# | HouseCode | UnitCode | State | inverted state |
Expand Down
4 changes: 4 additions & 0 deletions rfcontrol/protocols/switch25.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def decode(pulses):

# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)

if binary is None:
return None

# Binary is now something like:
# 10101010101010101010101010101010010101010101010101

Expand Down
5 changes: 3 additions & 2 deletions rfcontrol/protocols/switch3.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ def decode(pulses):

# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)
# Binary is now something like:
# 110011000010

if binary is None:
return None

# Binary is now something like:
# 110011000010

# Now we extract the data from that string.
# | 11001 | 10000 | 1 | 0 |
# | HouseCode | UnitCode | inverted State | State|
Expand Down
5 changes: 3 additions & 2 deletions rfcontrol/protocols/switch4.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ def decode(pulses):

# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)
# Binary is now something like:
# 101000001000

if binary is None:
return None

# Binary is now something like:
# 101000001000

# Now we extract the data from that string.
# | 10100 | 00010 | 0 | 0 |
# | Unit | ID | Fixed | Inverted State|
Expand Down
5 changes: 3 additions & 2 deletions rfcontrol/protocols/switch5.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ def decode(pulses):

# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)
# Binary is now something like:
# 011100011011000111110000

if binary is None:
return None

# Binary is now something like:
# 011100011011000111110000

# Now we extract the data from that string.
# | 01110001101100011111 | 000 | 0 |
# | ID | UnitCode | inverted state |
Expand Down
5 changes: 3 additions & 2 deletions rfcontrol/protocols/switch6.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ def decode(pulses):

# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)
# Binary is now something like:
# 011100011011000111110000

if binary is None:
return None

# Binary is now something like:
# 011100011011000111110000

# Now we extract the data from that string.
# | 01110 | 01000 | 0 | 1
# | SystemCode | ProgramCode | invertes state | state
Expand Down
5 changes: 3 additions & 2 deletions rfcontrol/protocols/switch7.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ def decode(pulses):

# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)
# Binary is now something like:
#

if binary is None:
return None

# Binary is now something like:
#

# Now we extract the data from that string.
decoded = {
"id": int(binary[4:7][::-1], 2),
Expand Down
5 changes: 3 additions & 2 deletions rfcontrol/protocols/switch8.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ def decode(pulses):

# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)
# Binary is now something like:
# 111100021112

if binary is None:
return None

# Binary is now something like:
# 111100021112

# Now we extract the data from that string.
# | 11110 | 00211 | 1 | 2
# | SystemCode | ProgramCode | inverse state | state
Expand Down
4 changes: 4 additions & 0 deletions rfcontrol/protocols/weather19.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def decode(pulses):

# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)

if binary is None:
return None

# Binary is now something like:
# 11100000000000010000101010001011

Expand Down
4 changes: 4 additions & 0 deletions rfcontrol/protocols/weather7.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def decode(pulses):

# We first map the sequences to binary.
binary = pulses2binary(pulses, pulses2binary_mapping)

if binary is None:
return None

# Binary is now something like:
# 010111010000000100001110011100100010

Expand Down

0 comments on commit 224c97e

Please sign in to comment.