Command_line Sensor in Config.yaml

Ich möchte einen Sensor erstellen, der den letzten Snapshot aus einem Frigate Verzeichnis identifiziert.

Code in Yaml:

sensor:
  - platform: command_line
    name: Frigate Latest Snapshot
    command: "ls -t /media/frigate/clips/*.jpg /media/frigate/clips/*/*.jpg | head -n 1"
    scan_interval: 30
    value_template: "{{ value }}"

Ich habe generell das Problem, dass ich keine Sensoren über die Config.yaml zum laufen bekomme. Hat jemand eine Idee?

Wenn es keine Geheimnisse in der configuration.yaml gibt zeige mal bitte deine komplette :wink: sonst bitte PN

Ja, das wäre eindeutig besser, so schaut es erstmal korrekt aus.

Hier meine Config. Viel steht nicht drin …

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

shell_command:
  delete_frigate_clips: >
    rm -rf /media/frigate/recordings &&
    rm -rf /media/frigate/clips &&
    rm -f /config/frigate.db





awtrix:

Hi, versuche es mal so. Ich glaube es kommt zu Problemen, wenn die Sensoren erst unter dem shell_command angelegt werden.

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

sensor:
  - platform: command_line
    name: Frigate Latest Snapshot
    command: "ls -t /media/frigate/clips/*.jpg /media/frigate/clips/*/*.jpg | head -n 1"
    scan_interval: 30
    value_template: "{{ value }}"


shell_command:
  delete_frigate_clips: >
    rm -rf /media/frigate/recordings &&
    rm -rf /media/frigate/clips &&
    rm -f /config/frigate.db
1 „Gefällt mir“

Ich würde auch eher auf die aktuelle Schreibweise wechseln (obwohl die veraltete auch noch funktionieren sollte)

command_line:
  - sensor:
      name: Frigate Latest Snapshot
      command: "ls -t /media/frigate/clips/*.jpg /media/frigate/clips/*/*.jpg | head -n 1"
      scan_interval: 30
      value_template: "{{ value }}"