I would like to use a binary sensor to check my AC power. The server is an old thinkpad laptop, and I could use the AC Power Adaptor Status to figure it out. My problem is… that even with just an “echo 1” command, my sensor is always stuck at “OFF” state. My setup runs on docker-compose. What am I doing wrong ?
# AC Power Sensor
binary_sensor:
- platform: command_line
command: 'echo 1'
name: "ACPower"
scan_interval: 2
value_template: '{% if value is equalto "1" %} OK {% else %} Power Outage {% endif %}'
payload_on: '1'
payload_off: '0'