Home Assistant on off switch for Roon Rock
In case anyone is interested I’ve added a switch to my home assistant - which will turn on and off a Roon ROCK. I’ve set up an automation to turn mine off late at night - and turn back on early in the morning to try and save a little power.
This uses two home assistant integrations - neither of them roon specific! One allows you to send wake on lan packets - the other allows you to call rest services.
To send a wake on lan packet - you need to find the mac address of your ROCK/Nucleus. The easiest way to do this is via your router.
You should also set your ROCK to have a fixed IP address - again you should be able to do this in your router.
Then you can add the following to your home assistant configuration.yaml replacing the mac and ip addresses with your own.
switch:
- platform: wake_on_lan
name: Elsden Rock
mac: 9a:c6:91:xx:xx:xx
host: 192.168.1.00
broadcast_port: 50000
turn_off:
service: rest_command.turn_off_rock
rest_command:
turn_off_rock:
url: "http://192.168.1.00/1/poweroff"
There used to be a bug in my home assistant roon integration that after repeatedly trying to reconnect to a turned off roon core - would then fail to connect at all. I’ve had this working without any issues for a week now - turning off my ROCK overnight - and back on in the morning. It’s always reconnected fine so I’m pretty happy the bug is fixed.
Just remember that after you turn ROCK on - it can take a couple of minutes to start-up and re-connect to HA.