So are you actually SSH-ing from your HA back into your HA? Why ist that necessary if everything is local already?
I had this which never worked, now finally following up and trying to keep the CL sensor path instead of writing things to a file or MQTT (keep it as simple as possible!):
sensor:
- platform: command_line
name: InfluxDB size (homeassistant)
unique_id: xxx-xxx
scan_interval: 3600
command_timeout: 30
command: "docker exec addon_a0d7b954_influxdb du -shm /data/influxdb/data/homeassistant | cut -f1"
unit_of_measurement: MB
value_template: "{{ value }}"
Sensor output is: (empty/nothing)
Running the command manually in the SSH addon with protection mode off gives:
5621.
Makes sense, as the CL sensor is run in the HA container - which does not see the folder (same for /backup which is not accessible for HA).
So how to make this work?
- …without SSH-ing into localhost (giving HA access to the whole system without authentication still does not feel like a good idea from a security perspective - this way it can “break out of its jail”).
- …without using ✔️🏃Run On Startup.d
- …without constantly running a cron which stores the output of the
du -shcommand to a file which is then read by HA.
All of that is way to complicated. Sounds like there is one pill I have to swallow - unless there’s another way. Maybe?