[SOLVED] PS4-waker - Ubuntu - Bash/Sudo - Not working

Hi

Ive only just picked up on this and seen the re-opening of the post.

EDIT: I see youve solved it, but for anyone else, hope this helps

Im having to think back as to what I did, however, you have to log into the server as the Openhab user account, at the desktop. Im not sure if this is what you are doing or not, however, my best guess is that if you are logged in as another user account, and run a shell as the openhab account, some environment variables arent created correctly/used. So please confirm you have logged in as the openhab user.

Additionally, I cannot remember now if I set any other permissions… I dont think so, however, I did write a full post on everything I did to get my whole openhab setup working, including any strange permissions I set. You can find that here

Finally, heres a selection of the way I got the rules working eventually. As you can see, I am not calling a separate script in the end. Eventually, openhab would call the ps4-waker directly without the need for a script. so examples below.

// *************************
// ** PLAYSTATION 4 RULES **
// *************************

// Update switch status to On/Off if device manually switched on

rule "Update Playstation state"
when
    Item PSResult changed
then
	if (PSResult.state == 0) PLAYSTATION.postUpdate("ON") else PLAYSTATION.postUpdate("OFF")
end

// PLAYSTATION - On/Off

rule "PlaystationOn"
	when 
		Item PLAYSTATION received command ON
	then
		executeCommandLine=("ps4-waker")
		Thread::sleep(2000)
	end

rule "PlaystationOff"
	when 
		Item PLAYSTATION received command OFF
	then
		executeCommandLine=("ps4-waker standby")
		Thread::sleep(2000)		
	end

// PLAYSTATION - Activities

rule "Playstation-Amazon"
	when 
		Item PLAYSTATIONACT received command 0
	then
		executeCommandLine=("ps4-waker start CUSA00126")
		Thread::sleep(2000)		
	end

rule "Playstation-Netflix"
	when 
		Item PLAYSTATIONACT received command 1
	then
		executeCommandLine=("ps4-waker start CUSA00127")
		Thread::sleep(2000)		
	end

To see how the PSResult for On/Off works, check this post:

Thanks