wh00hw / pyFlipper

Flipper Zero Python CLI Wrapper
MIT License
384 stars 39 forks source link

Infrared - NECext protocol #15

Open tagraf opened 1 year ago

tagraf commented 1 year ago
Forgive me if I'm in the wrong place to be but I'll post nonetheless in the hope for some answers.

 I'm able to printout this "flipper.ir.rx(timeout=5)" as shown:
NECext, A:0xEF00, C:0xFD02
------------------------------------------------------------------------------------------
My question is, is this the correct setup for tx?
flipper.ir.tx(protocol="NECext", hex_address="EF00", hex_command="FD02")
------------------------------------------------------------------------------------------
I had to revise several times on account of errors:
- "NECext" protocol is not available (according to pyFlipper)
  - AssertionError: Available protocols: ['NEC', 'NEC42', 'NEC42ext', 'Samsung32', 'RC6', 'RC5', 'RC5X', 'SIRC', 'SIRC15', 'SIRC20']
- Address & Command's length of bytes need to be 8.
------------------------------------------------------------------------------------------
Here's my revision by far:
flipper.ir.tx(protocol="NEC", hex_address="0000EF00", hex_command="0000FD02")  # Four zeros in leftmost
flipper.ir.tx(protocol="NEC", hex_address="EF000000", hex_command="FD020000")  # Four zeros in rightmost
------------------------------------------------------------------------------------------
Upon testing it, it didn't produce errors but the end-device did not responded by signals.  The IR did flickered (as visibly tested by my phone camera).  So, my guess is it's the protocol that needs to be NECext.
------------------------------------------------------------------------------------------
...OR...
I need to figure out how to translate this (( NECext, A:0xEF00, C:0xFD02 )) into this:
flipper.ir.tx_raw(frequency=, duty_cycle=, samples=[])
tagraf commented 1 year ago
##########################################
flipper.ir.rx(timeout=5)

# OUTPUT
Receiving  INFRARED...
Press Ctrl+C to abort
NECext, A:0xEF00, C:0xFD02
NECext, A:0xEF00, C:0xFD02 R
NECext, A:0xEF00, C:0xFD02 R

>:

##########################################
flipper.storage.read(file="/ext/infrared/Aura_led.ir")

# OUTPUT
name: NECe_FD02
type: parsed
protocol: NECext
address: 00 EF 00 00
command: 02 FD 00 00
##########################################

I've tested with:
flipper.ir.tx(protocol="NECext", hex_address="00 EF 00 00", hex_command="02 FD 00 00")
Got failed, Protocol unavailable.
---
Tested with different protocols as well:
flipper.ir.tx(protocol="NEC", hex_address="00 EF 00 00", hex_command="02 FD 00 00")  # FAILED (Not responsive)
flipper.ir.tx(protocol="NEC42", hex_address="00 EF 00 00", hex_command="02 FD 00 00") # FAILED (Not responsive)
flipper.ir.tx(protocol="NEC42ext", hex_address="00 EF 00 00", hex_command="02 FD 00 00") # FAILED (Not responsive)
---
Note the difference in command value (they're the same pressed button)
C:0xFD02                            #  flipper.ir.rx()
command: 02 FD 00 00    # flipper.storage.read(file="/ext/infrared/Aura_led.ir")