Git Product home page Git Product logo

mo2000_esphome_issues's People

Watchers

 avatar

mo2000_esphome_issues's Issues

Error in new wifi_now::WifiNowTemplatePayloadGetter

I set up 2 devices, device a and device b, using the file wifii_now.for_custom_components_alpha.zip from https://github.com/motwok/esphome/releases/tag/0.0.1.0 and extracted it into custom_components folder. Device b does not compile for some reason. Here are the configs:

Device a:

binary_sensor:
  - platform: gpio
    pin: 
      number: ${button_pin}
      inverted: true
    name: "${device_name_full} Button"

  - platform: template
    id: sensor_a
    name: "sensor_a_payload"
    # lambda: |-

wifi_now:
  channel: 2
  # password: "<master password>"
  peers:
    - id: device_b
      bssid: ${client_b_bssid}
      # password: "<communication A between B password>"
  on_receive:
    - service: "Boolean Sensor A"
      payloads:
        - bool: sensor_a_payload
      then:
        - binary_sensor.template.publish:
            id: sensor_a
            state: !lambda 'return id(sensor_a_payload)->get_value();'

and device b:

wifi_now:
  channel: 2
  # password: "<master password>"
  peers:
    - id: device_a
      bssid: ${device_a_bssid}
      # password: "<communication A between B password>"

sensor:
  - platform: uptime
    name: Uptime Sensor

binary_sensor:
  - platform: gpio
    pin: 
      number: ${button_pin}
      inverted: true
    name: "${device_name_full} Button"
    filters:
      - delayed_on: 10ms
      - delayed_off: 10ms
    on_state:
      then:
      - wifi_now.send:
          peerid: device_a
          service: "Boolean Sensor A"
          payloads:
          - bool: !lambda return x

and the error I get is:

Compiling .pioenvs/espnow_b_client_test/libd67/ESPAsyncTCP-esphome/ESPAsyncTCPbuffer.cpp.o
Compiling .pioenvs/espnow_b_client_test/libd67/ESPAsyncTCP-esphome/SyncClient.cpp.o
src/main.cpp: In function 'void setup()':
src/main.cpp:199:100: error: expected primary-expression before 'bool'
   wifi_now_wifinowtemplatepayloadgetter = new wifi_now::WifiNowTemplatePayloadGetter<bool, bool>({{bool, "x"}});
                                                                                                    ^
src/main.cpp:199:100: error: expected '}' before 'bool'
src/main.cpp:199:100: error: expected '}' before 'bool'
src/main.cpp:199:100: error: expected ')' before 'bool'
src/main.cpp:199:109: error: expected ')' before '}' token
   wifi_now_wifinowtemplatepayloadgetter = new wifi_now::WifiNowTemplatePayloadGetter<bool, bool>({{bool, "x"}});
                                                                                                             ^
src/main.cpp:199:109: error: expected ';' before '}' token
src/main.cpp: At global scope:
src/main.cpp:199:110: error: expected declaration before '}' token
   wifi_now_wifinowtemplatepayloadgetter = new wifi_now::WifiNowTemplatePayloadGetter<bool, bool>({{bool, "x"}});
                                                                                                              ^
Compiling .pioenvs/espnow_b_client_test/libd67/ESPAsyncTCP-esphome/tcp_axtls.c.o
Compiling .pioenvs/espnow_b_client_test/lib4ed/ESP8266mDNS/ESP8266mDNS.cpp.o
Compiling .pioenvs/espnow_b_client_test/lib4ed/ESP8266mDNS/ESP8266mDNS_Legacy.cpp.o
In file included from src/esphome.h:33:0,
                 from src/main.cpp:3:
src/esphome/components/wifi_now/send_action.h: In instantiation of 'void esphome::wifi_now::WifiNowSendAction<Ts>::play_complex(Ts ...) [with Ts = {bool}]':
src/main.cpp:199:110:   required from here
src/esphome/components/wifi_now/send_action.h:43:14: error: no matching function for call to 'esphome::wifi_now::WifiNowSendAction<bool>::send(bool&)'
     send(x...);
              ^
src/esphome/components/wifi_now/send_action.h:43:14: note: candidate is:
src/esphome/components/wifi_now/send_action.h:85:8: note: void esphome::wifi_now::WifiNowSendAction<Ts>::send() [with Ts = {bool}]
   void send() {
        ^
src/esphome/components/wifi_now/send_action.h:85:8: note:   candidate expects 0 arguments, 1 provided
src/esphome/components/wifi_now/send_action.h: In instantiation of 'void esphome::wifi_now::WifiNowSendAction<Ts>::send() [with Ts = {bool}]':
src/esphome/components/wifi_now/send_action.h:43:14:   required from 'void esphome::wifi_now::WifiNowSendAction<Ts>::play_complex(Ts ...) [with Ts = {bool}]'
src/main.cpp:199:110:   required from here
src/esphome/components/wifi_now/send_action.h:89:109: error: no matching function for call to 'esphome::wifi_now::WifiNowSendAction<bool>::get_payload()'
     WifiNowPacket packet(this->peer_ ? this->peer_->get_bssid() : bssid_t{}, this->servicekey_, get_payload());
                                                                                                             ^
src/esphome/components/wifi_now/send_action.h:89:109: note: candidate is:
src/esphome/components/wifi_now/send_action.h:26:27: note: const payload_t esphome::wifi_now::WifiNowSendAction<Ts>::get_payload(Ts ...) [with Ts = {bool}; esphome::wifi_now::payload_t = std::vector<unsigned char>]
   virtual const payload_t get_payload(Ts... x) {
                           ^
src/esphome/components/wifi_now/send_action.h:26:27: note:   candidate expects 1 argument, 0 provided
In file included from src/esphome/core/component.h:4:0,
                 from src/esphome/components/api/api_connection.h:3,
                 from src/esphome.h:2,
                 from src/main.cpp:3:
/home/my_home/.platformio/packages/[email protected]/xtensa-lx106-elf/include/c++/4.8.2/functional: In substitution of 'template<class _Res, class ... _ArgTypes> template<class _Functor> using _Invoke = decltype (std::__callable_functor(declval<_Functor&>())((declval<_ArgTypes>)()...)) [with _Functor = esphome::wifi_now::WifiNowSendAction<Ts>::send() [with Ts = {bool}]::__lambda17; _Res = void; _ArgTypes = {bool}]':
/home/my_home/.platformio/packages/[email protected]/xtensa-lx106-elf/include/c++/4.8.2/functional:2250:9:   required from 'void esphome::wifi_now::WifiNowSendAction<Ts>::send() [with Ts = {bool}]'
src/esphome/components/wifi_now/send_action.h:43:14:   required from 'void esphome::wifi_now::WifiNowSendAction<Ts>::play_complex(Ts ...) [with Ts = {bool}]'
src/main.cpp:199:110:   required from here
/home/my_home/.platformio/packages/[email protected]/xtensa-lx106-elf/include/c++/4.8.2/functional:2181:71: error: use of 'esphome::wifi_now::WifiNowSendAction<Ts>::send() [with Ts = {bool}]::__lambda17' before deduction of 'auto'
  using _Invoke = decltype(__callable_functor(std::declval<_Functor&>())
                                                                       ^
/home/my_home/.platformio/packages/[email protected]/xtensa-lx106-elf/include/c++/4.8.2/functional:2250: confused by earlier errors, bailing out
*** [.pioenvs/espnow_b_client_test/src/main.cpp.o] Error 1
=========================================================== [FAILED] Took 5.15 seconds ===========================================================

Also please note I got this example code from https://github.com/motwok/esphome-docs/blob/wifi_now_component/components/wifi_now.rst but I needed to change - boolean_sensor.template.publish: to - binary_sensor.template.publish:

Default access point if WiFi is not configured

I am experimenting with WIFI_Now and made this setup:

  • an ESP32 board with ethernet, running ESPHome with WIFI_Now (as gateway)
  • two ESP8266 relay boards running ESPHome with WIFI_Now (as remote switches)

On ESP8266 (intentionally) no WiFi is configured because the relays are toggled via WIFI_Now, but there is a default access point always provided by them which can not be turned off (ssid ESP_xxxxxx, no password). If I configure a secure AP in ESPHome, then it replaces the default one, though mandatory WiFi connection/AP kind of defeats the purpose of WIFI_Now.

Thinking one step further, wouldn't it be great to have a "wifi_now switch" that can toggle an access point on ESP8266s? Then devices would communicate only via WIFI_Now (no WiFi connection nor AP) and when necessary, the AP could be turned on remotely, for example to do an OTA update.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.