This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
home:rf_control [2021/01/27 16:27] derek created |
home:rf_control [2024/09/22 19:51] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
=====Rf Control===== | =====Rf Control===== | ||
- | Flash and use the [[https:// | + | Flash and use the [[https:// |
====Setup==== | ====Setup==== | ||
- | Using a [[https:// | + | Using a [[https:// |
- | ===Preparation=== | + | ===Downloads=== |
* Download [[https:// | * Download [[https:// | ||
* Download '' | * Download '' | ||
* Download the entire contents of the [[https:// | * Download the entire contents of the [[https:// | ||
- | * | + | |
+ | ===Prepare the RF Bridge=== | ||
* Remove the rubber feet from the Sonoff RF Bridge, optionally placing them just next to the screw holes | * Remove the rubber feet from the Sonoff RF Bridge, optionally placing them just next to the screw holes | ||
* Pull out the circuit board from the casing | * Pull out the circuit board from the casing | ||
Line 15: | Line 16: | ||
* Locate the 5-pin header under near the bottom of the bent up led panel | * Locate the 5-pin header under near the bottom of the bent up led panel | ||
* Move the switch position towards the 5-pin header (to the off position) | * Move the switch position towards the 5-pin header (to the off position) | ||
- | | + | |
- | * Attach the dupont | + | ===Flash ESP=== |
- | * | + | |
+ | * Attach the female to male dupont | ||
+ | * Place the male ends of the dupont wires in the RF bridge in the following order, making sure there is good contact: | ||
+ | * Serial -> RF Bridge: | ||
+ | * VCC -> 3V3 | ||
+ | * TX -> RX | ||
+ | * RX -> TX | ||
+ | * GND -> GND | ||
+ | * Connect the serial-to-USB adapter to the computer while pressing the button on the edge in order to put the ESP8285 into programming mode to upload the Tasmota firmware | ||
* If the green led panel lights up and there is no blue flashing light then it is in programming mode | * If the green led panel lights up and there is no blue flashing light then it is in programming mode | ||
+ | * Release the button on the RF bridge | ||
+ | * Open ESPHome-Flasher on the PC | ||
+ | * Make sure the correct serial port appears and is selected | ||
+ | * Select the '' | ||
+ | * Click '' | ||
- | <code batch batch.bat> | + | ===Configure Tasmota=== |
- | Downloadable batch file | + | * Using a Wi-Fi device search for a wifi AP named tasmota_XXXXXX-#### |
- | </code> | + | * It should take you to the Tasmota configuration page automatically |
+ | * Configure your network details in '' | ||
+ | * It should connect to your wifi network, use your router to find its IP address | ||
+ | * Connect to that address: | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * Enter the command: '' | ||
+ | |||
+ | ===Flash RF firmware=== | ||
+ | * Disconnect the RF Bridge from the PC | ||
+ | * Keep the switch on the RF Bridge in the '' | ||
+ | * On the RF Bridge, connect two wires from GPIO4 to C2D and GPIO5 to C2Ck | ||
+ | * Plug the serial adaptor back into the PC | ||
+ | * Reconnect to the RF Bridge web UI: | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * Disconnect the serial adaptor from the PC and remove all the wiring | ||
+ | * Switch the ON/OFF switch on the board back to '' | ||
+ | * Carefully bend the led panel back into place and optionally cut one of the wires to it to disable the relatively bright led | ||
+ | * Fit the board into the case again, screwing it in | ||
+ | |||
+ | ===Create and upload ESPHome firmware=== | ||
+ | * Give the RF bridge a static IP address in your router | ||
+ | * Using the ESPHome addon in Home Assistant: | ||
+ | * Create a new device with the name '' | ||
+ | * Enter the code from the [[#Notes]] section below into the config of the device | ||
+ | * '' | ||
+ | * Three dot menu on the device | ||
+ | * '' | ||
+ | * Power up the RF bridge and load its web UI: | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * You should get a new device discovered notification in Home Assistant | ||
+ | * Agree to add the RF bridge to Home Assistant | ||
+ | |||
+ | ===Learn Codes=== | ||
+ | * FIXME: learn new RF codes | ||
====Update==== | ====Update==== | ||
Line 31: | Line 84: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
====Notes==== | ====Notes==== | ||
+ | ESPHome firmware definition to allow discovery of new RF codes: | ||
+ | <code yaml> | ||
+ | substitutions: | ||
+ | devicename: sonoff_rf_bridge | ||
+ | upper_devicename: | ||
+ | device_platform: | ||
+ | device_board: | ||
+ | device_ip: 10.0.0.108 | ||
+ | |||
+ | # Enable Web Server (optional) | ||
+ | # web_server: | ||
+ | # port: 80 | ||
+ | |||
+ | <<: !include common/ | ||
+ | |||
+ | logger: | ||
+ | baud_rate: 0 | ||
+ | |||
+ | uart: | ||
+ | tx_pin: 1 | ||
+ | rx_pin: 3 | ||
+ | baud_rate: 19200 | ||
+ | |||
+ | api: | ||
+ | services: | ||
+ | - service: send_rf_code | ||
+ | variables: | ||
+ | sync: int | ||
+ | low: int | ||
+ | high: int | ||
+ | code: int | ||
+ | then: | ||
+ | - rf_bridge.send_code: | ||
+ | sync: !lambda ' | ||
+ | low: !lambda ' | ||
+ | high: !lambda ' | ||
+ | code: !lambda ' | ||
+ | - service: learn | ||
+ | then: | ||
+ | - rf_bridge.learn | ||
+ | - service: send_advanced_rf_code | ||
+ | variables: | ||
+ | length: int | ||
+ | protocol: int | ||
+ | code: string | ||
+ | then: | ||
+ | - rf_bridge.send_advanced_code: | ||
+ | length: !lambda ' | ||
+ | protocol: !lambda ' | ||
+ | code: !lambda ' | ||
+ | - service: start_advanced_sniffing | ||
+ | then: | ||
+ | - rf_bridge.start_advanced_sniffing | ||
+ | - service: stop_advanced_sniffing | ||
+ | then: | ||
+ | - rf_bridge.stop_advanced_sniffing | ||
+ | |||
+ | rf_bridge: | ||
+ | on_code_received: | ||
+ | then: | ||
+ | - homeassistant.event: | ||
+ | event: esphome.rf_code_received | ||
+ | data: | ||
+ | sync: !lambda 'char buffer [10];return itoa(data.sync, | ||
+ | low: !lambda 'char buffer [10];return itoa(data.low, | ||
+ | high: !lambda 'char buffer [10];return itoa(data.high, | ||
+ | code: !lambda 'char buffer [10];return itoa(data.code, | ||
+ | |||
+ | on_advanced_code_received: | ||
+ | then: | ||
+ | - homeassistant.event: | ||
+ | event: esphome.rf_advanced_code_received | ||
+ | data: | ||
+ | length: !lambda 'char buffer [10];return itoa(data.length, | ||
+ | protocol: !lambda 'char buffer [10];return itoa(data.protocol, | ||
+ | code: !lambda ' | ||
+ | |||
+ | # Turn the Wifi led on for 2 seconds when the button is pressed to show that it's working | ||
+ | output: | ||
+ | - platform: gpio | ||
+ | pin: | ||
+ | number: GPIO13 | ||
+ | inverted: True | ||
+ | id: output_wifi_led | ||
+ | light: | ||
+ | - platform: binary | ||
+ | id: wifi_led | ||
+ | output: output_wifi_led | ||
+ | binary_sensor: | ||
+ | - platform: gpio | ||
+ | pin: GPIO00 | ||
+ | id: pairing_button | ||
+ | on_press: | ||
+ | then: | ||
+ | - light.turn_on: | ||
+ | - delay: 2s | ||
+ | - light.turn_off: | ||
+ | </ |