Automating "unsmart" IR devices

Hi @yekezei,
Yes, it is plug and play. Just plug the module on top of the GPIOs of your Pi and that’s it!

@iantrich, this was the most difficult part for me so I struggled a lot and am not sure I did something really clean. It was a while ago so I only remember the overall idea: I stored locally all the images as png and then modified the html config file to display the associated image for each function.
I will check my config when I’m at home and will try to share some further inputs.

@Claire, thanks. I’m starting to think that a custom panel or a custom more dialog, if that is possible, is more what I need. I want more of a universal remote, rather than many virtual remotes. I also have an issue where my TV remote is able to control my Fire TV for everything except for the home button, so that would have to be emulated by other means.

I would still be very curious to see how you achieved your layout, however, and might be able to apply it to a custom HA element.

Thanks.

Sorry, I have not been able to work on my HA setup for a while. Hope that my answer can still be helpful in some way.
I only customised lirc_web as follows:

  • In the config file of lirc_web (lirc_web/config.json), I have assigned label names to each remote key. The remote keys names are specified when you configure your remotes with lirc in the conf files in /etc/lirc.
  • There is a static directory in which the fonts, css… are stored. I have stored images under a subdirectory called images. Therefore, the path to this directory is lirc_web/static/images. Each image has the same name as the corresponding label as defined in the config file and is in png format.
  • I have modified the template used by lirc_web for the HTML page to reflect my configuration, adding the image as a source for the button. The template is located there: lirc_web/templates/index.swig.
    Here is the command I have used:
`{% for command in remote %}
       <li class="command" style="display:inline-block;width:33%;text-align:center;margin-bottom:1px;margin-top:1px;">
         <button class="image-button {% if repeaters[remoteName][command] %}command-repeater{% else %}command-once{% endif %} btn btn-key"$
         <img src="images/{{ labelForCommand(remoteName, command) }}.png" class="img-fluid" style="background-color:white;" />
         </button>
       </il>
  {% endfor %}`

I don’t know if it is clear. I have no knowledge in html or css. I figured it out after a huge amount of time browsing on the Internet and trying many different configurations.
This might not be the best approach but it suits me so I’ve left it like that.

Here are the two files from my configuration, as example:
index.swig
config.json

Regarding that mention of a photoresistor to check if device is switched on or off.

Has anyone gotten one to work? Mine only changes states when I physically unplug it…

I think a current sensor would be much more reliable.

Great guide. I started this around 8pm and was finished at around midnight, was very easy to do, the hardest part was just waiting for the node.js compile.

I have an IR transmitter led controlling the living room tv and a mirror behind it bouncing to the Warmoon LED RGB color changing light I got from an Amazon deal yesterday. I saw it had a remote and had to get it to add to the smart house and HA!

Great! Very happy to hear you were able to set it up so fast!
I like the mirror idea :slight_smile:

I had the same problem as you (being able to control my Fire TV through HDMI CEC except for the home button). I was able to resolve this problem, by changing my TV’s device settings to include tuning and menu keys (I think it was just tuning before).

I’m surprised there isn’t more information on the web about this, I can’t believe we’re the only ones who wanted to be able to control every aspect of our Fire TVs (including volume!) from our phones (because I always have it with me).

@Claire - Thanks so much for sharing your web configs. I just set this up last night and am currently stuck with the default look. It’ll be nice to have your stuff to use as an example.

Is it possible to do this with any IR blaster?
I have a Broadlink RM Pro set up in home assistant and would like to create a combined layout for my remotes just as you have Claire.

Just as a note i followed this and it worked fine up until a few days ago when i update my HASS, now i get
ERROR (MainThread) [homeassistant.components.switch.rest] Got non-ok response from resource: 404
when starting HASS and my buttons don’t seem to work. This is the link to the github issue.
https://github.com/home-assistant/home-assistant/issues/7431#issuecomment-300200710

Just thought I’d mention: as a temporary fix, you can patch your local switch/rest.py component by commenting out the return False on line 66 (https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/switch/rest.py#L66)
Having done that, I’m able to use my LIRC resources fine.

1 Like

Perfect, i commented out that line and it now shows up.

Hello,

Sorry newbie here, how does one comment out the “return false” as I have tried using the restful switch to no avail. Also tried commenting out the line 66 as suggested, but I can’t seem to get my restful switch to show up and it gives me an error in the info tab.

Please help as I have been on this for over a week and I can’t seem to find a solution I understand.

Regards

Better late than never…
Uploaded my config on Github, here: https://github.com/CTarel/lirc_web
You will find two main directories there: one with my Lirc config and the other one with my lirc_web custo.
I hope this can help you, and others, to finalize your setup.

Can i make it with a broadlink?

Not sure it is the best approach with a Broadlink device considering that it is already a universal remote control in itself.
There probably are some better ways to connect HA and your Broadlink device. For instance, searching very quickly on Google, it seems that there are some MQTT-Broadlink bridges that could fit your need. Indeed, sending MQTT commands from HA to your Broadlink might serve your needs.
If you could tell me which Broadlink device you have and what are your use cases, I can have a further look and let you know

‘Fail to initialize’ issue, as linked by @cooljimy84 above is still present. Those of us running Hass.IO are unable to edit system files, as ssh does not provide root access.
Is there another workaround, or any progress on this issue?
Thanks

I hit this issue today but went for a slightly different approach to fix it, namely running an nginx reverse proxy that rewrites the get requests to returns a http status code of 200 for all get requests. Put requests aren’t touched, so the api still works as standard, only difference is that HASS doesn’t complain now!

Configure I used was:

server {
    listen80;
    server_name"";

# Change this to the location you installed lirc_web
    root/opt/nodejs/lib/node_modules/lirc_web;
    indexindex.html index.htm;

access_log/var/log/open-source-universal-remote.nginx.log;

location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;

proxy_pass http://127.0.0.1:3000/;
proxy_redirect off;

if ($request_method = GET) {
return 200;
}
    }
}

Hope that helps!

I just want to say I approached this much the same way but ended up using the hass UI along with custom-ui-tiles to control my remote. I built some really nice looking remotes even. have a look at my repo if you need ideas for how to do it.

5 Likes