Python prototype to control ceiling fan ( H52-5B ) through 315Mhz transmitter
Recorded from remote with FCC ID: A25-TX005R
- Modulation: ASK
- Pulse Width: 450ms
- Coding: NRZ
- Zeros and ones have equal pulse width. GPIO set to high for 405ms means 1, while GPIO set to low for 450 ms means 0.
Every messages remotes sends 5 times, with pause between message 850us.
Every message has remote ID + command + ending:
- Remote ID is unique 6 bytes identifier every remote has. Fan learn this identifier during pairing session.
- Command is an actual command for the fan. See table below
- Ending is 9 bits
0b001011001
. They are always the same in every message.
Action | Code |
---|---|
Pair remote | 0x9659 |
High Speed | 0x92db |
Medium speed | 0xb2db |
Low Speed | 0x96db |
Turn off fan | 0xb6cb |
Toggle light on/off | 0x92cb |
Can be any value between 0x71231248b85b
and 0x136db2c96592b
, including these values. Maybe range even bigger, but I don't want to spend time finding precise ranges. I can confirm that 0xFFFFFFFFFFFF
doesn't work as well as 0xb6db2c96592c
.
Let's assume you have fan you paired earlier with remote ID 0x96d97db34b24
. Then to send a command to toggle light you send 0x96d97db34b24
+ 0x92cb
+ 0b001011001
. Which in binary format will be 0b1001011011011001011111011011001101001011001001001001001011001011001011001
poetry run main
will start http server, first add an remote by calling 'curl -XPOST -H'Content-Type: application/json' http://172.17.0.1:8081/new/remote -d'{"remote_name":"befroom_fan","remote_id":"0X00000000000"}'
. You can add few different remotes.
After you added remotes, you can send them commands(see protocol.py
) for example curl -XPOST http://172.17.0.1:8081/command/bedroom_fan/light_toggle