Skip to content

v2.13.1 - Log in from a shell prompt

Latest

Choose a tag to compare

@Rouzax Rouzax released this 22 Aug 11:06
· 1 commit to main since this release

Patch release.

Logging in now works when you start the script from a shell prompt.

-ZwaveJsCredential (Get-Credential) only works from inside a PowerShell session. Started the way most people run it on a Raspberry Pi, bash parses the command line before PowerShell ever sees it and stops on the parentheses:

$ pwsh ./Rename-Domoticz-From-ZwaveJSON.ps1 -ZwaveJsUrl "http://localhost:8091" -ZwaveJsCredential (Get-Credential) ...
bash: syntax error near unexpected token `('

Pass a username instead

pwsh ./Rename-Domoticz-From-ZwaveJSON.ps1 -ZwaveJsUrl "http://localhost:8091" \
    -DbPath "/home/user/domoticz.db" -ZwaveJsUser admin -DryRun

-ZwaveJsUser takes a plain username (admin on a default zwave-js-ui install), so it reaches PowerShell untouched. The password is prompted for, and never appears in your shell history, the process list, the log, or the HTML report.

-ZwaveJsCredential is unchanged and still takes a PSCredential, for when you already hold one, want to be prompted for the username too, or are running unattended with Import-CliXml. Supplying both is an error.

Why a new parameter rather than accepting a username on the old one

PowerShell's [Credential()] transformation attribute would have accepted a username on -ZwaveJsCredential with no new parameter. It was tried first and rejected: when it cannot prompt, it aborts during parameter binding, before the script runs, and the process exits 0. A scheduled run that renamed nothing while reporting success is the one outcome this tool's exit codes must never produce.

Prompting from the script body keeps every failure loud. -ZwaveJsUser with no console to prompt at exits 1 and points you at Import-CliXml; combining it with -ZwaveJsCredential exits 1 rather than silently preferring one.

Also in this release

  • A rejected connection names the option to reach for next. The error said "requires authentication - pass -ZwaveJsToken" whatever you had supplied, sending anyone using a credential back to the token workflow the credential exists to replace. It now distinguishes no login supplied, a token that was not accepted (usually expired), and a credential whose login succeeded but whose token was then refused.
  • Docs: a new section on running from bash, zsh or a Pi terminal, plus troubleshooting entries for each symptom this produced.
  • Internal: the version number lived in three places and had already drifted; the banner and the report footer now read one constant.

Verified against a live authenticated zwave-js-ui: -ZwaveJsUser prompts, logs in, and dry-runs to 63 renames, 0 collisions, 0 errors, matching the v2.13 result. No behaviour changes to renaming, rules, collisions, or the database.