Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    [QUESTION] Occupancy Presence Checking

    Scheduled Pinned Locked Moved Off-Topic & Non-Support Discussion
    1 Posts 1 Posters 717 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      konradwalsh
      last edited by

      Is something like this possible?

      The idea is that known MAC addresses are queryable and I can trigger a http call  to set a status bit

      I have searching all day.. trying to find appropriate script commands to do something similar..

      this is what works on DD-WRT

      #!/bin/sh
      # seconds between checks
      WATCHDOG_SLEEP_SEC=2
      # MAC Address 1
      MAC_ADDRESS_1="[XX:XX:XX:XX:XX:XX]"
      # MAC Address 2
      MAC_ADDRESS_2="[YY:YY:YY:YY:YY:YY]"
      # Vera VSwitch 1 Device ID
      VSWITCH_1="[99]"
      # Vera VSwitch 2 Device ID
      VSWITCH_2="[100]"
      
      #This loop will check if a device is registered on the AP and send the on/off command to vera. 
      
      while sleep $WATCHDOG_SLEEP_SEC
      do
      if wl assoclist | grep -Fq $MAC_ADDRESS_1
      then
          #echo Device 1 user is in
          wget -qs "http://[YOUR_VERA_IP_ADDRESS]:3480/data_request?id=lu_action&output_format=xml&DeviceNum=$VSWITCH_1&serviceId=urn:upnp-org:serviceId:VSwitch1&action=SetTarget&newTargetValue=1"
      else
          #echo Device 1 user is out
          wget -qs "http://[YOUR_VERA_IP_ADDRESS]:3480/data_request?id=lu_action&output_format=xml&DeviceNum=$VSWITCH_1&serviceId=urn:upnp-org:serviceId:VSwitch1&action=SetTarget&newTargetValue=0"
      fi
      
      if wl assoclist | grep -Fq $MAC_ADDRESS_2
      then
          wget -qs "http://[YOUR_VERA_IP_ADDRESS]:3480/data_request?id=lu_action&output_format=xml&DeviceNum=$VSWITCH_2&serviceId=urn:upnp-org:serviceId:VSwitch1&action=SetTarget&newTargetValue=1"
      else
          wget -qs "http://[YOUR_VERA_IP_ADDRESS]:3480/data_request?id=lu_action&output_format=xml&DeviceNum=$VSWITCH_2&serviceId=urn:upnp-org:serviceId:VSwitch1&action=SetTarget&newTargetValue=0"
      fi
      
      done
      &
      
      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.