Hi all, I’m looking for some help on an issue I’m having with a binary sensor. I’ve done some digging, but I’m totally new to HA and yaml, and there’s not a lot of Magiquest specific information / examples / posts. Thanks in advance for any and all help!
I’ve got the general implementation working for what I’m trying to accomplish: I have an ESP8266 with an IR receiver sending a binary sensor state into HA when my child’s Magiquest wand is waved at it, which I’m using to automate various smart devices and Alexa.
My problem comes in that the wand is so sensitive, it’s triggering all the time even when my child isn’t waving it at the IR sensor. The magiquest portion of Remote Receiver library includes the wand ID and a ‘magnitude’ value of the motion. I have a specific magnitude I’d like the binary sensor to also check for in addition to the wand ID. The wand ID is a required input, and with only the wand ID I have it working. The magnitude shows as optional in the Remote Receiver documentation. When I do add it though, it is still changing the state to True for any magnitude so long as the wand ID matches.
I tried looking more into the source code to no avail, but like I said I’m by no means an expert in any of this, just trying to setup something cool and fun for my child with his now otherwise useless wand. Am I doing something wrong here, is the functionality broken, is there another way I can accomplish this same task?
Relevant section of code, can post all of it if desired:
[23:32:00][D][binary_sensor:036]: 'Child 1 Wand': Sending state ON
[23:32:00][I][remote.magiquest:079]: Received MagiQuest: wand_id=0x028AA9CC, magnitude=0x092B
[23:32:02][D][binary_sensor:036]: 'Child 1 Wand': Sending state OFF
[23:32:02][D][binary_sensor:036]: 'Child 1 Wand': Sending state ON
[23:32:02][I][remote.magiquest:079]: Received MagiQuest: wand_id=0x028AA9CC, magnitude=0x0804
[23:32:04][I][remote.magiquest:079]: Received MagiQuest: wand_id=0x028AA9CC, magnitude=0x080C
[23:32:06][I][remote.magiquest:079]: Received MagiQuest: wand_id=0x028AA9CC, magnitude=0x0808
[23:32:07][I][remote.magiquest:079]: Received MagiQuest: wand_id=0x028AA9CC, magnitude=0x080C
[23:32:09][D][binary_sensor:036]: 'Child 1 Wand': Sending state OFF
[23:32:11][D][binary_sensor:036]: 'Child 1 Wand': Sending state ON
[23:32:11][I][remote.magiquest:079]: Received MagiQuest: wand_id=0x028AA9CC, magnitude=0x0C08
[23:32:13][D][binary_sensor:036]: 'Child 1 Wand': Sending state OFF
From the Remote Receiver documentation under the Binary Sensor portion:
magiquest: Trigger on a decoded MagiQuest wand remote code with the given wand ID.
wand_id (Required, int): The MagiQuest wand ID to trigger on, see dumper output for more info.
magnitude (Optional, int): The magnitude of swishes and swirls of the wand. If omitted, will match on any activation of the wand.
Do the magnitude hex values change based on both speed and direction?
Are you able to repeat the same movement multiple times and the magnitude stays a constant value?
You should probably try increasing the Tolerance to around 40% and try that and see how it works. You may even want to try increasing your filtering by also including the Idle configuration option and try bumping it up more than the default of 10ms.
This wand seems like it could have some potential if it detects speed and direction changes. You could create automations for all kinds of things like a clockwise circle and a different automation for a counter-clockwise circle and etc.
Even if its sitting absolutely still on the floor? Can you get it to output the same magnitude by repeating the same motions multiple times? Like, if its sitting on the floor and you roll it clockwise 2 revolutions and then counter-clockwise, will you get a duplicate output for each direction in the logs so that you can look at the log and tell which direction it rolled?
Please dont try deciding what is or isnt relevant to answering your questions, thats incredibly annoying when people do that and most of the time they dont even know what is relevant. Its better for the people trying to help you if they have all the details and can see the full picture and its even better for you because it helps filter out the random guessing people do and it lets you avoid answering people’s questions when they ask about specific details. When you post a question, you want people to respond with help/answers instead of flipping the script and now you’re the one answering questions from the people attempting to help you.
Its best for everyone involved if you include as much detail and information as possible so people can help you best.
@engnerd did you ever figure this out? I’m having the exact same issue. The wand triggers my IR sensor constantly, even when my kid isn’t pointing it anywhere towards the sensor! I’m shocked at how easily it triggers and I also felt that using a specific “magnitude” would be a good way to cut out some of the triggers. But, I have the same issue as you…even when adding the magnitude, it always triggers anyway. So either the documentation is wrong or the implementation.
I didn’t get too far with the code, but I did see that it assigns a default magnitude of 0xFFFF. But I don’t see in the code where that magnitude is used for filtering.
I noticed something similar and dove deep into it - turns out the protocol specification that the component was based on was updated after the fact and never pulled in to esphome so I’ve created a PR that does it.
Now the magnitude values actually make sense (although one of my wands doesn’t seem to send an entirely useful value - not sure if it’s a “newer wand thing” or a “broken wand thing”), and you can use them to filter out noisy triggers. Feel free to try it!
Note that this change does impact the wand_id values - you’ll need to update to get magnitude working because I’ve left handling in there for all existing scenarios to hopefully avoid any regression in existing uses.
Nice, I’ve updated to this PR and updated my wand_id and it seems to be working well. I’m seeing magnitudes of 1-6 and 258, plus a random 15 and 259. Do you know if there is any definition on what the magnitudes mean?
(comment also left on the GH pull request, but added here for additional visibility).
The following comment on this video is interesting:
"Magnitude" can be a bit of a misnomer in these libs. We designed the
game to have 3 cast types, flick which is like a chop, twirl which is a
spin, and hover which was triggered by an IR transmitter which fired
into the wand.
Ultimately this functionality went unused, with the game server
recognizing all 3 but treating them the same. Original wands generally
have the full sensors to allow this, but on the various clones
following the takeover your mileage can vary. Personally cannot confirm
if GWL is including them in the latest models like you have, esp since
they have used two manufacturers.
I haven’t played around with flick vs twirl to see if they do anything for my wands but if magnitude really is a cast type the threshold stuff I did in the PR most likely isn’t useful.