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

Similar commands for Curl and MQTT #65

Open
HeinvdW opened this issue Oct 10, 2024 · 2 comments
Open

Similar commands for Curl and MQTT #65

HeinvdW opened this issue Oct 10, 2024 · 2 comments

Comments

@HeinvdW
Copy link

HeinvdW commented Oct 10, 2024

The commands in the MQTT API and the PEST API are not similar
void mqtt_receive_callback(const String topic, const String payload) { if (topic == MQTTprefix + "/Set/Mode") { if (payload == "Off") { ToModemWaitStateTimer = 0; ToModemDoneStateTimer = 0; LeaveModemDoneStateTimer = 0; setAccess(0); } else if (payload == "Normal") { setMode(MODE_NORMAL); } else if (payload == "Solar") { OverrideCurrent = 0; setMode(MODE_SOLAR); } else if (payload == "Smart") { OverrideCurrent = 0; setMode(MODE_SMART); }
For mode setting Curl expects 0, 1, 2 or 3 and MQTT expects Off, Normal, Solar or Smart
I suggest to add some code like shown hereafter.
void mqtt_receive_callback(const String topic, const String payload) { if (topic == MQTTprefix + "/Set/Mode") { if (payload == "Off" | payload == 0) { ToModemWaitStateTimer = 0; ToModemDoneStateTimer = 0; LeaveModemDoneStateTimer = 0; setAccess(0); } else if (payload == "Normal" | payload == 1) { setMode(MODE_NORMAL); } else if (payload == "Solar" | payload == 2) { OverrideCurrent = 0; setMode(MODE_SOLAR); } else if (payload == "Smart" | payload == 3) { OverrideCurrent = 0; setMode(MODE_SMART); }
In the documentation just 0, 1, 2 and 3 are described.

Same goes for ip-of-evse/settings - override_current
Curl command - override_current
MQTT command - CurrentOverride
mosquitto_sub returns - ChargeCurrentOverride
By adding some ' | ' here and there the naming could get more consistent and can be reflected like that in the docs without having to change the code heavily.

@HeinvdW
Copy link
Author

HeinvdW commented Nov 27, 2024

?

@dingo35
Copy link
Collaborator

dingo35 commented Nov 27, 2024

Very legit topic; it is the result of evolutionary development and the wish to stay backwards compatible.

We are currently spending our developers capacity at expanding the functionality of the SmartEVSE (e.g. v4 with SoC communication from the EV), keeping "nice-to-haves" at low priority to prevent diverting forks.

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

No branches or pull requests

2 participants