UFO-R11 HA help

Noob here.
I installed HA via HA.OVF over ESXi and I run a fairly new SMLIGHT HUB, a Linux Zigbee coordinator that natively runs Z2MQTT. So far so good, both work, I linked SMLIGHT Z2MQTT to HA MQTT broker and devices are visible.

Drunk on success, I added an UFO-R11, a zigbee to IR device which added quickly, but ran into an issue:

In Z2m-Zigbee Coordinator: Registered, no issues.
In Z2M: Device is listed, enters Learn mode, learns code, if pasted into “Send_code” it sends the code. 10/10.

In HA, I see the device (via MQTT integration), I see the learned_code but setting “CODE_TO_SEND” does nothing. The device doesn’t send anything. It only works one way so to speak. It will enter learn mode and will display the code I teach it, but won’t send.

Ideas?

There’s several ways to go about this if you research it, but I’ll share the way I do it.

I create a script -

alias: Family Room Fireplace Power
sequence:
  - data:
      payload: (learned code)
      topic: zigbee2mqtt/Family Room IR Blaster/set/ir_code_to_send
    action: mqtt.publish
mode: single
description: ""
icon: mdi:power

For me, this is the most flexible way to do it. Now, I can call the script as an action directly from a dashboard button and I can also call the script in automations.

For example, I can create an input_boolean helper, then create an automation, when it’s toggled it will call the script. This seemingly makes it feel like my electric fireplace now has an on/off switch.

I could do the same with a button helper, but I usually don’t because it’s just a button and won’t reflect a state of being on or off. YMMV

EDIT Another example, I could call the script in a routine automation. Maybe, whenever I enter my home zone and temperature is under a target, I’ll call the script. There’s a lot you can do with it is my point.

So what you’re saying, as far as I understand it, is to basically skip the UI and just use the HA as an MQTT client.

Right now I’m using
mosquitto_pub --url mqtt://u:[email protected]:1883/zigbee2mqtt/<UFO>/set -m "{`"ir_code_to_send`":`"<CODE>`"}"

which appears to work. (the backticks are because PowerShell)

By telling HA to do it, I could benefit from automation.

I wonder why it doesn’t work, it’s an MQTT SET endpoint. Is it a bug? Or am I just not understanding the basics (I am literally on day 1 of HA and MQTT)?

It’s a device, via MQTT, that publishes “ir_code_to_send”, a text variable. Why does setting the variable not produce a request?

You got to make sure you’re using the correct MQTT topic. Me, personally, prefer to use ir_code_to_send into my topic. Its always going to be zigbee/{friendly name of your ir blaster}/set. You don’t “have to” include ir_code_to_send at the end there, but again, I do.

I create the scripts in the GUI. Go to Settings > Automations & scenes > Scripts and click the + Create script button at the bottom right. You can build it right there inside HA. HA is my central commander in all things with my Smart Home. I don’t give any precendence to any other platform or ecosystem before HA.

If you’re trying to do this in CMD/Terminal/Powershell to test it, try this -

mosquitto_pub --url "mqtt://u:[email protected]:1883" -t "zigbee2mqtt/My_IR_Remote/set" -m '{"ir_code_to_send":"<code>"}'

But I am using ir_code_to_send in my topic. I’m using --url not -h, and URL syntax supports one-package syntax:

proto://user:pass@host:port/topic/device/set

I don’t need the explicit topic parameter.

Maybe I misspoke. It works with mosquitto_pub, it didn’t work with HA “set text”. I did the script and replaced device set text with mqtt topic and it works. I have marked this as solved, and I hope to eventually understand why SetText doesn’t work (aka via UI).

Ohhh… yea, maybe I misread that last comment. In any regard, that is weird. I just tested my ir_code_to_send input_text entity and it works with no issue.

If I put a code in the text field and hit “enter” on my keyboard, the command works. I can’t repeat the send though. I have to clear the text field out, hit enter, paste the code again, and hit enter. I can run different codes back-to-back though.

But I digress, these quirks are probably device specific. Turning each code into a script solves all my automation and helper woes, lol.

Also, something to test in your case, is the code itself. I’ve noticed with “stranger and cheaper” devices, especially one’s probably designed and assembled in a far away land, the remotes will actually use different codes each time the same command is sent. That’s what my fireplace does. I also have IR candles that do it, too. You want a code that works every time it’s sent. Maybe… relearn the code from the remote, see if it’s different (I can almost guarantee it will be), and test it in the input_text entity.