this is what in have in my sensor file
#=======================================================================
#
#=======================================================================
- platform: command_line
name: NAS Drobo
command: ping -W 1 -c 1 192.168.1.5 > /dev/null 2>&1 && echo success || echo fail
payload_on: "success"
payload_off: "fail"
value_template: >-
{% if value is equalto "success" %}
On-Line
{% else %}
Off-Line
{% endif %}