mueslo / openwrt_hass_devicetracker

Simple OpenWRT package which forwards device connection changes to a HomeAssistant instance
GNU General Public License v3.0
92 stars 31 forks source link

WPS-ENROLLEE-SEEN causes confusion (log spam) #7

Open zxdavb opened 6 years ago

zxdavb commented 6 years ago

Thanks for your work.

I was getting WPS-ENROLLEE-SEEN events, and it has more than three parameters, causing errors in the system log.

When I looked at https://w1.fi/wpa_supplicant/devel/ctrl_iface_page.html, it seems all Control interface events have: iface msg, but after that it varies, so it may be better to reverse the logic a bit to reduce errors in favour of warnings (or just ignore?).

function push_event {
    logger -t $0 -p debug "push_event $@"

#   iface=$1
    msg=$2

    config_get hass_timeout_conn global timeout_conn
    config_get hass_timeout_disc global timeout_disc

    case $msg in 
        "AP-STA-CONNECTED")
            timeout=$hass_timeout_conn
            ;;
        "AP-STA-POLL-OK")
            timeout=$hass_timeout_conn
            ;;
        "AP-STA-DISCONNECTED")
            timeout=$hass_timeout_disc
            ;;
        *)
            logger -t $0 -p warning "push_event '$msg' not handled"
            return
            ;;
    esac

    if [ "$#" -lt 3 ]; then
        err_msg "Illegal number of push_event parameters"
        exit 1
    fi

    mac=$3

    post $(build_payload "$mac" "$(get_host_name $mac)" "$timeout")
}

IMO, you can get rid of the if block altogether? And maybe the warning too?

zxdavb commented 6 years ago

This may be of interest to you:

Fri Oct  5 00:35:40 2018 user.debug /usr/lib/hass/push_event.sh: push_event wlan1 WPS-ENROLLEE-SEEN 20:47:ed:55:f5:a6 8ff510a9-df20-d88d-614e-d7bd47f50bae 0-00000000-0 0x268c 0 1 [Sky Q box]
Fri Oct  5 00:35:40 2018 user.debug /usr/lib/hass/push_event.sh: push_event wlan1 WPS-ENROLLEE-SEEN 20:47:ed:55:f5:a6 8ff510a9-df20-d88d-614e-d7bd47f50bae 0-00000000-0 0x268c 0 1 [Sky Q box]
Fri Oct  5 00:35:40 2018 user.debug /usr/lib/hass/push_event.sh: push_event wlan1 WPS-ENROLLEE-SEEN 20:47:ed:55:f5:a6 8ff510a9-df20-d88d-614e-d7bd47f50bae 0-00000000-0 0x268c 0 1 [Sky Q box]
Fri Oct  5 00:35:40 2018 user.debug /usr/lib/hass/push_event.sh: push_event wlan1 WPS-ENROLLEE-SEEN 20:47:ed:55:f5:a6 8ff510a9-df20-d88d-614e-d7bd47f50bae 0-00000000-0 0x268c 0 1 [Sky Q box]
Fri Oct  5 00:35:40 2018 user.debug /usr/lib/hass/push_event.sh: push_event wlan1 WPS-ENROLLEE-SEEN 20:47:ed:55:f5:a6 8ff510a9-df20-d88d-614e-d7bd47f50bae 0-00000000-0 0x268c 0 1 [Sky Q box]
Fri Oct  5 00:35:40 2018 user.debug /usr/lib/hass/push_event.sh: push_event wlan1 WPS-ENROLLEE-SEEN 20:47:ed:55:f5:a6 8ff510a9-df20-d88d-614e-d7bd47f50bae 0-00000000-0 0x268c 0 1 [Sky Q box]
Fri Oct  5 00:35:41 2018 user.debug /usr/lib/hass/push_event.sh: push_event wlan1 WPS-ENROLLEE-SEEN 20:47:ed:55:f5:a6 8ff510a9-df20-d88d-614e-d7bd47f50bae 0-00000000-0 0x268c 0 1 [Sky Q box]
Fri Oct  5 00:35:41 2018 user.debug /usr/lib/hass/push_event.sh: push_event wlan1 WPS-ENROLLEE-SEEN 20:47:ed:55:f5:a6 8ff510a9-df20-d88d-614e-d7bd47f50bae 0-00000000-0 0x268c 0 1 [Sky Q box]
Fri Oct  5 00:35:41 2018 user.debug /usr/lib/hass/push_event.sh: push_event wlan1 WPS-ENROLLEE-SEEN 20:47:ed:55:f5:a6 8ff510a9-df20-d88d-614e-d7bd47f50bae 0-00000000-0 0x268c 0 1 [Sky Q box]

This device is not in my house. :(

mueslo commented 6 years ago

Thanks for the input, I left that as a warning from back when I was investigating all the hostapd events which would be useful for monitoring presence, it should of course be debug. I'll get on it after the week-end.

What do you mean by "this device is not in my house"?

zxdavb commented 6 years ago

What do you mean by "this device is not in my house"?

The device is next door, I guess (it is not one of my own wifi-enabled devices). In fact, there are several such devices appearing in the log, all with WPS-ENROLLEE-SEEN.

The real question is: why are these devices puzzling my WiFi?