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

Button sends sometimes two requests -> Toggling on and off right after #6

Open
MickiCH opened this issue Oct 4, 2020 · 8 comments
Open

Comments

@MickiCH
Copy link

MickiCH commented Oct 4, 2020

Hello,

Great little tool as I love the Pop Buttons, but want flexibility.
My problem is that quiet often I press the button and the light turns on then shorty after off again. I normally use "toggle" modes. It seems that either the request is beeing repeated/executed twice. Is there a way to say for lets say 3 seconds one button press will only call the http request once?
It happens even more often when I have two logitech bridges in the network.

Thank you

@Andrew-Brock
Copy link

There is already a 5 second debounce implemented (see pophttp.py#L44 and the comment explaining the last_triggered variable on pophttp.py#L36) because the pop bridge sends the same message multiple times even for a single bridge.

The code for it looks fine to me but I can test it out in a day or 2. You can also try increasing the timeout to something like 10 seconds on line 44 there if you want to play around with it yourself, but given you're suggesting a 3 second debounce I'm guessing that won't help whatever problem you're having.

Just to confirm, have you tried running it with -vv and checked the logs to ensure that it is indeed calling your HTTP endpoint multiple times and that the problem doesn't lie with whatever you're calling with it?

@MickiCH
Copy link
Author

MickiCH commented Oct 5, 2020

Thanks for the comment. Sorry I wasn't aware there was already a 5 second debounce - hence my purely arbitrary 3 seconds approach.
I tried running it with -vv and yes these are separate HTTP calls and yes these are separate requests:

Server started on on 0.0.0.0
2020-10-05 21:02:17,281 192.168.1.227 resp 200 in 334ms http://192.168.1.208/toggle
2020-10-05 21:02:21,322 192.168.1.227 resp 200 in 334ms http://192.168.1.208/toggle
2020-10-05 21:02:25,525 192.168.1.227 resp 200 in 332ms http://192.168.1.208/toggle
2020-10-05 21:02:25,892 192.168.1.227 resp 200 in 358ms http://192.168.1.208/toggle
2020-10-05 21:02:26,233 192.168.1.227 resp 200 in 337ms http://192.168.1.208/toggle
2020-10-05 21:02:33,034 192.168.1.227 resp 200 in 354ms http://192.168.1.208/toggle
2020-10-05 21:02:37,449 192.168.1.227 resp 200 in 332ms http://192.168.1.208/toggle

I press only 3 times and was waiting approx 5 seconds between each press.

Thanks

PS: I have 2 bridges.

@Andrew-Brock
Copy link

That sure looks like the 5s debounce isn't working properly. I'll have a proper look at it in the next day or 2 to see if I can figure out what is going on.

@brokeh brokeh closed this as completed in 5a3717e Oct 11, 2020
@brokeh brokeh reopened this Oct 11, 2020
@brokeh
Copy link
Owner

brokeh commented Oct 11, 2020

I think this should be fixed in the latest version. I only have a single bridge to test with, but tried to guess what would be happening.

If it still isn't resolved in the latest version then please run it with with python pophttp.py -vvvv which will print out all messages recived and provide the logs here so I can make a test case to replay the exact scenario.

@MickiCH
Copy link
Author

MickiCH commented Oct 20, 2020

Thanks for the update. It did fix the issue so far. I will continue to test, but one thing that I keep doing is when I do double-press the response is sometimes like a single press. If you tell me that is purely beeing doing by the logitech device then it is me beeing unable to press double correctly:).

I just wanted to post some logs here - it keeps sending all of these lines from the two devices I guess:

