u-fire / ESPHomeComponents

Components for Microfire sensors that can be used in ESPHome and Home Assistant.
8 stars 7 forks source link

Does it handle esp_now acknowledgement/retries ? #5

Open jerome83136 opened 1 month ago

jerome83136 commented 1 month ago

Hello, Thank you for this really easy to use implementation of esp_now with ESPHome :)

I'm wondering how the "on_sent" part works here ?

now_mqtt:
  on_sent:
    then:
      - lambda: id(sent)++; 
      - if:
          condition:
            lambda: 'return id(sent) == 4;'
          then:
            - lambda: id(sent) = 0;
            - deep_sleep.enter:
                id: sleep_
                sleep_duration: 5min

I understand the "sent" counter is incremented each time we "send" a message for a sensor. Do we consider a message is "sent" when:

As it seems this implementation is using esp_now in "broadcasting" mode (not in "pairing" mode) I guess the correct answer is my 1st proposal. Am I right ?

NB: my use case is to use esp_now to send data from sensors to a hub with support of esp_now messages "acknowledgement", in order to prevent deep_sleep if messages weren't successfully sent and "retry" them.

Thank you for your feedback :)

Best regards