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

Two Wizmote simultaneosly #4

Open
hirkkak opened this issue Jun 21, 2022 · 12 comments
Open

Two Wizmote simultaneosly #4

hirkkak opened this issue Jun 21, 2022 · 12 comments

Comments

@hirkkak
Copy link

hirkkak commented Jun 21, 2022

Hello, Congratulations for your work, first of all.

I had a wizmote controller and it has been very useful for me to make it work with HA. The fact is that I decided to buy a second controller to have the same functions twice. But it only works when I put the MAC field, which also doesn't support multiple values (or I don't know how to put them). And if I don't fill it, only the first wizmote works. Is there any solution for this? Is there a way to make both work simultaneously?.

Greetings and thank you very much!

EDIT:
After some more testing, the new controller no longer works.
No event is heard (using developer options)
Neither esphome.wizmote_choose nor esphome.wizmote_action
But if both events are shown in the esphome log

Off button of the remote that not works.
[01:10:07][D][esp_now:071]: mac: 6C.29.90.0D.6A.1E (6), data: 81.E3.02.00.00.20.02.01.57.4F.72.5F.E5 (13)

Off button of the remote that works.
[01:10:50][D][esp_now:071]: mac: 6C.29.90.06.0D.AE (6), data: 81.DA.05.00.00.20.02.01.54.6C.E3.F7.B9 (13)

EDIT2: The new controller randomly works(some days it works and other days it doesn't). How can i debug it?

@jesserockz
Copy link
Owner

The blueprint is only set up for a single remote. You need to set up two automations from the blueprint, or you could modify the blueprint to support multiple remotes.

As for you other issue, I am not too sure. The logs you are seeing above are showing that the remote is sending and ESPHome is receiving correctly.

@matqua
Copy link

matqua commented Jul 9, 2022

I think it is to do with last_sequence being shared amongst all on_esp_now_message calls rather than saving the last_sequence per remote mac address.

Whichever message (remote) has the highest wizmote.sequence number will trigger wizmote on_button.

I have two remote here and only one usually fires events into home assistant yet both remotes are being seen in the esphome logs.

If I keep clicking the non-responsive remote enough times to have a higher sequence number, it will begin to function then the other remote will fail until its sequence number is the highest. This probably explains the behavior @hirkkak is seeing.

@hirkkak
Copy link
Author

hirkkak commented Jul 9, 2022

I discovered that new remote works only when i reboot HA, until i use any button on the old one.
Then only works the first one until i reboot HA again.

I tried to use same button on the old one for about 100 times, but didn`t work. Any idea?

@matqua
Copy link

matqua commented Jul 9, 2022

I think you may need to press the buttons on the new remote many more times. This will not solve the issue but will confirm it is the same one I have observed.

Could you press the number 1 on each remote and post the esphome log output here?

@hirkkak
Copy link
Author

hirkkak commented Jul 12, 2022

Hi, here is the conclusion.

Button 3, on Working Wiz1 Remote:
[00:39:19][D][esp_now:071]: mac: 6C.29.90.06.0D.AE (6), data: 81.65.06.00.00.20.12.01.54.EF.1E.84.B5 (13)

Button 3, on NON Working Wiz2 Remote:
[00:39:52][D][esp_now:071]: mac: 6C.29.90.0D.6A.1E (6), data: 81.8C.04.00.00.20.12.01.47.17.9E.64.53 (13)

Button 3, on NON Working Wiz2 remote after about 100 clicks.
[00:41:03][D][esp_now:071]: mac: 6C.29.90.0D.6A.1E (6), data: 81.F7.04.00.00.20.12.01.50.BB.93.34.33 (13)

Buttton 3, on WORKING Wiz1:
[00:41:40][D][esp_now:071]: mac: 6C.29.90.06.0D.AE (6), data: 81.66.06.00.00.20.12.01.54.16.CD.0E.DB (13)

Button 3, on NON Working Wiz2 remote after thousands clicks.
[00:45:44][D][esp_now:071]: mac: 6C.29.90.0D.6A.1E (6), data: 81.65.06.00.00.20.12.01.48.4A.A6.9D.10 (13)

Button 3, on WORKING Wiz2 remote after thousands clicks + 2.
[00:46:14][D][esp_now:071]: mac: 6C.29.90.0D.6A.1E (6), data: 81.67.06.00.00.20.12.01.51.6E.F0.FB.20 (13)

So you are right. The highest one, wins!!

Now, if i click 3 times on wiz 1, have to click other 3 on wiz2 to get working and vice versa

The question is? There is some magical and extra easy solution? ;-)

Thx in advance for all, and sorry for delay, away from home.

@hirkkak
Copy link
Author

hirkkak commented Jul 16, 2022

Hi i replaced '<=' by '==' it seem works perfectly on wizmote.cpp

void WizMoteListener::on_esp_now_message(esp_now::ESPNowPacket packet) {
WizMotePacket wizmote = WizMotePacket::build(packet);
//if (wizmote.sequence <= this->last_sequence_)
if (wizmote.sequence == this->last_sequence_)
return;

this->last_sequence_ = wizmote.sequence;
this->on_button_->trigger(wizmote);
}

@jesserockz
Copy link
Owner

Ah sorry, I misunderstood your original issue. Yeah this makes perfect sense that the sequence needs to be unique per remote mac. I will try make some time to fix this.

@spencerthayer
Copy link

@jesserockz was this ever corrected?

@bbass101
Copy link

It doesn't look like the change from @hirkkak was ever pushed, but I went and made it myself and can confirm both of my WIZ remotes now work correctly.

@spencerthayer
Copy link

Off topic, and pardon my ignorance but does one need a ESP32 board dedicated to capture the wizmote packets or can Home Assistant's ESPHome do that by itself? @bbass101

@jonofmac
Copy link
Contributor

jonofmac commented Apr 5, 2023

I forked the repo and added the fix listed above by @hirkkak and updated the blueprint to support multiple remotes. There is an issue with it: If multiple remotes have a button pressed at the same time, it will appear that the buttons were pressed multiple times. #9

I have an idea on how to better fix it, but it will have a limitation on how many remotes it can support...

Edit: I updated my fork with my idea of a fix. Added an array that fixes the bug I mentioned earlier. Now it supports up to 15 remotes without the multiple button press issues I mentioned. Not the most elegant solution, but it works.

@kueblc
Copy link
Contributor

kueblc commented Jan 24, 2024

Looks like this issue and #14 can be closed as resolved.

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

7 participants