Amazon Dash Button 停止了 ARPing? [英] Amazon Dash Button stopped ARPing?

查看:15
本文介绍了Amazon Dash Button 停止了 ARPing?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现了一个家庭自动化解决方案,使用两个 Amazon Dash 按钮、一个 raspberry pi 和 Python 代码来跟踪我孩子的家务,类似于所做的事情 此处.该解决方案在过去几个月一直有效.

I have implemented a home automation solution to track my childrens chores using two Amazon Dash buttons, a raspberry pi, and python code similar to what's been done here. This solution has worked for the past several months.

昨天,按钮似乎已停止 ARPing.也就是说,我无法再从他们那里检测到 ARP,我似乎也无法通过嗅探来检测他们的 MAC 地址.我想知道其他人是否遇到过这个问题?除了使用scapy的python机制,我也试过ip neigh"也无济于事.使用ip neigh"命令的 bash 脚本示例是 此处.我试图从 RaspberryPI 和 Mac 检测按钮.所有机器均已成功配置为位于同一无线网络上.

Yesterday, the buttons appear to have ceased ARPing. That is, I can no longer detect an ARP from them, nor do I appear to be able to detect their MAC address by sniffing it. I'm wondering if anyone else has had this problem? In addition to the python mechanism using scapy, I also tried "ip neigh" to no avail. An example of a bash scrip using the "ip neigh" command is here. I've attempted to detect the buttons both from a RaspberryPI and from a Mac. All machines are successfully configured to be on the same wireless network.

一些额外的信息.最初我订购了 3 个按钮,但其中 1 个似乎从来没有 ARP,所以我把它放在一边.我会在找到有关此问题的更多信息后进行更新.

Some additional info. Originally I ordered 3 buttons, but 1 of them never seemed to ARP, so I set it aside. I'll update as I find out more information about this issue.

编辑我已经多次尝试通过使用 Amazon android 应用程序添加新的破折号按钮并重新配置它们来解决此问题.

EDIT I have tried several times to solve this issue by utilizing the Amazon android app to add a new dash button and reconfigure them again.

推荐答案

我为解决这个问题所做的是为它们连接的无线路由器上的按钮分配固定的 IP 地址(因为我可以在DHCP 表).然后我重新编写了脚本以简单地检测针对分配给按钮的 ipAddress 的成功 ping.我注意到按钮在网络上保留了一段时间(可能是 15-20 秒)所以我在检测之间添加了一点等待时间(有点像物理开关上的去抖动过滤器)以确保相同的按钮按下没有被检测到两次.这成功了.

What I did to solve this issue, was to assign fixed IP addresses to the buttons on the wireless router they attached to (because I could see their MAC addresses in the DHCP table). I then rewrote the script to simply detect successful pings against the ipAddress the buttons had been assigned. I noticed that the buttons remain on the network for a little while (maybe 15-20 seconds) so I added a little bit of wait time between detections (kind of like a debounce filter on a physical switch) to ensure that the same button push wasn't detected twice. This did the trick.

首先,我找到了 ping 的纯 python 实现(我复制了 lock、stock 和; 进入 python 脚本),然后我写了这段代码:

First I found a pure python implementation of ping (which I copied lock, stock, & barrel into the python script), then I wrote this code:

#!/usr/bin/python
from scapy.all import *
import requests
import time
import os, sys
import subprocess
import re
import platform
import datetime

BUTTON_A = "<assigned IP address to Button A>"
BUTTON_B = "<assigned IP address to Button B>"
last_button_push_A = datetime.datetime(2013,12,30,23,59,59)
last_button_push_B = datetime.datetime(2005,12,30,1,1,1)
waittime_sec = 20
while (True):
        try:    
            delta = (datetime.datetime.now() - last_button_push_A).seconds
            print (delta > 20)
            if (do_one(BUTTON_A, 1) is not  None) and delta > waittime_sec:
                    last_button_push_A  = datetime.datetime.now();
                    logfile.write("<Child 1> Completed a Chore: "+time.strftime("%Y-%m-%d %H:%M")+"
")
                    logfile.flush()
                    play_sound_child_1()
            delta = (datetime.datetime.now() - last_button_push_B).seconds
            if (do_one(BUTTON_B, 1) is not  None) and delta > waittime_sec:
                    last_button_push_B = datetime.datetime.now()
                    logfile.write("<child 2> Completed a Chore: "+time.strftime("%Y-%m-%d %H:%M")+"
")
                    logfile.flush()
                    play_sound_child_2()
        except BaseException as e:
            logfile.write("EXCEPTION: {}
".format(e))
            logfile.write("Loop Rest at "+time.strftime("%Y-%m-%d %H:%M")+"
")

这篇关于Amazon Dash Button 停止了 ARPing?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