Sensor always unknown

Hi, I have set this sensor to check get the status of a webserver…

- platform: command_line
  name: Test_server
  command: curl -LIk -m 3 -o /dev/null -w "%{http_code}\n" -s
  scan_interval: 300
  value_template: '{{ value }}'

but it remains “Unknown”.
What is my mistake ? Thanks.

It works fine on my system with the curl line slightly modified to point at my HA:

  command: curl -LIk -m 3 -o /dev/null -w "%{http_code}\n" -s

Have you tried it with a different server? Is there anything in the logs?

Thanks @Troon, tried wit another server and u’r right it works… will investigate what’s wrong…sorry.

1 Like