summaryrefslogtreecommitdiff
path: root/flipper-ac.py
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2026-02-24 17:00:35 +0800
committerlittleblack111 <littleblack11111@gmail.com>2026-02-24 17:00:35 +0800
commit5a1ec0958c698baceda6459f2f455d38b681d731 (patch)
tree9c7b8aedf6017813e6d44301a694dadd83cc741a /flipper-ac.py
parent85ce700898392cb92952b9b417de2f1727d5ed0a (diff)
bump
Diffstat (limited to 'flipper-ac.py')
-rwxr-xr-xflipper-ac.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/flipper-ac.py b/flipper-ac.py
index 9c3ab96..19c0328 100755
--- a/flipper-ac.py
+++ b/flipper-ac.py
@@ -14,10 +14,9 @@ class status_t(Enum):
TURNING_OFF = "󰼩"
ac_open = [3538,1661,502,392,474,1257,475,390,450,413,450,414,449,414,449,415,449,413,450,413,475,389,475,389,475,388,475,391,475,1257,474,391,472,391,471,392,470,395,468,420,444,419,444,423,444,1288,443,1289,444,1289,443,419,444,423,443,1290,444,419,444,419,444,419,444,420,444,419,444,419,444,419,444,421,443,419,444,419,444,419,444,420,444,419,444,419,444,420,443,421,443,419,444,420,443,419,444,421,443,420,443,420,443,420,443,421,443,420,443,420,443,420,443,421,443,420,443,423,444,1288,443,1290,444,420,443,420,443,420,443,421,443,423,443,9965,3483,1722,443,423,443,1290,442,421,443,420,443,420,443,420,443,422,442,421,442,421,442,420,443,422,442,421,442,424,443,1290,442,422,442,421,442,421,442,421,442,422,442,421,442,425,442,1289,442,1291,442,1291,441,421,442,425,441,1292,442,421,442,421,442,422,441,423,441,422,441,422,441,422,441,422,442,422,441,422,441,422,441,423,441,425,442,1291,442,422,441,422,441,1290,441,1290,441,1291,442,423,441,422,441,426,441,1290,442,1293,441,426,441,1291,440,1292,441,423,441,422,441,423,440,423,440,424,440,423,440,423,440,423,440,423,440,1291,441,1292,441,423,440,425,439,427,440,1292,439,1293,440,425,439,424,439,425,438,449,414,450,414,449,414,449,414,449,414,450,414,449,414,449,414,449,414,450,414,449,414,450,413,449,414,451,414,450,413,453,413,1318,414,1319,413,1319,414,450,413,450,413,451,413,450,413,451,412,450,413,452,412,451,412,454,413,1319,413,1320,413,1320,412,451,412,451,412,453,411,452,411,452,411,452,411,454,410,453,410,453,410,478,385,479,385,478,385,478,385,478,385,479,385,482,385,1347,385,1348,385,480,384,478,385,479,384,479,385,479,384,1348,385,479,384,479,384,481,383,483,384,1349,384,483,383,1349,384,1349,384,483,383,1350,383,481,383,481,382,482,382,481,358,506,358,534,332,1375,358,531,332,531,332,1375,358,535,331,1400,332,1402,332,533,332]
+ac_max = [3550,1651,506,387,479,1226,507,384,480,382,481,383,479,384,478,386,478,385,478,385,478,386,477,387,477,387,475,391,475,1257,475,392,472,392,470,393,470,394,469,395,470,394,469,398,469,1263,469,1264,468,1264,469,395,468,398,469,1265,469,394,469,395,468,395,468,396,468,395,468,395,468,395,468,396,468,395,468,395,468,395,468,396,468,395,468,395,468,395,468,396,468,395,468,395,468,395,468,396,469,395,468,395,468,396,467,397,467,396,467,396,467,396,467,397,467,419,444,400,467,1265,467,1267,467,419,444,420,443,396,468,420,444,399,468,9969,3489,1717,443,423,444,1289,444,421,443,420,443,420,443,420,443,421,443,420,443,420,444,420,443,421,444,420,443,423,444,1290,443,421,443,420,444,420,443,420,443,421,444,420,443,424,443,1289,443,1290,443,1290,443,421,442,424,443,1291,443,421,443,420,443,420,443,422,442,421,442,421,442,421,442,422,442,421,442,421,442,421,442,422,443,424,443,1291,442,421,442,421,443,1289,443,1290,442,1291,442,422,442,421,442,421,442,421,442,422,443,421,442,425,442,1291,442,423,442,421,442,421,442,421,442,422,442,422,442,421,442,421,442,422,441,1290,442,1291,442,422,441,423,442,425,441,1290,442,1290,442,1292,442,422,441,422,441,422,441,423,441,422,441,422,441,422,442,424,440,423,440,423,440,423,440,424,440,423,440,423,440,423,440,424,440,424,439,427,440,1292,440,1293,440,1294,439,424,439,425,438,427,438,425,438,450,413,450,413,451,413,451,412,454,413,1319,413,1320,413,1320,413,451,412,451,412,453,412,452,411,452,411,452,412,454,410,479,384,479,384,479,384,480,384,480,383,480,383,480,383,482,382,485,357,1374,383,1350,382,483,357,533,330,534,329,534,329,535,328,1404,329,535,328,561,302,564,300,592,274,1432,301,593,273,1433,301,1459,273,622,216,1489,245]
ac_close = [3519,1714,451,417,450,1281,452,414,450,413,450,413,450,414,449,414,450,413,450,412,451,412,451,413,451,412,451,416,475,1256,477,389,475,389,473,392,470,417,445,419,445,419,444,423,443,1288,443,1289,444,1289,444,419,444,423,443,1290,444,420,443,420,443,419,444,421,443,419,444,420,443,420,443,421,443,420,443,420,443,420,443,421,443,420,443,420,443,420,443,421,443,420,443,420,443,420,443,421,443,420,443,421,442,420,443,421,443,421,442,420,443,421,442,422,442,421,442,424,443,1289,442,1292,442,421,442,421,442,421,442,422,442,424,442,9969,3484,1720,440,426,441,1292,440,424,440,423,440,422,441,423,440,424,441,422,441,422,441,422,441,424,441,422,441,426,441,1292,441,424,441,422,441,423,440,423,440,424,440,423,440,426,440,1292,439,1293,440,1293,440,423,440,427,440,1294,439,424,440,424,439,423,440,449,415,448,415,448,415,448,415,449,415,448,415,448,415,425,438,449,415,448,415,448,415,448,415,448,415,1316,415,1317,414,1318,415,450,415,448,415,451,416,1317,415,1319,415,451,416,1292,440,1292,442,422,443,420,444,420,443,419,444,420,444,419,444,419,444,419,444,419,444,1288,444,1288,444,419,444,420,444,422,445,1287,445,1288,445,419,445,418,445,394,470,394,469,395,469,394,469,394,469,393,470,394,471,393,470,393,470,393,470,394,470,393,470,393,470,393,470,394,470,393,470,397,470,1262,469,1263,470,1263,470,394,470,393,470,395,469,394,469,394,469,394,469,395,470,394,469,397,470,1263,469,1264,469,1264,469,394,470,394,469,395,469,394,469,394,469,394,470,395,469,394,469,394,469,395,468,396,469,395,468,395,468,395,468,396,468,422,445,1263,469,1264,469,396,468,396,468,419,444,419,444,395,468,1288,445,419,444,395,468,420,444,422,445,1289,444,423,444,1289,443,1289,444,422,445,1289,444,420,445,419,444,419,444,419,444,420,445,419,444,419,444,419,444,419,444,1289,444,423,444,1288,444,1290,444,421,444]
-flipper = PyFlipper(com="/dev/serial/by-id/usb-Flipper_Devices_Inc._Flipper_Helper_flip_Helper-if00")
-
def reloadWaybar():
system("pkill -RTMIN+6 waybar")
@@ -55,26 +54,36 @@ def main():
def on():
writeStatus(status_t.TURNING_ON)
- with suppress(Exception):
- flipper.ir.tx_raw(frequency=38000, duty_cycle=0.33, samples=ac_open)
+ # with suppress(Exception):
+ PyFlipper(com="/dev/serial/by-id/usb-Flipper_Devices_Inc._Helper_flip_Helper-if00").ir.tx_raw(frequency=38000, duty_cycle=0.33, samples=ac_open)
+ writeStatus(status_t.ON)
+ return True
+
+def max():
+ writeStatus(status_t.TURNING_ON)
+ # with suppress(Exception):
+ PyFlipper(com="/dev/serial/by-id/usb-Flipper_Devices_Inc._Helper_flip_Helper-if00").ir.tx_raw(frequency=38000, duty_cycle=0.33, samples=ac_max)
writeStatus(status_t.ON)
return True
def off():
writeStatus(status_t.TURNING_OFF)
- with suppress(Exception):
- flipper.ir.tx_raw(frequency=38000, duty_cycle=0.33, samples=ac_close)
+ # with suppress(Exception):
+ PyFlipper(com="/dev/serial/by-id/usb-Flipper_Devices_Inc._Helper_flip_Helper-if00").ir.tx_raw(frequency=38000, duty_cycle=0.33, samples=ac_close)
writeStatus(status_t.OFF)
return False
-def statusBool() -> status_t:
+def statusRaw() -> status_t:
return status_t[getStatusFd().read().strip()]
+def statusBool() -> bool:
+ return statusRaw() == status_t.ON or statusRaw() == status_t.TURNING_ON
+
def status() -> str:
- return statusBool().value
+ return statusRaw().value
def toggle():
- if statusBool() == status_t.ON or statusBool() == status_t.TURNING_ON:
+ if statusRaw() == status_t.ON or statusRaw() == status_t.TURNING_ON:
off()
else: # status() == status_t.OFF or status() == status_t.TURNING_OFF:
on()