Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 Pull Request: Packet Acknowledgment & Retry Mechanism #206

Merged
merged 11 commits into from
Oct 28, 2024
Merged

🚀 Pull Request: Packet Acknowledgment & Retry Mechanism #206

merged 11 commits into from
Oct 28, 2024

Conversation

omerfaruk-aran
Copy link
Owner

📄 Description

This Pull Request introduces an essential enhancement for handling packet acknowledgments and implementing a retry mechanism to ensure robust communication between Samsung HVAC systems and ESPHome. This improvement directly addresses the issues described in #57, where unacknowledged packets could lead to communication failures and degraded system performance.

✨ Key Changes

  • 🟢 Packet Acknowledgment Tracking: Added functionality to track packets by their unique identifiers and check for acknowledgment (Ack) messages.
  • 🔁 Retry Mechanism: Introduced a retry logic to resend unacknowledged packets up to 3 times, improving reliability.
  • 📝 Logging Improvements: Added detailed log messages to trace packet retries, Ack confirmations, and unacknowledged packet situations.

🔗 Related Issues


Checklist

  • Code compiles without errors 🧑‍💻
  • All tests pass successfully ✅
  • Changes tested on relevant devices 🛠️
  • Documentation updated 📖

🧪 Test Plan

How were these changes tested?

  1. Tested on M5Stack ATOM Lite using different HVAC unit configurations to verify packet acknowledgment detection.
  2. Monitored logs to ensure accurate identification of unacknowledged packets and successful retries.
  3. Validated communication stability over a prolonged period under typical usage scenarios.

🔍 Logs

Example Log Output:

[05:14:25][W][samsung_ac:474]: publish packet #Packet Src:80.ff.00 Dst:20.00.00 {PacketInformation: 1;ProtocolVersion: 2;RetryCount: 0;PacketType: 1;DataType: 3;PacketNumber: 30}
 > Variable 4201 = 300
[05:14:25][W][samsung_ac:091]: write 32001280ff00200000c0131e014201012c5e3f34
[05:14:27][W][samsung_ac:091]: write 32001280ff00200000c0131e014201012c5e3f34
[05:14:27][W][samsung_ac:881]: Resending packet 30 number of attempts: 1
[05:14:27][W][samsung_ac:822]: found Ack for packet number 30
[05:14:27][W][samsung_ac:834]: Ack #Packet Src:20.00.00 Dst:80.ff.00 {PacketInformation: 1;ProtocolVersion: 2;RetryCount: 0;PacketType: 1;DataType: 6;PacketNumber: 30}
 sent_packets size: 0

@Code394
Copy link

Code394 commented Nov 1, 2024

@omerfaruk-aran
My adapter is on the way, so I have no way to check.
Does it also handle sending commands to multiple air conditioners at the same time?

@omerfaruk-aran
Copy link
Owner Author

@htht2001 Yes, you can send commands to more than one air conditioner at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[NASA] Commands not being executed
2 participants