[QUESTION] Occupancy Presence Checking



  • 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
    &