I hope to get everyone's help binary sensor value_template

I have a mobus human motion sensor, using ascll Configuration,
How to access hass, thank you all


binary_sensor:

  • platform: command_line
    name: pir
    command: “echo ‘ID=31190658 HUB=?’|nc -i 1 -N 192.168.31.158 8899”
    payload_on: “on”
    payload_off: “off”
    device_class: motion
    scan_interval: 2
    This configuration has no feedback on hass

    I hope to get help. Thank you

Maybe try:

- platform: command_line
  name: pir
  command: "echo 'ID=31190658 HUB=?'|nc -i 1 -N 192.168.31.158 8899"
  payload_on: 'true'
  payload_off: 'false'
  value_template: "{{ 'HUB=1' in value }}"
  device_class: motion
  scan_interval: 2
1 Like

Try the following in your terminal

echo 'ID=31190658 HUB=?'|nc -i 1 -N 192.168.31.158 8899 | grep 31190658 | cut -d'=' -f3

If it returns 0 or 1,

payload_on: '1'
payload_off: '0'

should work.

EDIT: Or try @pnbruckner’s suggestion. :slightly_smiling_face:

2 Likes

Thank you。Can now be used normally
thank you for your help

thank you for your help

1 Like