Hi thank you for sharing! I am trying to set it up aswell.
I have now a switch that i can use to turn it on. But it goes back to off after a few seconds.
So i can’t use it to turn off the ps4.
This command should get the state if i understand well.
When i run this command on the pi it wil return true if ps4 is on. But when i run it in the virtual environment (where i installed hass) i get a message: permission denied and it will return false.
Yep. My system is RPI 2 with Raspbian jessie and hass installed using the all in one installer. But when i do that with the sudo in the virtual enviroment is asks for a password. But there is no password for hass user in the virtual enviroment.
I got mine to work by changing the command state to use nc instead of telnet, which in my case was much quicker at responding. The value template is not needed because nc will return 0 on success, 1 on failure.
The -z parameter tells netcat to scan for the open port, -w 5 tells netcat to timeout after 5 seconds otherwise it will wait endlessly. If testing in the command line is needed add -v for a more verbose output.
I just got the command_state to execute by changing nul to /dev/nul when i saw your post.
command_state: telnet 192.168.1.12 9295 | grep "Connected" > /dev/null && (echo "true") || (echo "false")
But i was messing arround with the value template but didn’t get it to work unfortunately.
So i did what you said and it is now working perfectly! thank you!
I installed netcat by:
I used the -c parameter to specify where the credentials are stored. Because it was originally stored at a location where from it could not be accessed from the virtual environment. So i copied it to my documents folder.
Maybe this can be some help for someone who is also trying to get this to work.
Hi,
I tried to install ps4-waker but i receive a strange error when I try to execute:
pi@raspberrypi:$ ps4-waker
/usr/local/lib/node_modules/ps4-waker/bin/cmd.js:107
var keyNames = argv._.slice(remote).map((key) => key.toUpperCase());
^
SyntaxError: Unexpected token >
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
I don’t think that is the output. If you do only echo $? the result will be zero. But when i run the command i don’t get output also.
But it works in HA. Did you test by just adding it to your config like i did?
Thank you! examples are always welcome. Your post solved this question i posted on the forums. I had never thought of changing an input select with another one. Thank you!