`/opt/pophttp# python pophttp.py -vvvv
Server started on on 0.0.0.0
2020-10-20 12:35:01,698 192.168.1.227 recv Light_Get() (header(size=36, protocol_and_flags=13312, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=243, timestamp=0, code=101, reserved=0))
2020-10-20 12:35:01,698 192.168.1.227 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2020-10-20 12:35:01,712 192.168.1.227 recv Device_GetVersion() (header(size=36, protocol_and_flags=13312, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=244, timestamp=0, code=32, reserved=0))
2020-10-20 12:35:01,712 192.168.1.227 send Device_StateVersion(vendor=1, product=36, version=0)
2020-10-20 12:35:01,739 192.168.1.227 recv Light_Get() (header(size=36, protocol_and_flags=13312, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=243, timestamp=0, code=101, reserved=0))
2020-10-20 12:35:01,739 192.168.1.227 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2020-10-20 12:35:01,740 192.168.1.227 recv Device_GetVersion() (header(size=36, protocol_and_flags=13312, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=244, timestamp=0, code=32, reserved=0))
2020-10-20 12:35:01,740 192.168.1.227 send Device_StateVersion(vendor=1, product=36, version=0)
2020-10-20 12:35:01,787 192.168.1.227 recv Light_Get() (header(size=36, protocol_and_flags=13312, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=243, timestamp=0, code=101, reserved=0))
2020-10-20 12:35:01,787 192.168.1.227 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2020-10-20 12:35:01,789 192.168.1.227 recv Device_GetVersion() (header(size=36, protocol_and_flags=13312, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=244, timestamp=0, code=32, reserved=0))
2020-10-20 12:35:01,789 192.168.1.227 send Device_StateVersion(vendor=1, product=36, version=0)

2020-10-20 12:35:03,445 192.168.1.229 recv Light_Get() (header(size=36, protocol_and_flags=13312, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=213, timestamp=0, code=101, reserved=0))
2020-10-20 12:35:03,445 192.168.1.229 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2020-10-20 12:35:03,446 192.168.1.229 recv Device_GetVersion() (header(size=36, protocol_and_flags=13312, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=214, timestamp=0, code=32, reserved=0))
2020-10-20 12:35:03,446 192.168.1.229 send Device_StateVersion(vendor=1, product=36, version=0)
2020-10-20 12:35:03,505 192.168.1.229 recv Light_Get() (header(size=36, protocol_and_flags=13312, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=213, timestamp=0, code=101, reserved=0))
2020-10-20 12:35:03,505 192.168.1.229 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2020-10-20 12:35:03,507 192.168.1.229 recv Device_GetVersion() (header(size=36, protocol_and_flags=13312, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=214, timestamp=0, code=32, reserved=0))
2020-10-20 12:35:03,507 192.168.1.229 send Device_StateVersion(vendor=1, product=36, version=0)
2020-10-20 12:35:03,557 192.168.1.229 recv Light_Get() (header(size=36, protocol_and_flags=13312, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=213, timestamp=0, code=101, reserved=0))
2020-10-20 12:35:03,557 192.168.1.229 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2020-10-20 12:35:03,558 192.168.1.229 recv Device_GetVersion() (header(size=36, protocol_and_flags=13312, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=214, timestamp=0, code=32, reserved=0))
2020-10-20 12:35:03,558 192.168.1.229 send Device_StateVersion(vendor=1, product=36, version=0)
2020-10-20 12:35:05,446 192.168.1.229 recv Light_SetPower(level=65535, duration=1000) (header(size=42, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=215, timestamp=0, code=117, reserved=0))
2020-10-20 12:35:05,446 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:05,446 192.168.1.229 recv Light_SetColor(stream=0, hue=3407, saturation=17936, brightness=33542, kelvin=3612, duration=1000) (header(size=49, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=216, timestamp=0, code=102, reserved=0))
2020-10-20 12:35:05,447 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:05,570 192.168.1.229 resp 200 in 122ms http://192.168.1.220/toggle
2020-10-20 12:35:05,571 192.168.1.229 recv Light_SetPower(level=65535, duration=1000) (header(size=42, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=215, timestamp=0, code=117, reserved=0))
2020-10-20 12:35:05,571 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:05,571 192.168.1.229 recv Light_SetColor(stream=0, hue=3407, saturation=17936, brightness=33542, kelvin=3612, duration=1000) (header(size=49, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=216, timestamp=0, code=102, reserved=0))
2020-10-20 12:35:05,572 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:05,591 192.168.1.229 recv Light_SetPower(level=65535, duration=1000) (header(size=42, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=215, timestamp=0, code=117, reserved=0))
2020-10-20 12:35:05,592 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:05,593 192.168.1.229 recv Light_SetColor(stream=0, hue=3407, saturation=17936, brightness=33542, kelvin=3612, duration=1000) (header(size=49, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=216, timestamp=0, code=102, reserved=0))
2020-10-20 12:35:05,593 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:05,735 192.168.1.229 recv Light_SetPower(level=65535, duration=1000) (header(size=42, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=215, timestamp=0, code=117, reserved=0))
2020-10-20 12:35:05,735 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:05,736 192.168.1.229 recv Light_SetColor(stream=0, hue=3407, saturation=17936, brightness=33542, kelvin=3612, duration=1000) (header(size=49, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=216, timestamp=0, code=102, reserved=0))
2020-10-20 12:35:05,736 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:05,987 192.168.1.229 recv Light_SetPower(level=65535, duration=1000) (header(size=42, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=215, timestamp=0, code=117, reserved=0))
2020-10-20 12:35:05,988 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:05,988 192.168.1.229 recv Light_SetColor(stream=0, hue=3407, saturation=17936, brightness=33542, kelvin=3612, duration=1000) (header(size=49, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=216, timestamp=0, code=102, reserved=0))
2020-10-20 12:35:05,989 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:06,743 192.168.1.229 recv Light_SetPower(level=65535, duration=1000) (header(size=42, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=215, timestamp=0, code=117, reserved=0))
2020-10-20 12:35:06,743 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:06,743 192.168.1.229 recv Light_SetColor(stream=0, hue=3407, saturation=17936, brightness=33542, kelvin=3612, duration=1000) (header(size=49, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=216, timestamp=0, code=102, reserved=0))
2020-10-20 12:35:06,744 192.168.1.229 send Device_Acknowledgment()

2020-10-20 12:35:06,861 192.168.1.227 recv Light_Get() (header(size=36, protocol_and_flags=13312, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=245, timestamp=0, code=101, reserved=0))
2020-10-20 12:35:06,861 192.168.1.227 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2020-10-20 12:35:06,862 192.168.1.227 recv Device_GetVersion() (header(size=36, protocol_and_flags=13312, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=246, timestamp=0, code=32, reserved=0))
2020-10-20 12:35:06,862 192.168.1.227 send Device_StateVersion(vendor=1, product=36, version=0)
2020-10-20 12:35:06,910 192.168.1.227 recv Light_Get() (header(size=36, protocol_and_flags=13312, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=245, timestamp=0, code=101, reserved=0))
2020-10-20 12:35:06,910 192.168.1.227 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2020-10-20 12:35:06,916 192.168.1.227 recv Device_GetVersion() (header(size=36, protocol_and_flags=13312, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=246, timestamp=0, code=32, reserved=0))
2020-10-20 12:35:06,917 192.168.1.227 send Device_StateVersion(vendor=1, product=36, version=0)
2020-10-20 12:35:06,974 192.168.1.227 recv Light_Get() (header(size=36, protocol_and_flags=13312, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=245, timestamp=0, code=101, reserved=0))
2020-10-20 12:35:06,975 192.168.1.227 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2020-10-20 12:35:06,976 192.168.1.227 recv Device_GetVersion() (header(size=36, protocol_and_flags=13312, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=246, timestamp=0, code=32, reserved=0))
2020-10-20 12:35:06,976 192.168.1.227 send Device_StateVersion(vendor=1, product=36, version=0)

2020-10-20 12:35:07,484 192.168.1.229 recv Light_SetPower(level=65535, duration=1000) (header(size=42, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=215, timestamp=0, code=117, reserved=0))
2020-10-20 12:35:07,484 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:07,485 192.168.1.229 recv Light_SetColor(stream=0, hue=3407, saturation=17936, brightness=33542, kelvin=3612, duration=1000) (header(size=49, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=216, timestamp=0, code=102, reserved=0))
2020-10-20 12:35:07,486 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:08,474 192.168.1.229 recv Light_SetPower(level=65535, duration=1000) (header(size=42, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=217, timestamp=0, code=117, reserved=0))
2020-10-20 12:35:08,474 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:08,475 192.168.1.229 recv Light_SetColor(stream=0, hue=3495, saturation=37659, brightness=33542, kelvin=3612, duration=1000) (header(size=49, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=218, timestamp=0, code=102, reserved=0))
2020-10-20 12:35:08,475 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:08,512 192.168.1.229 recv Light_SetPower(level=65535, duration=1000) (header(size=42, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=217, timestamp=0, code=117, reserved=0))
2020-10-20 12:35:08,512 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:08,628 192.168.1.229 resp 200 in 114ms http://192.168.1.124/toggle
2020-10-20 12:35:08,628 192.168.1.229 recv Light_SetColor(stream=0, hue=3495, saturation=37659, brightness=33542, kelvin=3612, duration=1000) (header(size=49, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=218, timestamp=0, code=102, reserved=0))
2020-10-20 12:35:08,629 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:08,629 192.168.1.229 recv Light_SetPower(level=65535, duration=1000) (header(size=42, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=217, timestamp=0, code=117, reserved=0))
2020-10-20 12:35:08,629 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:08,630 192.168.1.229 recv Light_SetColor(stream=0, hue=3495, saturation=37659, brightness=33542, kelvin=3612, duration=1000) (header(size=49, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=218, timestamp=0, code=102, reserved=0))
2020-10-20 12:35:08,630 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:09,101 192.168.1.229 recv Light_SetPower(level=65535, duration=1000) (header(size=42, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=217, timestamp=0, code=117, reserved=0))
2020-10-20 12:35:09,102 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:09,102 192.168.1.229 recv Light_SetColor(stream=0, hue=3495, saturation=37659, brightness=33542, kelvin=3612, duration=1000) (header(size=49, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=218, timestamp=0, code=102, reserved=0))
2020-10-20 12:35:09,103 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:09,322 192.168.1.229 recv Light_SetPower(level=65535, duration=1000) (header(size=42, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=217, timestamp=0, code=117, reserved=0))
2020-10-20 12:35:09,323 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:09,323 192.168.1.229 recv Light_SetColor(stream=0, hue=3495, saturation=37659, brightness=33542, kelvin=3612, duration=1000) (header(size=49, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=218, timestamp=0, code=102, reserved=0))
2020-10-20 12:35:09,323 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:09,801 192.168.1.229 recv Light_SetPower(level=65535, duration=1000) (header(size=42, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=217, timestamp=0, code=117, reserved=0))
2020-10-20 12:35:09,802 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:09,803 192.168.1.229 recv Light_SetColor(stream=0, hue=3495, saturation=37659, brightness=33542, kelvin=3612, duration=1000) (header(size=49, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=218, timestamp=0, code=102, reserved=0))
2020-10-20 12:35:09,803 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:10,397 192.168.1.229 recv Light_SetPower(level=65535, duration=1000) (header(size=42, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=219, timestamp=0, code=117, reserved=0))
2020-10-20 12:35:10,397 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:10,397 192.168.1.229 recv Light_SetColor(stream=0, hue=3407, saturation=17936, brightness=33542, kelvin=3612, duration=1000) (header(size=49, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=220, timestamp=0, code=102, reserved=0))
2020-10-20 12:35:10,398 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:10,442 192.168.1.229 recv Light_SetPower(level=65535, duration=1000) (header(size=42, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=219, timestamp=0, code=117, reserved=0))
2020-10-20 12:35:10,442 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:10,780 192.168.1.229 resp 200 in 337ms http://192.168.1.220/toggle
2020-10-20 12:35:10,780 192.168.1.229 recv Light_SetColor(stream=0, hue=3407, saturation=17936, brightness=33542, kelvin=3612, duration=1000) (header(size=49, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=220, timestamp=0, code=102, reserved=0))
2020-10-20 12:35:10,781 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:10,781 192.168.1.229 recv Light_SetPower(level=65535, duration=1000) (header(size=42, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=219, timestamp=0, code=117, reserved=0))
2020-10-20 12:35:10,781 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:10,782 192.168.1.229 recv Light_SetColor(stream=0, hue=3407, saturation=17936, brightness=33542, kelvin=3612, duration=1000) (header(size=49, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=220, timestamp=0, code=102, reserved=0))
2020-10-20 12:35:10,782 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:10,782 192.168.1.229 recv Light_SetPower(level=65535, duration=1000) (header(size=42, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=219, timestamp=0, code=117, reserved=0))
2020-10-20 12:35:10,783 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:10,783 192.168.1.229 recv Light_SetColor(stream=0, hue=3407, saturation=17936, brightness=33542, kelvin=3612, duration=1000) (header(size=49, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=220, timestamp=0, code=102, reserved=0))
2020-10-20 12:35:10,783 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:10,885 192.168.1.229 recv Light_SetPower(level=65535, duration=1000) (header(size=42, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=219, timestamp=0, code=117, reserved=0))
2020-10-20 12:35:10,886 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:10,889 192.168.1.229 recv Light_SetColor(stream=0, hue=3407, saturation=17936, brightness=33542, kelvin=3612, duration=1000) (header(size=49, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=220, timestamp=0, code=102, reserved=0))
2020-10-20 12:35:10,890 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:11,259 192.168.1.229 recv Light_SetPower(level=65535, duration=1000) (header(size=42, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=219, timestamp=0, code=117, reserved=0))
2020-10-20 12:35:11,259 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:11,259 192.168.1.229 recv Light_SetColor(stream=0, hue=3407, saturation=17936, brightness=33542, kelvin=3612, duration=1000) (header(size=49, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=220, timestamp=0, code=102, reserved=0))
2020-10-20 12:35:11,260 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:12,098 192.168.1.229 recv Light_SetPower(level=65535, duration=1000) (header(size=42, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=219, timestamp=0, code=117, reserved=0))
2020-10-20 12:35:12,098 192.168.1.229 send Device_Acknowledgment()
2020-10-20 12:35:12,099 192.168.1.229 recv Light_SetColor(stream=0, hue=3407, saturation=17936, brightness=33542, kelvin=3612, duration=1000) (header(size=49, protocol_and_flags=5120, source=1768386412, target='\x00\x00\x00\x00\x00\x00\x00\x00', site='\x00\x00\x00\x00\x00\x00', acknowledge=2, sequence=220, timestamp=0, code=102, reserved=0))
2020-10-20 12:35:12,099 192.168.1.229 send Device_Acknowledgment()

^CTraceback (most recent call last):
File "pophttp.py", line 258, in
server_loop(config.interface, MessageHandler(config))
File "pophttp.py", line 125, in server_loop
data, address = sock.recvfrom(4096)
KeyboardInterrupt

`

