Actually, that’s not quite it; I’m trying to get it to learn the four colored buttons on my remote, but it seems to be picking up the same code regardless of which button is pressed.
Those codes you posted are all different though:
R: Received Sony: data=0x000052E9, nbits=15
G: Received Sony: data=0x000032E9, nbits=15
Y: Received Sony: data=0x000072E9, nbits=15
B: Received Sony: data=0x000012E9, nbits=15
The example I posted above are just the Sony ones, since it’s easier to show the difference. However even the Pronto data is unique per button.
Hello
Yes I’m ok with that.
but what I want is start script on key press. So I’m using HAIR and the Sniffer TAB. in this app only pronto codes are aviable.
Do you know how can those sony codes can start my automation ?
This part here should give you a sensor in ESP-Home that is sent to HA.
When sensor is on you pressed a button, trigger your automation on this sensor.
HAIR dev here. @ShadowFist has it right on both counts: the four buttons are sending genuinely different codes, and the collapse is a HAIR issue, the same one tracked in GitHub issue #43. Thanks for the logs @loic.gouraud, they made this diagnosable, and no need to open a separate issue – this thread is linked from the tracking.
What’s happening, short version: HAIR identifies a signal by classifying each IR pulse as short or long. Sony remotes encode their bits in pulse widths that both land below HAIR’s short/long cutoff, so every button on a Sony remote tends to read as the same coarse pattern. HAIR keeps a finer byte-level identity underneath (which is why the Sniffer can still show separate rows), but triggers currently match on the coarse pattern only. So to answer your question directly: triggers are exactly the HAIR feature meant to start your scripts on key press (each trigger becomes an event entity your automations listen to), and they’re precisely what this bug breaks for Sony remotes. A trigger made for the red button today would fire for all four.
The fix is scoped and has been through review: triggers and the matcher learn to use the finer identity. It’s targeted for the next release, and I’ll post back here when it’s out. Longer term, Sony decoding goes into the shared infrared-protocols library HA bundles, which gives Sony remotes the same first-class treatment NEC remotes have today. Your logs are good test data for both, thank you.
Until then, two practical notes. I’d hold off assigning any of the four signals to a HAIR device command (assigning one currently makes the other three match it). And @Hellis81’s suggestion is a solid interim: an ESPHome binary_sensor with on_sony per code (0x52E9 / 0x32E9 / 0x72E9 / 0x12E9) gives you four sensors to trigger on today, and nothing about the HAIR fix will conflict with it later. Also, to reassure on one point: the Test button just transmits the code back out of your Athom, so with a broken TV there’s nothing to verify against, and for your use case you don’t need transmit at all.
Following up: this is fixed in HAIR v0.5.8, released today.
Your four colored buttons each drive their own trigger now. Two things needed fixing, and your hardware found both. The first was the one I described above. Triggers only looked at the coarse short/long pattern, which all the buttons on your remote share, so one trigger fired for every button. Triggers now match on the byte-level identity underneath, which the Sniffer was already using to keep your buttons apart.
The second surfaced on my own bench while validating the first. Sony’s long pulse sits right at the short/long cutoff, so the same button can read as a different coarse pattern from one capture to the next. With only the first fix in place, some of your buttons would have triggered reliably and others would not. Every identity check in HAIR now falls back through decoded protocol, then byte-level identity, then the coarse pattern, and the byte-level layer is stable across that wobble.
Also, the captures you posted from your ESPHome logs are now test fixtures in HAIR’s suite, so this area stays covered going forward. Thank you for those.
The proper cure is a Sony SIRC decoder upstream in infrared-protocols, which would also improve transmit fidelity. That is still on my list, and HAIR will pick it up automatically when it lands.
Edit it seems your logs is saying turned off.
Perhaps it’s inverted.
Not sure if that means you need to invert the IR receiver or if you can just invert the binary sensor.
v0.6.0 is out and it is built around what you found.
HAIR now decodes Sony remotes properly instead of comparing waveform shapes, so a short tap, a held press, and a jittery capture of the same button all resolve to one signal row. Your twelve rows case is the exact test we built against, and your captures from this thread are permanent test fixtures in HAIR now, so this cannot quietly regress without failing the build.
After you update through HACS and restart, your existing catalog should clean itself up: the split rows merge into one row per button at startup, keeping nicknames and hit counts. From there the four colored buttons should each hold a stable identity you can hang triggers on, which was your original goal, and the ESPHome sensor workaround stops being necessary.
A note on the philosophy, since it changed with this release: the plan was always to rely on Home Assistant’s shared protocol library, but the library decodes very few protocols today and that gap was hurting people. So the decoders now live in HAIR, written in the library’s style, and each is headed upstream as a pull request. When a Home Assistant release ships a library that can decode Sony itself, HAIR steps aside for it automatically.
Please let me know how the update lands on your setup.