Open openshwprojects opened 1 year ago
Why a non cross-platform batch file?
I use a simple nodejs script, but I'm sure it's easy enough to just whip one up in your preferred scripting language. As a bonus it runs in parallel which is useful if there's 30 lights to update...
The script I use is below.... could dump it somwhere if you'd find it useful.
#!/usr/bin/env -S node --no-warnings --loader ts-node/esm
export {}
const runCommand = async (host: string, cmd : string) => {
await fetch(`http://${host}/cmd_tool?cmd=${encodeURIComponent(cmd)}`);
}
const hosts = ['192.168.4.1', '192.168.4.2'];
const commands = [ 'SetPinRole 6 PWM', 'SetPinRole 4 PWM'];
const hostTasks = hosts.map(async host =>{
for (const command of commands) {
await runCommand(host, command);
}
});
console.log(await Promise.allSettled(hostTasks));
I really wanted to use something that is available on most of the average user PCs. Well, except that CURL...
I may update the script and add versions in other languages.
Here's a little thingy that can send commands over HTTP to devices that are already on your network: https://github.com/openshwprojects/TasmotaHTTPCurlConfigurator
Writeup: https://www.elektroda.com/rtvforum/topic3963037.html
What do you guys think? Any pull requests are welcome.