Roon Extension: macro.on

Hi Boris, at the moment it runs on a arm32v7 with Raspi. My aim was to use this Raspi for another project and switch the addons to that Mini-PC. But I see it’s not possible to run this (and other addons) on x86. With Proxmox it’s maybe possible to emulate arm on PC, but without subscription I can’t get the aarch package.

Oh sorry, I got that wrong… I will have a look!

1 Like

Hi @Matthias_Schwarz

Unfortunately there is no dotnet core runtime for linux-x86… so I’m not able to publish my extension for this architecture. Sorry…

Boris

Okay, no problem. Thanks for your investigation!

@Boris_Schaedler - Hello Boris, any reason a port mapping would not work? I have this on a macvlan with its own IP address so no collision issues - in my compose file I attempted to map port 80 to 8180 - no joy…

version: ‘3.3’
services:
roon-extension-macroon:
container_name: roonHRC_macro.on
networks:
macvlan_network:
ipv4_address: xxx.xxx.xxx.xxx
environment:
- TZ=America/Phoenix
volumes:
- ‘/volume1/docker/macro.on/data:/app/data’
restart: unless-stopped
image: bsc101/roon-extension-macroon:latest
ports:
- 80:8180
networks:
macvlan_network:
external:
name: mvlan_ent20

image

Hello @patrick_mccarthy
Are you sure a macvlan network and port mapping should work at the same time? I couldn’t get it to work either, and probably it is not meant to work together (that’s what I’ve found on the internet). May I ask what you are trying to achieve?
Boris

Hello @Boris_Schaedler - thank you for the reply.

A macvlan just allows me to subnet the network - all my entertainment devices are on a separate subnet. Roon, rheos, plex, and now your app are all docker images and using a macvlan. The other physical devices are on the same subnet so the apps can talk to each other and the . Since I am not sharing the same IP address on any device, they can each have their own ports at will.

With regard to the port mapping. Think of a scenario where one would use your tool on the HOST network as you designed, however, they are already using port 8180 for something else on the host, in this case, they would want to use docker to change it so on the “outside” they could use, say, port 8181 and on the “inside” send it to your port 8180.

Admittedly, I am not a guru on docker but I thought port mapping is just available (that is, nothing needs to be done inside the container to make it work), is there something in your code hardcoded to this port?

Thanks,
Patrick

As far as I know, Boris is correct that you can’t use port mapping if a container is on a macvlan with an assigned address.

@patrick_mccarthy - we have very similar setups with subnets, roon and other stuff in docker containers, etc. I’m now also running macro.on in a docker container (solves a tricky problem for me!). So I have the same issue you do which is that I’d prefer to not have to remember and use a custom port for macro.on (or any of the other containers I run).

The solution I use is a little complex but works very well. It’s based around a custom domain I have. It’s actually gtunes.com, but let’s say it is.

First thing is to install and run NGINX Proxy Manager (NPM), which I of course run in a container on my Synology alongside everything else. This: https://nginxproxymanager.com

Then set up DNS records for the hosts you want to access such as macroon.gtunes.com. Map those to the ip of the proxy you set up. Then you just configure the proxy to forward to the correct port of the correct IP.

So, in my case, I can how access http://macroon.gtunes.com. That hits port 80 on the proxy. The proxy sees that the site being requested is “macroon.gtunes.com” and knows to proxy those to port 8180 of the macroon container’s IP.

For extra credit, you can set up https access for the proxied sites, which is what I do. NPM makes this fairly easy to do if you’re using a DNS provider that NPM knows about.

I know this isn’t as simple as just declaring a port mapping in Docker, but it’s the only way I know how to do what you’re trying to do.

1 Like

thanks for the correction. Went out and read up on it - makes total sense, it’s a device on the network not a bridged item.

I was planning on using dns on the network anyway and I have pfsense running both dns and a reverse proxy to deal with a port translation for a few other items…

BTW, I haven’t tested the grouping feature in macro.on have you? I know you use rheos too – I havent had good luck with the rheos grouping so I do not use it…

Ah…sorry for the introductory lecture on reverse proxies :slight_smile:

I actually don’t have or use any RHEOS gear. I haven’t tried grouping with macro.on.

I’m currently trying to use it to solve a problem I have using Home Assistant and customized remote controls. Haven’t yet gotten it working but I should be able to. Macro.on works fine and I can initiate macros via request URLs…just haven’t been able to get Home Assistant to call them. I’ll figure it out, though. [Edit: Figured it out. Can now easily invoke macro.on macros from within Home Assistant]

Hey @gTunes and @patrick_mccarthy

thanks for your thoughts. It’s quite simple to use another port than the default 8180, just add two arguments at the end of the docker run command:

docker run ... bsc101/roon-extension-macroon:latest-amd64 --urls "http://*:8088"

Just found out today :wink: Replace the 8088 with the port you want to use. Let me know if it works.
Thanks!

Boris

This works perfectly. Thanks!

I specified port 80. I confirmed that macro.on is now listening on that port and also confirmed that the generated “Run URL” displayed for a macro is correct. Priori to this change, those urls included the default port. After this change, they display port (obviously port 80 is the default).

@patrick_mccarthy - probably obvious how to do this in a compose file, if that’s what you’re doing, but in case mine is helpful to you, here it is.

This is pretty specific to the type of network configuration that @patrick_mccarthy and I use which involves a vlan and a specified IP address rather than host networking, which is what most people should use.

version: '3.7'

services:
  macroon:
    environment:
      - TZ=America/Los_Angeles
      - URLS=http://*:80
    image: bsc101/roon-extension-macroon:latest-amd64
    container_name: macroon
    restart: unless-stopped
    volumes:
      - /volume1/docker/macroon/data:/app/data
    networks:
      macvlan_roon:
        ipv4_address: 192.168.50.50

networks:
    macvlan_roon:
      external: true
1 Like

@gTunes , @Boris_Schaedler - thank you both of you, this is awesome! Boris, thanks for the information and gTunes, thanks for giving me the compose format… was going to have to dig it out…

btw, i cheat all the time and use this: Composerize to quickly generate a compose from a run command…

I too am just starting home assistant and want to use this to map macros to buttons on a screen, or better yet, use my philips hue tap dial to start grouping and playlists (purchased these things then never used them).

I have delusions of grandeur for home assistant, just not enough time to tinker with it.

so for mapping HA to trigger macro.on, i suspect you can create a button that just calls the url?

Interesting. I don’t know that tool. When in doubt, I use chatGPT.

It’s a bit more complicated. You have to first create a “rest command” in your configuration.yaml. Something like this:

rest_command:
  rest_media_room_volume_step:
    url: "http://192.168.50.50:8180/api/v1/Macro/Run?id=94b939b8-5339-4579-b285-c79a231c9595"

Once you’ve done that, you can invoke it by name from an action like this:

- service: rest_command.rest_media_room_volume_step

I got tripped up on the need to do a full HA restart (not just a config reload) after adding the rest_command. Took a while to figure out why my rest commands weren’t being found.

In any case, once you have the rest_command set up you can trigger it however you like.

I’m actually working on a Blueprint for the Philips Hue Tap Dial. Blueprints are cool because once the author does the work to create one for a specific device, anyone can use them by basically filling out forms. The image below is from the Hue Tap Dial I’m working on. You essentially just identify the dial you want to use (once it’s provisioned for HA), pick the Roon zone, set a few more things, and go.

I’ll probably have it done by end of week. But to use it, you need to have HA, Zigbee2MQTT, and Mosquito Broker all up and running, and you may not be quite there yet :slight_smile: If you want to go deeper into any of this, feel free to start a thread or send me a DM.