Unreliable InfluxDB size sensor

Hi,
Previously in this thread I proposed to publish the InfluxDB size via MQTT. I just want to update how to publish it via a command line sensor, for those that don’t want to run a MQTT server. Please note this procedure is more advanced.

  • The SSH & Web Terminal is still needed (with protection mode off)
  • We now don’t create the init command in that add-on!
  • You first need to create authorization keys to enable password less SSH access. This is explained in: SSH'ing from a command line sensor or shell command
  • the procedure doesn’t mention you have to also have add the public key to the authorization_keys in the SSH & Web terminal config!
  • If SSH logon works without a password, you can create a command line sensor to read the InfluxDB size like this:
  - platform: command_line
    name: InfluxDB Size
    unique_id: influxdb_size
    command: ssh <user>@192.168.178.47 -i /config/.ssh/id_rsa 'sudo docker exec addon_a0d7b954_influxdb du -s /data/influxdb/data/homeassistant'
    value_template: "{{ (value.split('\t')[0]|int(0)/1000)|round(1) }}" 
    unit_of_measurement: 'MB'
    scan_interval: 300  

Check the log of your SSH & Web terminal add-on if there are issues

2 Likes