Command line for python script

I´m running a Hass.IO on a pi3 and I found out a python script that can turn on my xbox on this link, I´ve already run this on my python on my windows and works perfectly. When I tried to run this with shell command with a input boolean and automation gaves me nothing on the logs and didn´t run at all. I read a lot and was trying to run thi on switch command line here´s my configuration:

  • platform: command_line
    command_on: “python3 home/pi/.homeassistant/python_scripts/ -a -i FD00C611FFBF141A”
    command_off: “python3 ./home/homeassistant/python_scripts/ -a -i FD00C611FFBF141A”
    friendly_name: Xbox

is it possible to run this on command line?
it´s giving me this error on the logs:

python3: can’t open file ‘home/pi/.homeassistant/python_scripts/’: [Errno 2] No such file or directory
2017-11-26 15:10:59 ERROR (SyncWorker_14) [homeassistant.components.switch.command_line] Command failed: python3 home/pi/.homeassistant/python_scripts/ -a -i FD00C611FFBF141A
My xbox py it´s on a paste called python_scripts inside config paste, what I´m doing wrong?

I notice that in my setup I don’t have the double quotes around the command, e.g.

        friendly_name: Den Blind
        command_on: python3 /home/pi/ d
        command_off: python3 /home/pi/ u

Your path is incorrect. For starters, in the command_on, you have ‘home/pi/…’, in your command_off you have ‘./home/homeassistant/…’ These are 2 completely different paths and I don’t think either one lines up with where HASS.IO is running. What is your config path?

Hello thanks for the reply, even I assuming both paths equals, for command off and on still doesn´t work, and gives the same error on logs. I don´t know which is my path, how can I find it?

tks I´ll try where did you put your py files?

Look on your ‘About’ page, the little i with a circle around it.

You should see ‘Path to configuration.yaml:’

You should know where the path to things are from when you setup HASS.IO

I have them in the Home/Pi directory but you can put them in your homeassistant directory, so long as you specify the path correctly.

is saying this:
Home Assistant

Path to configuration.yaml: /config

Then your script path would be ‘/config/python_scripts’?

When you tell a Linux OS ‘/home/pi’, it means quite literally the path is /home/pi. Your example above has 2 completely different paths from each other and neither exist in your HASS.IO install

Tks very much finally it works with right path if anyone wants to turn on xbox this is a easy way to.

Hi Im trying to run a simalar pyton scrip this is my code but log says errors


  • platform: mqtt
    name: “Alarm Turn On”
    state_topic: “stat/Alarm_Turn_On/POWER”
    command_topic: “cmnd/Alarm_Turn_On/POWER”
    qos: 0
    payload_on: “ON”
    payload_off: “OFF”
    optimistic: false
    retain: true

  • platform: command_line
    command_on: “/config/python_scripts/ParadoxIP150-master/”

error is

2017-12-17 23:44:32 ERROR (SyncWorker_0) [homeassistant.util.yaml] mapping values are not allowed here
in “/config/switchs.yaml”, line 82, column 13
2017-12-17 23:44:32 ERROR (MainThread) [homeassistant.bootstrap] Error loading /config/configuration.yaml: mapping values are not allowed here
in “/config/switchs.yaml”, line 82, column 13

You should open your own thread because your error just indicates you have a syntax error in your yaml file. Probably a spacing issue.

sorry i must have had a typo above but my issue is the same as the above thread im just using different python script

#Switch below

- platform: command_line
      command_on: /config/python_scripts/ParadoxIP150/
      friendly_name: Testing

error when switch turned on bellow

2017-12-20 11:49:11 ERROR (SyncWorker_10) [homeassistant.components.switch.command_line] Command failed: /config/python_scripts/ParadoxIP150/

File location below

please any help this used to work in old HASS but after updates i cant find any other way to run my [python script

You probably just need to put the keyword ‘python3’ at the beginning of the command,


command_on: python3 /config/python_scripts/Paradox..... etc.

Thanks all sorted now turned out I hade to change my python config.ino location as there was errors caused by the way it was trying to read it probably makes no sense lol but it’s solved thanks

I am getting the error below, as a noob any idea what obvious error I made ? Running HASSIO ver 0.61.1 on PI3

Command failed: python3 /config/python_scripts/ -a -i FD00AE85B588FA97

Fixed it, re-download of the .PY file would you believe

I have a python-file with two methods, powerOn() and powerOff().

How do I write the command_line to call one of the methods in the file,
command_on: python3/config/python_scripts/ powerOn()?

Please advise.

I’d just make the file accept arguments and invoke the right function.