Using Shell_command to run on pi

Hi everyone. I’m struggling with some issues on HeyU and Hassbian talking nicely with each other. I’m able to control HeyU from the pi@homeassistant directory, but Hassbian isn’t talking to it. I’m wondering how I can program a shell command to operate a script to command HeyU. Below is an example of the commands I want running in pi:

shell_command:
engage_HeyU: “HeyU start”
Light_on: “HeyU on O4”

My endgame is to have an automation run each of these so they turn on lights at a specific time, but right now I can’t even get the pi to run these commands. Any thoughts? Thanks.

In Hassbian, HA runs as user homeassistant, so you need to make sure that that user can run the commands. It is generally a good idea to use the full path to executables, rather than rely on the PATH variable being set.

Also, to turn lights on and off, you might consider using a command line switch

How do I allow the homeassistant user to run those commands from HA? Like I said when I’m in putty and on the pi@homeassistant: I’m able to operate HeyU with the command “heyu start”

For the full directory would it be something like this?

shell_command:
engage_HeyU: “cd…HeyU start”
Light_on: “cd…HeyU on O4”

As pi user do

which Heyu

This will give a result like

/usr/bin/Heyu

which is the full path of the command. You can type this and run the command again as Pi user.

Now you need to log in as homeassistant user and check that this user can run that command

sudo su -s /bin/bash -l homeassistant
/usr/bin/Heyu    # or whatever the result was above

If it doesn’t work its probably a permissions problem. If you print the output of

ls -l `which Heyu`

as pi user, someone might be able to sort out the problem

edit:
if it does work, you can just use the full path in your config.yaml :grinning:

Thanks! I’ll give it a whirl when I get home tonight.

Permissions seem to be the issue. Thanks!