I know that using the flipper for this kind of task is a little overkill, but actually it’s the only device that can communicate with my shutters
To integrate with HA it’s easy using the uart link :
#!/usr/bin/env python3
import serial
FLIP="/dev/serial/by-id/usb-Flipper_Devices_Inc._Flipper_O*****e_flip_O*****e-if00"
link = serial.Serial(FLIP, 9600)
def r():
ret=b""
while True:
if ret[-3:] == b">: ": # btw i hope flipper dev will add EOM and EOT char instead of expect prompt over serial
break
c = link.read(1)
ret+=c
return ret.decode()
def send(c):
link.write(c.encode()+b"\r\n")
print(r())
r() # strip flipper ascii art
send("storage list /ext/subghz")
send("subghz decode_raw /ext/subghz/Clo_all.sub")
send("subghz foo")
link.close()
it outputs
storage list /ext/subghz
[D] assets
[F] Raw_signal_.sub 254b
[F] Garage.sub 17319b
[F] RAW_.sub 12636b
[F] Op.sub 36985b
[F] Op_all.sub 9458b
[F] Up_volet.sub 4444b
[F] Clo_all.sub 6504b
[F] Sto_all.sub 6496b
[F] Ultra_aptechka.sub 180b
>:
subghz decode_raw /ext/subghz/Clo_all.sub
SubGhz decode_raw: Load_keystore keeloq_mfcodes OK
SubGhz decode_raw: Load_keystore keeloq_mfcodes_user ERROR
Listening at /ext/subghz/Clo_all.sub.
Press CTRL+C to stop
KeeLoq 64bit
Key:23B121******1C01
Fix:0x80****F3 Cnt:0000
Hop:0x74****C4 Btn:8
MF:Unknown
Sn:0x0****F3
Packets received 1
>:
subghz foo
Usage:
subghz <cmd> <args>
Cmd list:
chat <frequency:in Hz> - Chat with other Flippers
tx <3 byte Key: in hex> <frequency: in Hz> <te: us> <repeat: count> - Transmitting key
rx <frequency:in Hz> - Receive
rx_raw <frequency:in Hz> - Receive RAW
decode_raw <file_name: path_RAW_file> - Testing
>:
i looked at firmware source code that handle the serial connection
https://github.com/flipperdevices/flipperzero-firmware/tree/dev/applications/services/cli
https://github.com/flipperdevices/flipperzero-firmware/blob/dev/applications/main/subghz/subghz_cli.c
and it doesn’t seems to have an “emulate” option to fire the recorded signal.
So that’s why i requested an update to add with option in cli application.
Maybe if i have time in the next weeks i’ll fork the firmware to add this option and the HA plugin that uses it.