Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple dash presses registered even with timeout enabled. #87

Open
TFWol opened this issue Jul 18, 2017 · 12 comments
Open

Multiple dash presses registered even with timeout enabled. #87

TFWol opened this issue Jul 18, 2017 · 12 comments

Comments

@TFWol
Copy link

TFWol commented Jul 18, 2017

I'm seeing an issue with the dash button being registered multiple times even though a timeout has been set. Same result with different protocols.

Configuration:

{"buttons":[
 {
   "name": "Lamp Desk Light 1 - GLAD",
   "address": "redacted",
   "url": "http://localhost:8123/api/services/switch/toggle",
   "method": "POST",
   "protocol": "udp",
   "timeout": "30000",
   "headers": {"x-ha-access":redacted ""},
   "json": true,
   "body": {"entity_id": "switch.wemo_switch"}
  },
 {
   "name": "Lamp Desk Light 2 - Tide",
   "address": "redacted",
   "url": "http://localhost:8123/api/services/switch/toggle",
   "method": "POST",
   "protocol": "udp",
   "timeout": "30000",
   "headers": {"x-ha-access":redacted ""},
   "json": true,
   "body": {"entity_id": "switch.wemo_switch"}
  }

]}

Resulting logs where it flickers. It seems to not implement the timeout if registered multiple times in the same millisecond?

Jul 17 16:52:24 HomeAssistant npm[10943]: [2017-07-17T23:52:24.161Z] Lamp Desk Light 2 - Tide pressed. Count: 13

Jul 17 16:52:24 HomeAssistant npm[10695]: [2017-07-17T23:52:24.162Z] Lamp Desk Light 2 - Tide pressed. Count: 15

Jul 17 16:52:24 HomeAssistant npm[10744]: [2017-07-17T23:52:24.162Z] Lamp Desk Light 2 - Tide pressed. Count: 14

Jul 17 16:52:24 HomeAssistant npm[10973]: [2017-07-17T23:52:24.163Z] Lamp Desk Light 2 - Tide pressed. Count: 12
@joeflan
Copy link

joeflan commented Jul 27, 2017

Just wanted to chime in and say I'm having the same issue. Seems to be registering the push a second time after about ~30 - 45 seconds. have you tried setting the timeout lower? I'll try when I get home and report back

@joeflan
Copy link

joeflan commented Jul 28, 2017

Actually sorry, set the timeout higher. I set it to 60,000 and it's working fine now. You obviously have to wait to press again but it's a work around for now

@TFWol
Copy link
Author

TFWol commented Jul 28, 2017

Good to know, I'll try it for a week or so and report back results.

@TFWol
Copy link
Author

TFWol commented Jul 28, 2017

Bah, that was short lived. It looks like I'm still having the problem. I made sure to restart the service and verify changes too.

I have the buttons being blocked by firewall, but that shouldn't affect the results since the timeout is supposed to ignore all calls after the first for the set period of time.

Too bad I don't know how to code in this language to fix it.

@swamaway
Copy link

I had the same issue. I set the timeout to 10000 and that did not help. I then restarted the entire pi and that fixed the issue.

@jared591
Copy link

jared591 commented Jan 14, 2018

Has anyone figured this out by chance? I am having the same issue. My dash button is being registered at random lengths of time as soon as I start running dasher even without pressing the button at all. I've tried restarting my pi and that didn't seem to fix it.

This is after I started the program and never pressed the button. And it keeps going.

pi@jared:~/dasher $ sudo npm run start

[email protected] start /home/pi/dasher
node app.js

[2018-01-13T23:44:00.509Z] amzbasicsbatteries added.
[2018-01-13T23:48:05.904Z] amzbasicsbatteries pressed. Count: 1
[2018-01-13T23:49:46.783Z] amzbasicsbatteries pressed. Count: 2
[2018-01-13T23:50:35.663Z] amzbasicsbatteries pressed. Count: 3
[2018-01-13T23:51:22.463Z] amzbasicsbatteries pressed. Count: 4

{"buttons":[
{
"name": "amzbasicsbatteries",
"address": "Mac Address",
"timeout": "20000",
"interface": "eth0",
"url": "https://maker.ifttt.com/trigger/goodnight/with/key/IFTTT
"method": "POST"
}
]}

@TFWol
Copy link
Author

TFWol commented Jan 14, 2018

Unfortunately, I'm still having the issue as well, although I'm using a VM.

Also, it doesn't seem like the developer is even active anymore.

@jared591
Copy link

I figured out the issue I was having. Maybe it's the same for you.

My issue was that I was actually using the wrong MAC Address. I downloaded wireshark and found that there was a UDP signal that keeps repeating on it's own and the source is called Sagemcom. That is the MAC address I had gotten when I ran sudo ./script/find_button. If you go into wireshark and press the dash button you get a, AmazonTe ARP trigger. When you click on that it gives you the correct MAC Address to use. That trigger only shows up one time in wireshark every time I press the dash button.

Hope this helps.

@TFWol
Copy link
Author

TFWol commented Jan 15, 2018

@jared591 I wish it were the case, but I found my button MAC through my router and verified it against the MAC vendor list.

I also had put the Dasher instance, Home assistant, and Dash button on their own test network so nothing else could interfere.

I see a pull request that uses Docker so I may go that route so that all resources are the proper versions and see if it somehow fixes my issue.

@brahmafear
Copy link

+1 Seeing same issue. One dash press triggering multiple activations. The following is the log result from a single dash press:

Feb 14 22:54:59 philotic npm[21458]: [2018-02-15T03:54:59.799Z] Dream Water pressed. Count: 2
Feb 14 22:54:59 philotic npm[27545]: [2018-02-15T03:54:59.823Z] Dream Water pressed. Count: 1
Feb 14 22:54:59 philotic npm[27728]: [2018-02-15T03:54:59.887Z] Dream Water pressed. Count: 1
Feb 14 22:55:00 philotic npm[22415]: [2018-02-15T03:55:00.579Z] Dream Water pressed. Count: 2

Here is the config for that button:
{
"name": "Dream Water",
"address": "ac:63:be:84:80:4f",
"timeout": "60000",
"protocol": "arp",
"url": "http://localhost:8123/api/services/script/turn_on",
"method": "POST",
"headers": {"x-ha-access": ""},
"json": true,
"body": {"entity_id": "script.dash_dreamwater"}
},

Have tried with protocol udp and arp.

Anyone have a fix? This all works great at a different location running on Raspbian on a Pi3. Having this issue under Ubuntu 16.04.

@chris87p
Copy link

Are you using systemd to autostart Dasher?

I had this trouble because whenever I restarted Dasher with "sudo systemctl restart dasher," I would wind up with two instances of Dasher running. It looks like you're in the same boat.

The instructions I used had me set up my systemd file like this:

[Unit]
Description=Dasher
After=network.target

[Service]
Type=simple
#user with access to dasher files
User=root
WorkingDirectory=/home/pi/dasher
#use command "which npm" to determine correct location of NPM
ExecStart=/usr/local/bin/npm run start
Restart=on-failure
RestartSec=10
KillMode=process

[Install]
WantedBy=multi-user.target

I removed these lines, then rebooted. It worked fine after.

Restart=on-failure
RestartSec=10
KillMode=process

@brahmafear
Copy link

brahmafear commented Jul 23, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants