command run through powershell not working
i'm trying to run a simple command from here: https://github.com/nathanbabcock/nightlight-cli . i installed it as nodejs, but it seems to run through command line or powershell just fine, but when i try to input the command same as I would there, it doesnt work. i've searched around for a while and haven't been able to figure out anyway to make commands from this work. help figuring this out would be super appreciated
GitHub
GitHub - nathanbabcock/nightlight-cli: Control Windows 10/11's Nigh...
Control Windows 10/11's Night Light feature programmatically 🌓 - nathanbabcock/nightlight-cli
Solution:Jump to solution
Thread closed
Issue was with PATH, system needed to be restarted due to changes to PATH...
26 Replies
for the record regular powershell commands seems to run fine, its something with the specific setup here, probably to do with it being nodejs if i had to guess
@Amadeo
This command works without admin privileges right?
Does hass.agent produce any kind of logs after the command is executed? (With extended logging)
Yep
Let me check again in a bit but I didn't see any after I tried earlier today
You could try invoking a shell to run the command and enable the flag to keep it open, might provide info on why it is/isn't working
sorry, it's been a while, how do i do that again? 😅
actually, am i doing smth wrong here? i was trying to use mqtt to test instead of constantly storing new commands, but this test command does nothing. if i put the command in the "command or script" box instead of sending it as an mqtt payload, it works fine
powershell -Command {your command here} -NoExit
Test that in a normal PowerShell and then test it in Hass.agent
It should spawn a new window and run command, U may need to specify normal window style if it is hidden by defaultseems to just run in the same window
Someone on stack overflow used this for npm
start powershell {.\scriptInNewPSWindow.ps1}
I would try putting your command in the brackets againoh i didnt realize the brackets were part of it, my bad
so works fine in powershell but not through hass agent.-NoExit didnt seem to work here but I managed to just record and screenshot the error
does this "nighlight" work everywhere or there is specific folder?
Everywhere I've tried so far. Changing the current directory doesn't affect it, and I can just open PowerShell or command prompt and execute it the one command
low integrity is off right?
because the error you've captured basically says "I don't know what nightlight is"
Should be. I think i tried it both with and without
Powers out rn cause of a storm so I can double check when it comes back on whenever that is
worst case scenario I'll ask you to do me a step by step list of what you've configured/done with the nightlight
I might try that on a vm
ok so yeah it was with low integrity off but i did try both ways, didnt make a difference
can detail the steps for you of what i did to get the nightlight thing if you want, it's pretty simple
Yeah, this is the only way for me to check what might be the fault
sure, i downloaded nodist from here and ran the exe for v0.10.3 https://github.com/nodists/nodist
and then ran the command from the "Getting started (Cli)" section of https://github.com/nathanbabcock/nightlight-cli
npm i -g nightlight-cli
and thats literally it, then it was working in both powershell and command prompt
not like to rush or anything, i know yall have life and stuff, was just wondering if youre looking into this or if i should look to other ways to accomplish thisIt will be looked into, I will try and replicate in an hour
If we can replicate it a fix should be quick enough, at most a few days
ok, thanks, appreciate that
ok this this is a little embarassing...i messed around with it a bit more, and the same commands that werent working before are working perfectly fine now. i suspect what happened was that I probably hadn't restarted my computer since installing it, and for some reason it worked fine in command prompt and powershell, but hass agent couldnt recognize it (im not the most technical person 😅 ). At any rate, my issue does seem to be solved now..
Actually this is very likely to be the cause 😂
I'm sorry for throwing you guys for a loop lol, appreciate the help nonetheless
The way I'm 99% sure this went down is like this:
1. You installed the package
2. It added to PATH
3. The new PowerShell and CMD prompts used the new PATH
4. HASS.Agent was still on old PATH due to not restarting system
5. Therefore Hass.agent commands used the old PATH without the new tools
Solution
Thread closed
Issue was with PATH, system needed to be restarted due to changes to PATH