Most basic command line sensor

I’m really struggling to get just a basic command line sensor to show up

Here’s what I’m running:
* Installation method Home Assistant OS
* Core 2025.6.3
* Supervisor 2025.06.2
* Operating System 15.2
* Frontend 20250531.4

This is what I have put in my configuration.yaml file:
(1) The sensor I’m trying to create
(2) An example that I found on this forum

command_line:
- sensor:
name: "KCAK_Metar"
unique_id: "KCACK_Metar"
command: "curl -s 'https://aviationweather.gov/api/data/metar?ids=KAKR&hours=0&order=id%2C-obs&sep=true' | cut -d' ' -f 7 | cut -d'/' -f 1 "
unit_of_measurement: "°C"
device_class: temperature
value_template: "{{ value | round(0) }}"
scan_interval: 6000
- sensor:
name: "MeinTestSensor"
unique_id: "my_unique_test_sensor_xyz"
command: "/bin/echo Hello World!"
scan_interval: 60

Neither KCAK_Metar nor MeinTestSensor show up on any card configuration, in my list of devices, nor my list of entities.

I have saved configuration.yaml, used the Developer tools to validate the YAML files, and reloaded Home Assistant, but neither show up.

Any help is appreciated.

I’m very new to YAML, but not to types of scripting or other IT concepts.

Thanks!

–Tony

Have you restarted HA since adding the YAML you posted to your configuration.yaml file? A restart is necessary any time you add a new integration or new file to you configuration.

Your KCAK sensor works perfectly here:

I simply added it to the end of my existing command_line sensor.

You do need to do a full restart of HA when you add a new integration to your configuration, not just a reload. Choose the lower option:

Thank you @Didgeridrew and @Troon !!

I didn’t know I had to hit “Restart Home Assistant” instead of “Quick Reload” and doing that solved the issue.

It makes sense that it would be needed for a new integration, but, I didn’t realize that’s what I was doing since I wasn’t clicking “Add Integration” from the Integrations page, but it makes sense now.

I knew I was making a silly mistake.

tl;dr: Thanks! This fixed it! “Restart Home Assistant” not “Quick Reload” for adding your first command line sensor (or any new integration)

1 Like