Hi all,
I am new to the HomeAssistant world. I am trying to setup a command line sensor using python script and I have run out of luck.
I was referring to the Integrations page and this post. This is what I am trying to achieve.
Here is a glimpse of my config file
sensors:
- platform: command_line
name: test_sensors
json_attributes:
- total_cases
- total_cases_india
- error
value_template: "{{ value_json['total_cases_india'] }}"
unit_of_measurement: "int"
command: 'python3 print("{\"total_cases\": \""+ str(12) +"\", \"total_cases_india\": \""+str(14)+"\"\", \"error\": \""+str(False)+"\"}")'
scan_interval: 2`
Here are the issues I am facing:
- instead of print command I want to put a path to python file. I tried all different options but I cannot figure out where should I put my script and how to build the path.
- using SSL even on bash I tried both python and python3 command. Unfortunately, both of them didn’t work.
I also tried the python_script way but it didn’t work either as imports don’t work.
Can anybody please help me run .py files?