Skip to main content

Python bindings for Flipper Zero protobuf protocol

Python API binding/wrappers for Flipper Zero protobuf protocol and command line tool

[!NOTE]
This is a fork based on the original repo by Flipper Zero. I'm just a guy with no affiliation to Flipper Devices Inc.


flipperCmd

The command tool flipperCmd is terminal based tool for file transfer and remote command. It can be run from the command line or as an interactive app.

It is still a work in progress (Alpha) but is functional. We are looking for help with stabilization of this build, making it work on any system.

If you want to contribute, we run black and isort for code formatting purposes.


Command Line Examples

List and manage files from command line

$ flipperCmd ls
Using port /dev/cu.usbmodemflip_Unyana1
.fseventsd/              .Spotlight-V100/         badusb/                  dolphin/
ibutton/                 infrared/                lfrfid/                  music_player/
nfc/                     subghz/                  u2f/                     wav_player/
.metadata_never_index    favorites.txt            Manifest                 rwfiletest.bin

Copy single files to fromFlipper device

$ flipperCmd put My_Home_TV.ir /ext/infrared
Using port /dev/cu.usbmodemflip_UOhBaby
PUT My_Home_TV.ir /ext/infrared
putting 206 bytes

Copy directory tree to Flipper device

$ flipperCmd put-tree subghz/samples /ext/subghz

Interactive Command Mode Examples

$ flipperCmd
Using port /dev/cu.usbmodemflip_UOhBaby
Entering interactive mode

/ext flipper> help
    CAT                 : read flipper file to screen
    CD CHDIR            : change current directory on flipper
    DEV-INFO            : print device info
    DF INFO             : get Filesystem info
    DU DISK-USAGE       : display disk usage statistic
    GET GETFILE         : copy file from flipper
    GET-TREE GETTREE    : copy directory tree from flipper
    HELP ?              : print command list
    HISTORY HIST        : Print command history
    LCD LCHDIR          : Change local current directory
    LPWD                : print local working directory
    LS LIST             : list files and dirs on Flipper device
    MD MKDIR            : create a new directory
    MD5SUM MD5          : md5 hash of the file
    MV RENAME           : rename file or dir
    PRINT-SCREEN        : Take screendump in ascii or PBM format
    PUT PUTFILE         : copy file to flipper
    PUT-TREE PUTTREE    : copy directory tree to flipper
    QUIT EXIT           : Exit Program
    REBOOT              : reboot flipper
    RM DEL DELETE       : delete file of directory on flipper device
    SEND SEND-COMMAND   : Send non rpc command to flipper
    SET                 : set or print current option value
    STAT                : get info about file or dir
    START-SESSION       : (re) start RPC session
    STOP-SESSION        : stop RPC session
    TIME                : Set or Get Current time from Flipper
    ZIP                 : Generate Zip Archive

/ext flipper> ls
.Spotlight-V100/         .Trashes/                apps/                    badusb/
dolphin/                 elf/                     ibutton/                 infrared/
lfrfid/                  music_player/            nfc/                     subghz/
u2f/                     wav_player/              .metadata_never_index    favorites.txt
Manifest                 rwfiletest.bin
/ext flipper> ls ?
Syntax :
	LS [-l] [-m] <path>
    
/ext flipper> ls -lm
Storage List result:  /ext
.Spotlight-V100          	   DIR
.Trashes                 	   DIR
apps                     	   DIR
badusb                   	   DIR
dolphin                  	   DIR
elf                      	   DIR
ibutton                  	   DIR
infrared                 	   DIR
lfrfid                   	   DIR
music_player             	   DIR
nfc                      	   DIR
subghz                   	   DIR
u2f                      	   DIR
wav_player               	   DIR
.metadata_never_index    	     0 d41d8cd98f00b204e9800998ecf8427e
favorites.txt            	    93 50c7a56f93d8f6c87f205691def774fa
Manifest                 	 16871 c74a84dea8d644198d27755313942614
rwfiletest.bin           	 16384 3df67097cee5e4cea36e0f941c134ffc
Total Bytes: 33348

/ext flipper> rcd infrared/
remote directory = /ext/infrared 

/ext/infrared flipper> ls
assets/                  IRDB/                    Sanyo/                   TV_Philips/
Minolta.ir               My_Home_TV.ir

/ext/infrared flipper> quit
Quit interactive mode

API Examples:

#!/usr/bin/env python3

from flipperzero_protobuf.cli_helpers import print_hex, dict2datetime
from flipperzero_protobuf.flipper_proto import FlipperProto


def main():

    proto = FlipperProto()

    print("\n\nPing")
    ping_rep = proto.rpc_system_ping()
    print_hex(ping_rep)

    print("\n\n]DeviceInfo")
    device_info = proto.rpc_device_info()
    print(device_info)

    print("\n\nGetDateTime")
    dtime_resp = proto.rpc_get_datetime()
    dt = dict2datetime(dtime_resp)
    print(dt.ctime())

    print("\n\nList files")
    list_resp = proto.rpc_storage_list('/ext')
    for li in list_resp:
        print(f"[{li['type']}]\t{li['name']}")

    # run Infrared App
    print("\n\nrun Infrared App")
    proto.rpc_app_start('Infrared', '/ext/infrared/Tv_Tivo.ir')


if __name__ == '__main__':
    main()


See Also:
flipperdevices/flipperzero-protobuf
flipperdevices/go-flipper

Special thanks: Evilpete - for making a wrapper and a code cleanup for our internal tool!

Metadata

Release files for flipperzero-protobuf 0.1.20221108

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flipperzero-protobuf 0.1.20221108
File Size Uploaded
flipperzero_protobuf-0.1.20221108.tar.gz 34.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flipperzero-protobuf 0.1.20221108
File Interpreter ABI Platform
flipperzero_protobuf-0.1.20221108-py3-none-any.whl Python 3 none any Details

Total release size: 77.2 kB

Release files / flipperzero_protobuf-0.1.20221108.tar.gz

Download URL flipperzero_protobuf-0.1.20221108.tar.gz
Size 34.3 kB
Tags Source
SHA-256 checksum
How to use checksums
64e4117a9fe3e06f7d652c513774ade7fc22bd25c2ddcef3f460582e9d31fe80
BLAKE2b-256 checksum
How to use checksums
9a56d395d8d4f1267c63d4159b0f00b91a60e4345d990bb108e184bbd5167b12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.5

Release files / flipperzero_protobuf-0.1.20221108-py3-none-any.whl

Download URL flipperzero_protobuf-0.1.20221108-py3-none-any.whl
Size 42.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f96a99aec1e01f46d24f05ef1dcab11d9b4d7c6f92abece030b414ef62c82fd2
BLAKE2b-256 checksum
How to use checksums
3ef6b7f86453c691d40bd772b14d94ec5c48b5f46d376cb710f7c3739dfeed4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.5

Release history Release notifications | RSS feed

This release

0.1.20221108 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page