Command line sensor help

hi guys,

i have the following python script which i would like to get the results into home assistant

here is the python script

 from requests import session

payload = {
    'action': 'login',
    'id': 'xxxxx',
    'password': 'xxxxx'
}

with session() as c:
    c.post('https://www.yalehomesystem.co.uk/homeportal/api/login/check_login', data=payload)
    response = c.get('https://www.yalehomesystem.co.uk/homeportal/api/panel/get_panel_mode')
    print(response.text)

i stored it in a folder in config which i know HA has access too, then added the below to my sensor yaml

- platform: command_line
  name: yale
  command: "/config/sensor_scripts/yale.py"

yet all i get in the log file is this:
2018-08-26 20:59:50 ERROR (SyncWorker_16) [homeassistant.components.sensor.command_line] Command failed: /config/sensor_scripts/yale.py

can someone please tell me what iā€™m doing wrong

I would try:

  command: "python3 /config/sensor_scripts/yale.py"
1 Like