Python script comaand_line over network help

Hey Guys I used to run this code below on my Hass PI3 server

- platform: command_line
  switches:
    python:
      command_on: "python /home/homeassistant/.homeassistant/ParadoxIP150-master/IP150-MQTT.py"
      friendly_name: Alarm Python Start

now Ive move my MQTT and python files to a new networked PI
when running below command in terminal all works
sshpass -p "Justj33p" ssh [email protected] python /home/homeassistant/.homeassistant/ParadoxIP150-master/IP150-MQTT.py

but when its run from command_line it failes as per below

- platform: command_line
  switches:
    python:
      command_on: "sshpass -p "Justj33p" ssh [email protected] python /home/homeassistant/.homeassistant/ParadoxIP150-master/IP150-MQTT.py"
      friendly_name: Alarm Python Start

I get errors in home assistant saying mapping values are not allowed or something of that likeness

how can i add this command to command_line switch
sshpass -p “Justj33p” ssh [email protected] python /home/homeassistant/.homeassistant/ParadoxIP150-master/IP150-MQTT.py

I have a feeling its to do with the extra quotes around password

"code “passord” "

**I Have also tryed it with out the quotes and get hass error below **

sshpass -p “Justj33p” ssh [email protected] python /home/homeassistant/.homeassistant/ParadoxIP150-master/IP150-MQTT.py

2018-01-06 00:16:12 ERROR (Thread-2) [homeassistant.components.switch.command_line] Command failed: sshpass -p “Justj33p” ssh [email protected] python /home/homeassistant/.homeassistant/ParadoxIP150-master/IP150-MQTT.py

this also works in HASS terminal with out quotes around password but still shows error in log

- platform: command_line
  switches:
    python:
      command_on: "sshpass -p Justj33p ssh [email protected] python /home/homeassistant/.homeassistant/ParadoxIP150-master/IP150-MQTT.py"
      friendly_name: Alarm Python Start



2018-01-06 08:05:05 ERROR (Thread-2) [homeassistant.components.switch.command_line] Command failed: sshpass -p Justj33p ssh [email protected] python /home/homeassistant/.homeassistant/ParadoxIP150-master/IP150-MQTT.py
2018-01-06 08:07:18 ERROR (Thread-4) [homeassistant.components.switch.command_line] Command failed: sshpass -p Justj33p ssh [email protected] python /home/homeassistant/.homeassistant/ParadoxIP150-master/IP150-MQTT.py

To run a remote command I normally share the ssh keys, so passwords are not necessary:
https://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/

Ok thanks I’ll look into that
Surly any commands that work in terminal can be run from HASS I would have though anyways

Provided that the terminal is using the same user and environment, it should. Which user you are running HA as will make a difference as it will have different permissions and paths.

Well my HASS is on Hassbian and my second RPI server is running raspbian but have same directories and user Pi .
I also don’t care much for permissions and I normally run sudo chmod -R a+w home dir
I know this is not probably secure but as for testing and getting things to work removing all possible permissions and making them 777 just saves that problem. So I am unsure why I can run the script from my HASS server from terminal a pythons program on my raspbian server and it works but yet the same code run under switch command_line failed

@MyCool did you resolve this? I am having the same issues as you are.

Install sshpass on your Hass device then
Try something like this by memory

  • platform: command_line
    switches:
    python:
    command_on: “sshpass -p Password ssh [email protected] python /home/pi/ParadoxIP150-master/IP150-MQTT.py”
    friendly_name: Alarm Python Start’