Hi,
I’m trying to retrieve information from my Proxmox Backup Server (PBS) via API to check if a task (such as a backup or sync) is currently running. Below is my current configuration:
configuration.yaml
shell_command:
pbscookie: "curl --silent --insecure --data 'username=root@pam&password=*REDACTED*' https://192.168.178.4:8007/api2/json/access/ticket | jq --raw-output '.data.ticket' | sed 's/^/PVEAuthCookie=/' > /config/pbsapi.yaml"
command_line:
- sensor:
name: "PBS Read"
command: >-
curl --insecure --cookie "PBSAuthCookie=$(cat /config/pbsapi.yaml | cut -d'=' -f2)" https://192.168.178.4:8007/api2/json/admin/datastore/Internal_Backup/active-operations
command_timeout: 10
scan_interval: 60
json_attributes:
- data
value_template: "{{ value_json.data.read | default(0) }}"
- sensor:
name: "PBS Write"
command: >-
curl --insecure --cookie "PBSAuthCookie=$(cat /config/pbsapi.yaml | cut -d'=' -f2)" https://192.168.178.4:8007/api2/json/admin/datastore/Internal_Backup/active-operations
command_timeout: 10
scan_interval: 60
json_attributes:
- data
value_template: "{{ value_json.data.write | default(0) }}"```
**automations.yaml**
```YAML
- id: '1742383537191'
alias: Get PBS Cookie
description: ''
trigger:
- platform: time_pattern
hours: /1
condition: []
action:
- service: shell_command.pbscookie
mode: single```
**What Works**
When running the curl command manually in the terminal, the desired output is successfully retrieved.
The pbsapi.yaml file is created, the token is correctly stored inside it.
**Issue**
The problem is that the sensors (sensor.pbs_read and _write) are not being created in Home Assistant. No matter what attributes I try to modify, the sensors do not show up.
Has anyone encountered a similar issue or have any idea how to fix this? Any help would be greatly appreciated!
Thanks!