Thanks

@brokeh
Copy link
Owner

brokeh commented Oct 20, 2020

When you say when I do double-press the response is sometimes like a single press, do you mean 2 quick presses of the pop button to trigger the double press action, or do you mean that you press it once, the light turns on, then you press it again only a second or 2 later to turn the light off again?

If it is the former, then that is entirely the pop button itself that detects the single/double/long press action and outside of my control. You can test this from the Logitech POP app by going to the Control tab and double tapping the virtual button in question in the app. It should show 2 dots on the button indicating that it detected the double tap on your phone and you can then verify that this pophttp is working as expected. I've noticed with my pop buttons that 2 very quick presses is registered as one, and that you have to have a short pause between the 2 presses.

If it is the latter then there is presumably still a usability issue with the script.

@MickiCH
Copy link
Author

MickiCH commented Nov 22, 2020

Hi, just wanted to say yes I tried with the App and I think it is really a usability issue on my side. With the App all commands send are perfectly translated in the pophttp tool - thanks.

So probably why sometimes the button press is not recorded is purely on the button - received side, outside of your command. I still think the button look great, just sometimes it seems the connect to the hub is not always maintained. You have no hacked or found any way to the hubs to optimize settings?

Else I just wanted to say - thanks for the great work.

@brokeh
Copy link
Owner

brokeh commented Nov 23, 2020

I had issues previously when the pop bridge was too far away from the buttons (about 8m / 26ft, going through a floor and a wall or a few walls) but moving the button to the middle of my house resolved it for me so it is now no more than 6m / 20ft away and no more than 1 wall.
Besides that I've had no issues so haven't done any tinkering.

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

3 participants