Auto Sleep in API?

Hi,

I’m thinking of automation, can the Roon Auto Sleep function work with the API, can it sleep a Roon ROCK functioning as an endpoint?

Say I have HASS, my amp is on a Belkin Wemo Insight smart plug, I set Auto Sleep on Roon and it sends a signal to HASS which switches off the plug?

Ideally I also want to somehow have Roon Server (ROCK on Linux Server?) be able to WoL a Roon ROCK endpoint and switch my smart plug on…

Thanks.
Richard

Autosleep affects audio outputs that support standby or have extensions that add standby support. Autosleep does not apply to the Roon Core.

You can absolutely make a Roon extension for the Belkin Wemo to add standby support for your amp.

@danny I have the plugs but I’m not a programmer. If extensions are more Linux sysop stuff than coding I would be OK.

At this point I have zero experience with extensions.

I’m researching it now, it’s JS, I probably couldn’t write the code but I could get the API installed and configured no problem.

https://roonlabs.github.io/node-roon-api/RoonApiTransport.html

standby(output, opts, cbopt)

My thoughts would be to use a “broker” like Home Assistant (HASS), it simplifies things (no coding required) as supports everything:


HASS is in my future so I really only want HASS talking to the WeMo as it helps with tracking state, if only one “thing” is actually turning my plugs on/off, Alexa, HASS, Roon could all do it but best to “route” requests through HASS.

@Marcel_van_der_Veldt kindly develops roon-hass but it looks like he hasn’t logged on here since last August. His roon-hass github hasn’t been updated in 14 months (he has been active this month on other github projects), not being a programmer I’m not sure if Standby would need to be added to roon-hass or is roon-hass just a python wrapper around anything that the Roon API decides to expose, a translator between HASS and ROON.

Cheers
Richard

@danny are you using Home Assistant, if you could buy a smart plug that would be cool, they’re pretty cheap and super useful?

Does anyone have a document on the “Auto Sleep” workflow, I guess you have to add a “HASS_amplifier” (is that an extension?) device to Roon that supports the standby feature, then I set “Auto Sleep” to 10 minutes, after 10 minutes of no music Roon signals through the API to HASS that it should switch the plug off?

You have it correct.

I currently am using an volume/source/standby extension for my speakers that controls them over RS232. The audio part of the zone is an RPi + HAT, the volume/source/standby is that extension. The RPi is running Roon Bridge + the extension.

In Roon, I basically have a RAAT compatible full-featured network audio endpoint.

Auto-sleep works with the ‘zone’, which supports source and standby like a nice Roon Ready device would, but via this setup of the extension.

I’ve been debating adding it… just need some help extending an old Lutron Homeworks QS system before I go down that road.

For tinkerers, MQTT extension would be a good way to do a HASS integration, no?

For non-tinkerers, you want a direct connection to the Wemo – no HASS or MQTT brokers

picked up a Wemo Mini Smart Plug just now… hopefully itll show up next week and wont be too much of a pain to get working:

https://www.amazon.com/gp/product/B01NBI0A6R/

Thanks @danny, much appreciated!

A volume/source/standby extension that could use MQTT would be absolutely perfect.

If I had MQTT coming from Roon I could also control my Schiit Saga-2 via an IR sender connected to HASS.

show me your mqtt + schiit saga-2 setup

@danny this is theory, I haven’t tested yet but…

I do have:

  • Broadlink RM Mini 3

It’s a WiFi to IR bridge, supported by HASS.

If a Roon volume extension could publish MQTT to an MQTT server topic that HASS was subscribed to…

MQTT support on HASS is well documented:

I’m by no means an expert but it would be trivial (trigger > condition > action is how HASS configures it) to have a remote.send_command happen based on an MQTT message coming from Roon.




I got this thing working with the Wemo, but it has a nasty side effect I’ve run into before, and it requires some work in Roon zone handling to fix.

The problem is that when you power off the unit, it disappears and then cant be turned on from within Roon.

Roon needs the idea of persistent devices, even if they fall off the network or disconnect from USB. It’s on our roadmap, but no ETA.

1 Like

@danny Just thought I’d chip in here. My PR to Home Assistant integrating Marcels’s Roon extension has just been merged - so release 0.115 of home assistant will have Roon supported without needing a custom addition.

My main reason for wanting this is that one of my roon zones is connected to a tube power amplifier, which is connected to a WeMo power switch.

So I have an automation set up which detects when that zone starts playing, it then pauses the zone, turns on the power amp, waits for the tubes to warm up, and then unpauses the player.

It also changes the colour of the Philips Hue light over the amplifier to a ‘waiting’ colour and then a ‘working’ colour so it’s a bit more obvious what’s going on.

It turns off the power amp (and the Philips hue) after the roon zone has been idle for 5 minutes.

Having persistent usb players would allow me to do something similar with other zones (I usually try to keep my DACs turned off when the system isn’t playing to save power).

Would be happy to add a ‘sleep’ status to the hass/roon integration if it doesn’t already work!

@GregD, thanks, so using Roon and Wemo with HASS removes the need for the “persistent devices” that @danny is talking about?

No if Roon removes a device, HASS will mark it as disabled.

It depends on the device. Most USB connected devices are disabled when turned off (I have a Musical Fidelity M6DAC which can be switched to standby - in that state it keeps the USB connection alive - but it is the exception).

I have slightly changed my setup to use ropieee AES and SPDIF endpoints to send to the DACs. In that case the DAC being powered down doesn’t stop the endpoint trying to send music. Of course it means I need the ropieee devices powered on all the time.

I have a script that notices a device is playing, pauses it for a few seconds, turns the DAC on - and then unpauses playback.

1 Like