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

Fix: Update MQTT client for ESP-IDF compatibility #243

Merged
merged 8 commits into from
Dec 28, 2024

Conversation

omerfaruk-aran
Copy link
Owner

@omerfaruk-aran omerfaruk-aran commented Dec 28, 2024

πŸ“„ Description

What does this Pull Request do?

  • 🐞 Bug Fix
  • ✨ New Feature
  • πŸ”¨ Code Improvement
  • πŸ“š Documentation Update

This PR resolves the compatibility issues with the debug_mqtt.cpp file when using ESP-IDF framework in ESPHome 2024.12.x. The changes include updates to the esp_mqtt_client_config_t structure to align with the updated ESP-IDF framework API.

✨ Key Changes

  1. Replaced deprecated mqtt_cfg.host, mqtt_cfg.port, mqtt_cfg.username, and mqtt_cfg.password members with the updated configuration structure.
  2. Updated debug_mqtt_connect function to reflect the new API changes.
  3. Ensured backward compatibility for Arduino framework.

πŸ”— Related Issues

Fixes: #242
Fixes: #241


βœ… Checklist

Please ensure the following before submitting your PR:

  • Code compiles without errors πŸ§‘β€πŸ’»
  • All tests pass successfully βœ…
  • Changes have been tested on relevant devices πŸ› οΈ
  • Documentation has been updated (if necessary) πŸ“–
  • This PR is ready for review πŸ”

🌐 Environment Information

πŸ”’ Versions

  • ESPHome Version: 2024.12.2
  • Home Assistant Version: 2024.12.5

🧩 Devices

  • Air Conditioner Type:
    • NASA
    • NON-NASA
    • Other
  • Air Conditioner Model:
  • Outdoor Unit Model:
  • ESP Device Model: M5STACK ATOM Lite + M5STACK RS-485
  • Wiring Configuration: F1/F2

πŸ§ͺ Test Plan

How were these changes tested?

  1. Tested with an ESP32 device using ESP-IDF framework.
  2. Verified MQTT connectivity to broker with credentials and port settings.
  3. Ensured backward compatibility with Arduino framework.

πŸ” Logs

  • Logs from ESPHome with ESP-IDF:
[INFO] Successfully connected to MQTT broker [DEBUG] Publishing to topic: samsung_ac/nasa
  • Logs from ESPHome with Arduino framework:
[INFO] Successfully connected to MQTT broker [DEBUG] Publishing to topic: samsung_ac/nasa

πŸ› οΈ YAML Configuration

external_components:
  - source: github://omerfaruk-aran/esphome_samsung_hvac_bus@fix/mqtt-espidf-compatibility
    components: [samsung_ac]

samsung_ac:

  # Sends all NASA package values to MQTT so the can be analysed or monitored.
  debug_mqtt_host: 192.168.1.100
  debug_mqtt_port: 1883
  debug_mqtt_username: mqtt_user
  debug_mqtt_password: mqtt_pass

    ...

@omerfaruk-aran omerfaruk-aran added the bug Something isn't working label Dec 28, 2024
@omerfaruk-aran omerfaruk-aran self-assigned this Dec 28, 2024
@omerfaruk-aran omerfaruk-aran merged commit 95783dc into main Dec 28, 2024
2 checks passed
@omerfaruk-aran omerfaruk-aran deleted the fix/mqtt-espidf-compatibility branch December 28, 2024 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug [Samsung_HVAC]: Does not compile with ESPHome 2024.12.x And esp-idf framework
1 participant