Home Assistant 2023.6.2
Supervisor 2023.06.2
Operating System 10.2
Frontend 20230608.0 - latest
I have several binary_sensors in my command_line.yml that seem to have just stopped working.
Here’s one example. Working before 2023.6.2, now not working.
- binary_sensor:
name: HTTP Check Nginx Proxy Manager
command: response=$(curl -LIk -m 3 http://192.168.10.34:81/login/ -o /dev/null -w "%{http_code}\n" -s); test "$response" -eq 200 && echo "OFF" || echo "ON"
scan_interval: 60
value_template: '{{ value }}'
device_class: 'problem'
I SSHed into my HA and tried the command on the command line, and it seems that the test
command no longer functions like it used to.
I rewrote the command like so, surrounding it with single apostrophes as recommended in the documentation. This command executes successfully on the command line. I also changed my device_class from “problem” to “connectivity” because I felt that was more appropriate for this kind of check.
- binary_sensor:
name: HTTP Check Nginx Proxy Manager
command: 'response=$(curl -LIk -m 3 http://192.168.10.34:81/login/ -o /dev/null -w "%{http_code}\n" -s); [[ "$response" -ne 200 ]] && echo "off" || echo "on"'
scan_interval: 60
value_template: '{{ value }}'
device_class: 'connectivity'
Even though the command works fine in a shell, it still doesn’t seem to work in HA.