jesserockz / wizmote-esphome

Apache License 2.0
66 stars 30 forks source link

Can't compile for m5stack atom lite bt proxy #13

Open dixonbg opened 1 year ago

dixonbg commented 1 year ago

Hi there,

I've recently bought a Wizmote, thinking I can link it with the Wiz integration. Now that I know it broadcast some ESPNOW packets, I thought that my tiny Bluetooth proxy can capture these too. Unfortunately, my understanding of ESPHome is not enough to resolve the errors during compilation:

Compiling /data/atom-bluetooth-proxy-9fac9c/.pioenvs/atom-bluetooth-proxy-9fac9c/src/main.o
Linking /data/atom-bluetooth-proxy-9fac9c/.pioenvs/atom-bluetooth-proxy-9fac9c/firmware.elf
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/atom-bluetooth-proxy-9fac9c/.pioenvs/atom-bluetooth-proxy-9fac9c/src/main.o:(.literal._Z5setupv+0xc4): undefined reference to `vtable for esphome::wizmote::WizMoteListener'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/atom-bluetooth-proxy-9fac9c/.pioenvs/atom-bluetooth-proxy-9fac9c/src/main.o:(.literal._Z5setupv+0x188): undefined reference to `esphome::esp_now::ESPNowComponent::ESPNowComponent()'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /data/atom-bluetooth-proxy-9fac9c/.pioenvs/atom-bluetooth-proxy-9fac9c/src/main.o: in function `setup()':
/config/esphome/.esphome/build/atom-bluetooth-proxy-9fac9c/src/main.cpp:218: undefined reference to `esphome::esp_now::ESPNowComponent::ESPNowComponent()'
collect2: error: ld returned 1 exit status
*** [/data/atom-bluetooth-proxy-9fac9c/.pioenvs/atom-bluetooth-proxy-9fac9c/firmware.elf] Error 1
========================= [FAILED] Took 23.35 seconds =========================

I've just pasted the yaml at the end... but it doesn't work

substitutions:
  name: atom-bluetooth-proxy-9fac9c
  friendly_name: Bluetooth Proxy 9fac9c
packages:
  esphome.bluetooth-proxy: github://esphome/bluetooth-proxies/m5stack-atom-lite.yaml@main
esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}
api:
  encryption:
    key: =
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
external_components:
  - source: github://jesserockz/wizmote-esphome
    components:
      - esp_now
      - wizmote
esp_now:
wizmote:
  on_button:
    if:
      condition:
        lambda: return data.button >= 16 && data.button <= 19;
      then:
        - homeassistant.event:
            event: esphome.wizmote_choose
            data:
              mac: !lambda 'return format_hex(data.bssid, 6);'
              button: !lambda 'return data.button - 15;'
              sequence: !lambda 'return data.sequence;'
      else:
        - homeassistant.event:
            event: esphome.wizmote_action
            data:
              mac: !lambda 'return format_hex(data.bssid, 6);'
              button: !lambda 'return data.button;'
              sequence: !lambda 'return data.sequence;'

Thank you for your efforts

roynasser commented 9 months ago

I'm getting a similar error, did you ever get this resolved?

/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/nspanel1/src/main.o:(.literal._Z5setupv+0xa40): undefined reference to `vtable for esphome::wizmote::WizMoteListener'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/nspanel1/src/main.o:(.literal._Z5setupv+0x1db4): undefined reference to `esphome::esp_now::ESPNowComponent::ESPNowComponent()'
/data/cache/platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: .pioenvs/nspanel1/src/main.o: in function `setup()':
/data/build/nspanel1/<unicode string>:4352: undefined reference to `esphome::esp_now::ESPNowComponent::ESPNowComponent()'
collect2: error: ld returned 1 exit status
*** [.pioenvs/nspanel1/firmware.elf] Error 1

This is my yaml. Just added the Yaml to the end, and it doesnt like something...

substitutions:
  # Settings - Editable values
  device_name: "nspanel1" 
  wifi_ssid: !secret wifi_ssid
  wifi_password: !secret wifi_password
  nextion_update_url: "http://192.168.1.234:8123/local/nspanel_us.tft"  # Optional for `esp-idf` framework
  # Add-on configuration (if needed)
  # heater_relay: "1"  # Possible values: "1" or "2"

# Customization area
##### My customization - Start #####

# Enable Home Assistant API
api:
  encryption:
    key: "XXXXXXXXXXXXX+NCloKpU="

##### My customization - End #####

# Core and optional configurations
packages:
  remote_package:
    url: https://github.com/Blackymas/NSPanel_HA_Blueprint
    ref: main
    files:
      - nspanel_esphome.yaml # Core package
      # Optional advanced and add-on configurations
      # - advanced/esphome/nspanel_esphome_advanced.yaml
      # - nspanel_esphome_addon_climate_cool.yaml
      # - nspanel_esphome_addon_climate_heat.yaml
      # - nspanel_esphome_addon_climate_dual.yaml
    refresh: 300s

esp32:
  framework:
    type: esp-idf

external_components:
  - source: github://jesserockz/wizmote-esphome
    components:
      - esp_now
      - wizmote

esp_now:

wizmote:
  on_button:
    if:
      condition:
        lambda: return data.button >= 16 && data.button <= 19;
      then:
        - homeassistant.event:
            event: esphome.wizmote_choose
            data:
              mac: !lambda 'return format_hex(data.bssid, 6);'
              button: !lambda 'return data.button - 15;'
              sequence: !lambda 'return data.sequence;'
      else:
        - homeassistant.event:
            event: esphome.wizmote_action
            data:
              mac: !lambda 'return format_hex(data.bssid, 6);'
              button: !lambda 'return data.button;'
              sequence: !lambda 'return data.sequence;'
dixonbg commented 9 months ago

Hi, Unfortunately, no. This post here was my last attempt to find a solution. I think esp_now should be standard component to esphome and tested with each release. There will be a lot products using this tech...

roynasser commented 9 months ago

Hi @dixonbg I've been able to get it to compile finally... What did it for me was to go into ESPHome menu for the device and select "Cleanup build files". I think it was caching stuff and not finding the espnow module... I hope this solves your issue too!

zacpod commented 9 months ago

~~Trying to install this on a RasPi2040 and breaking in a similar way, I think. Getting "src\esphome\components\esp_now\esp_now_component.cpp:92:43: error: 'bssid' was not declared in this scope" errors.~~

NVM - ESPNow is an ESP32 only protocol. Won't work on a PicoW. Guess I need to order an ESP32 board.