Quantcast
Viewing all articles
Browse latest Browse all 106204

Command works in HA terminal, doesn’t as command line sensor

I’m trying to make a command-line sensor. This command will check if my vpn tunnel can ping to the outside world. It’s working as it should from the HA terminal but not as a sensor. What am I doing wrong?
This is the code:

- platform: command_line
  name: "VPN Tunnel Status"
  command: ssh -i /config/.ssh/id_rsa -o 'StrictHostKeyChecking=no' USER@192.168.x.x iocage exec wgvpn ping -c 1 google.com &> /dev/null && echo "Online" || echo "Offline"
  scan_interval: 90
  #scan_interval: 43200 #every 12 hours
  value_template: "{{ value }}"

When checking this new sensor in Developer Tools the state of this sensor will always be Offline. I think it has something to do with the quotation marks. Looked up some examples in this forum but couldn’t find a working solution. Any ideas?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 106204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>