Hi Peter / @IndaloTech,
I am currently working on the ramses_cc Home Assistant integration (specifically ramses-rf/ramses_cc#483), adding native support for Home Assistant's MQTT service as a transport layer.
During the code review of the ramses_esp MQTT implementation (specifically in ramses-mqtt.c), we identified an interoperability hurdle that affects how standard libraries like ramses_rf interact with the firmware via MQTT.
The Observation
In components/ramses-mqtt/ramses-mqtt.c, the mqtt_publish_cmd_result function formats the JSON payload using an integer for the return code:
// Current implementation
sprintf( data, "{ \"cmd\":\"%s\", \"err\":\"%s\", \"return\":%d} ",cmd, esp_err_to_name(err),retVal );
This results in a payload like: {"cmd": "!V", "return": 0}.
The Issue
Most RAMSES client libraries (including ramses_rf) are designed to interact with a serial port, where they expect the response to a command (like !V) to be a specific string (e.g., # evofw3 0.7.1).
When ramses_esp returns an integer 0 via MQTT:
- Type Mismatch: Clients expecting a string response may crash or fail to parse the integer.
- Handshake Failure: The
!V command is critical for identifying the gateway. If the client receives 0 instead of a string containing # evofw3..., it assumes the gateway is invalid and aborts the connection.
Suggestion
To improve compatibility with the broader ecosystem, would you consider updating the MQTT response to include the actual console output or version string in the JSON payload?
For example, returning the string value would allow the MQTT transport to act as a transparent bridge for existing libraries:
JSON
{
"cmd": "!V",
"return": "# evofw3 0.7.1"
}
We have implemented a workaround in the ramses_cc client side for now (synthesizing a fake handshake when we see return: 0), but a fix at the firmware level would make ramses_esp plug-and-play compatible with more Home Assistant integrations out of the box.
Thanks
Phil / @PWhite-Eng
Hi Peter / @IndaloTech,
I am currently working on the ramses_cc Home Assistant integration (specifically ramses-rf/ramses_cc#483), adding native support for Home Assistant's MQTT service as a transport layer.
During the code review of the
ramses_espMQTT implementation (specifically inramses-mqtt.c), we identified an interoperability hurdle that affects how standard libraries likeramses_rfinteract with the firmware via MQTT.The Observation
In
components/ramses-mqtt/ramses-mqtt.c, themqtt_publish_cmd_resultfunction formats the JSON payload using an integer for the return code:This results in a payload like:
{"cmd": "!V", "return": 0}.The Issue
Most RAMSES client libraries (including
ramses_rf) are designed to interact with a serial port, where they expect the response to a command (like!V) to be a specific string (e.g.,# evofw3 0.7.1).When
ramses_espreturns an integer0via MQTT:!Vcommand is critical for identifying the gateway. If the client receives0instead of a string containing# evofw3..., it assumes the gateway is invalid and aborts the connection.Suggestion
To improve compatibility with the broader ecosystem, would you consider updating the MQTT response to include the actual console output or version string in the JSON payload?
For example, returning the string value would allow the MQTT transport to act as a transparent bridge for existing libraries:
JSON
We have implemented a workaround in the
ramses_ccclient side for now (synthesizing a fake handshake when we seereturn: 0), but a fix at the firmware level would makeramses_espplug-and-play compatible with more Home Assistant integrations out of the box.Thanks
Phil / @PWhite-Eng