I got it working using HomeyScript and Gemini. The reason I wanted to use this is because the wallbox app will be way more precise in changing the amps for how much solar is not being used. So now I can manually charge my car to a set percentage, and then let it continue on the solar charing for wallbox until it reaches 100%. So my car is always ready for use, but it’s a battery (sort of) for the excess solar power. And also have a lot of different overrides so I have better control over when it charges to what percentage.
That’s great that you got it working!
Feel free to share your version of the script. Might be usefull to others. (don’t forget to remove your ID/password if you didn’t adapt that part : ChatGPT always advises me not to hardcode them in the script, but I’m stubborn
)
Good idea! This is what works for me!
The ‘action=9’ is the command the API uses to put the wallbox app to resume the schedule and solar charging. It’s possible to give it either when the wallbox is charging, or stopped charging. What I did to make it work for my usecase is to delete all the schedules so I can manually start charging until I reach for example 60% SoC of the car. After that, the ‘command=9’ is given and the charge limit for my car is set to 100% to allow it to charge with as much sun as possible.
// — User Configuration —
const email = “YOUR_EMAIL_HERE”;
const password = “YOUR_PASSWORD_HERE”;
const chargerId = “YOUR_CHARGER_ID_HERE”;const baseUrl = “https://api.wall-box.com/”;
// — 1. Authenticate and get the Bearer Token —
// Wallbox requires Basic Auth (base64 encoded email:password) to grant a temporary token.
const authString = Buffer.from(email + “:” + password).toString(“base64”);console.log(“Authenticating with Wallbox…”);
const authResponse = await fetch(baseUrl + “auth/token/user”, {
method: “POST”,
headers: {
“Authorization”: "Basic " + authString,
“Content-Type”: “application/json”,
“Accept”: “application/json”
}
});if (!authResponse.ok) {
throw new Error("Authentication failed. Check your email/password. Status: " + authResponse.status);
}const authData = await authResponse.json();
const token = authData.jwt;
console.log(“Authentication successful.”);// — 2. Send action=9 (Resume Schedule / Eco-Smart) —
console.log("Sending action=9 to Charger ID: " + chargerId);
const actionResponse = await fetch(baseUrl + “v3/chargers/” + chargerId + “/remote-action”, {
method: “POST”,
headers: {
“Authorization”: "Bearer " + token,
“Content-Type”: “application/json”,
“Accept”: “application/json”
},
body: JSON.stringify({ action: 9 })
});if (!actionResponse.ok) {
throw new Error("Failed to send command to charger. Status: " + actionResponse.status);
}console.log(“Successfully sent Resume command! Charger is now back in Eco-Smart/Scheduled mode.”);
// Return true so the Homey Flow card knows the script executed successfully
return true;
Thanks for sharing!
Strange to see that your script is almost completely different then mine, which is also made with AI (mostly ChatGPT and Claude).
You only implemented the ecosmart function? You continue using the app for charging, stopping, setting amps I guess?
Yes, the rest just works from the app, so no need to reinvent for now.