hello…I cant figure it out what issue I have with this script…I’m running supervised install on Debian 10…the script itself runs fine if i execute is from command line…its working for root and for my user…so no issue there…
im calling the script this way in my configuration.yaml
sensor:
- platform: command_line
name: unifi_ap
command: 'python3 /config/python_scripts/unify.py'
.
.
.
The file path itself is correct I only created python scrips directory under my config directory. But for some reason the script doesn’t want to be executed.
Here is the Error output:
'Logger: homeassistant.components.command_line
Source: components/command_line/init.py:41
Integration: command_line (documentation, issues)
First occurred: 12:13:17 PM (1 occurrences)
Last logged: 12:13:17 PM
Command failed: python3 /config/python_scripts/unify.py’
If someone is using this on linux install or hassos…and give me some pointer where to look for problem I appreciate it…
Update:
script gets executed…since I see login from HA on my Unifi controller…so that part is ok…also aditional info on the error:
2021-04-17 12:57:50 WARNING (SyncWorker_4) [homeassistant.components.command_line.sensor] Empty reply found when expecting JSON data
so it looks that my config is wrong to parse the data
here it is:
sensor:
- platform: command_line
name: unifi_ap
command: 'python3 /config/python_scripts/unify.py'
value_template: '{{ value_json.Clients }}'
unit_of_measurement: Clients
scan_interval: 60
json_attributes:
- Clients
- Clients_Dimi3_WLAN
- Score
- CPU
- RAM
- Uptime
- Score_Dimi3_WLAN
- Activity
- Update
- platform: template
sensors:
unifi_ap_activity:
value_template: >
{{ states.sensor.unifi_ap.attributes.Activity }}
unit_of_measurement: 'Mbps'
friendly_name_template: Unifi AP Activity
unifi_ap_ram:
value_template: >
{{ states.sensor.unifi_ap.attributes.RAM }}
unit_of_measurement: '%'
friendly_name_template: Unifi AP RAM
unifi_ap_cpu:
value_template: >
{{ states.sensor.unifi_ap.attributes.CPU }}
unit_of_measurement: '%'
friendly_name_template: Unifi AP CPU
and here is the optupt of the script in command line:
{"Clients": 9, "Clients_Dimi3_WLAN": 9, "Score": 93, "CPU": "1.6", "RAM": "41.9", "Uptime": "9d 0h 27m", "Score_Dimi3_WLAN": 92, "Activity": "0.0 Mbps", "Update": false}