ale1800 / ESP-360-REMOTE

An all-in-one remote based on the ESP32-WROOM-32E
110 stars 10 forks source link

RF Events not triggering #2

Closed gid204 closed 1 year ago

gid204 commented 1 year ago

Before I buy one of these awesome products I decided to slap a DIY version together to confirm I can get my devices working as required before spending the money (I have most parts readily available).

I am not able to receive any RF codes using the home assistant event developer tool. Just wanted to check I am not doing anything wrong.

substitutions:
  name: "esp-remote"
  room: "Lounge"
  friendly_name: "ESP Remote"
  project_name: "kaneo.esp_remote"
  project_version: "0.0.1"

esphome:
  name: "${name}"
  name_add_mac_suffix: false
  friendly_name: "${friendly_name}"
  project:
    name: "${project_name}"
    version: "${project_version}"

esp32:
  board: esp32dev

logger:

api:

  services:
    - service: send_rf_raw
      variables:
        protocol_number: int
        raw_data: string
      then:
        - remote_transmitter.transmit_rc_switch_raw:
            transmitter_id: RF_TX
            protocol: !lambda 'return  esphome::remote_base::RC_SWITCH_PROTOCOLS[protocol_number];'
            code: !lambda 'return raw_data;'

ota:

web_server:

ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0
  power_pin: GPIO12
  domain: ".lan"

remote_receiver:
  - id: RF_RX
    pin: 
      number: GPIO5
      inverted: True
    dump: 
      - rc_switch
    tolerance: 35%
    filter: 200us
    idle: 4ms
    buffer_size: 10kb
    on_rc_switch:
      - homeassistant.event:
          event: esphome.rf_code_received
          data:
            protocol: !lambda 'return x.protocol;'
            code: !lambda 'return x.code;'

#Setting up IR and RF transmitters
remote_transmitter:
  - id: RF_TX
    pin: GPIO14
    carrier_duty_percent: 100%

Everything is connected up as per the config above. I then go the developer tool events section and listen for esphome.rf_code_received: image

I point my blinds RF (433MHz) remote and click some buttons but nothing pops up.

Obviously can't attest for the quality but these are the receivers/transmitters I bought and am using: https://www.aliexpress.com/item/32735811163.html?spm=a2g0o.new_account_index.0.0.286725b9MZf6XG

I am using the Climax ESP32 POE board: https://www.olimex.com/Products/IoT/ESP32/ESP32-POE/open-source-hardware

Thanks in advance!!

ale1800 commented 1 year ago

Hello! Everything seems fine to me. There could be some things to modify, like tolerance, filter and idle.

One thing to try is to dump everything instead just rc_switch. Do that and let me know👍

Could you also share the model of the remote?

gid204 commented 1 year ago

Thanks for the tip - after setting dump to 'all' I can now seem my codes coming through, they appear to be in 'pronto' format. My new yaml (I changed to wifi just for an easier setup while debugging):

substitutions:
  name: "esp-remote"
  room: "Lounge"
  friendly_name: "ESP Remote"
  project_name: "kaneo.esp_remote"
  project_version: "0.0.1"

esphome:
  name: "${name}"
  name_add_mac_suffix: false
  friendly_name: "${friendly_name}"
  project:
    name: "${project_name}"
    version: "${project_version}"

esp32:
  board: esp32dev

logger:

api:

  services:
    - service: send_rf_raw
      variables:
        # protocol_number: int
        raw_data: string
      then:
        - remote_transmitter.transmit_rc_switch_raw:
            transmitter_id: RF_TX
            # protocol: !lambda 'return  esphome::remote_base::RC_SWITCH_PROTOCOLS[protocol_number];'
            code: !lambda 'return raw_data;'

ota:

web_server:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  domain: ".lan"
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "ESP-Remote Fallback Hotspot"
    password: "K2I4dMrvo3RA"

captive_portal:

# ethernet:
#   type: LAN8720
#   mdc_pin: GPIO23
#   mdio_pin: GPIO18
#   clk_mode: GPIO17_OUT
#   phy_addr: 0
#   power_pin: GPIO12
#   domain: ".lan"

remote_receiver:
  - id: RF_RX
    pin: 
      number: GPIO5
      inverted: True
    dump:
      - pronto
    tolerance: 35%
    filter: 200us
    idle: 4ms
    buffer_size: 10kb
    on_pronto:
      - homeassistant.event:
          event: esphome.rf_code_received
          data:
            # protocol: !lambda 'return x.pronto_protocol;'
            code: !lambda 'return x.data;'

#Setting up IR and RF transmitters
remote_transmitter:
  - id: RF_TX
    pin: GPIO14
    carrier_duty_percent: 100%

It looks like pronto struct doesn't have a 'protocol' data field as rc_switch does. It only expects a string. However, there is a separate pronto_protocol class, but I'm not too sure if this is needed to be implemented in anyway?

So I am now receiving my codes:

image

But when I try send this data using the transmitter nothing happens:

image

I have confirmed that all formatting from the raw code is removed.

I am quite knew to the rf_transmitter/receiver components (if that wasn't already obvious) so once again you're help is really appreciated!

ale1800 commented 1 year ago

Great, so some progress. Once you receive the pronto data, you should be able to transmit it with this action remote_transmitter.transmit_pronto So add this service and try to transmit with it.

    - service: send_rf_pronto
      variables:
        pronto_data: string
      then:
        - remote_transmitter.transmit_pronto:
            transmitter_id: RF_TX
            data: !lambda 'return pronto_data;'
ale1800 commented 1 year ago

@gid204 Sorry, i mistakenly deleted your comment. This was the link

Quite sure, that thread applies also to RF. So you can try what they say there. Also press a lot of times the button on the original remote and try to emulate the one that appears more often.

And are you sure the receiver only recognizes pronto protocol? Maybe you can use some other protocols which are easier to use

If you can give me the model of your remote, I can search online too