Thank you for your donation!

Instruction Guide how to power off/on onkyo/integra receivers automatically
I've just started using Moode and in the process of setting it up and getting it going I've done a few things that I thought I'd share.

In my place I've got a Rpi4 connected to my Integra AVR over HDMI. I wanted the AVR to turn on, change to the proper input and set the volume when Moode started playing audio. I also wanted it to turn off after nothing had been playing for a bit.

Here's how I did it:

- installed onkyo-eiscp (github for that project is here:
$ sudo pip3 install onkyo-eiscp

- then I made sure it was working. My Integra AVR is an older unit so it isn't auto-discoverable by eiscp
$ onkyo --discover
(returns nothing, not a shock.)

- But I know the IP address I've given the AVR so these work
$ onkyo --host power=on
unknown-model: system-power = on

$ onkyo --host source=query
unknown-model: input-selector = video2,cbl,sat

I found here on the forum that someone had written a bit of python to control relays when moode started / stopped playing - so I adapted that script. Thanks to the person who wrote that one! (original script was here:

#!/usr/bin/env python3

import os
import time
import eiscp.script

defaultDelay = 5 #seconds
playbackDelay = 300 #seconds
currentState = False # the current state

def isRunning():
   return "RUNNING" in os.popen('cat /proc/asound/card0/pcm*/sub*/status | grep RUNNING').read().split()

while True:
   if isRunning() and not currentState:        
       receiver = eiscp.eISCP('') # 125 = integra
       receiver.command('power on')
       currentState = True
       print("onkyo Activated")
   elif not isRunning() and currentState:  
       # delay again on playback stops to account for track changes
       # we wait longer to shut down, in case there's a device swap or whatever
       if isRunning():
           # if it's running don't deactivate the realay  
           print("Playback resumed, cancelling deactivation")
           # deactivate the relay
           receiver = eiscp.eISCP('') # 125 = integra
           receiver.command('power off')
           currentState = False
           print("Onkyo Deactivated")                                    
       print("No State Change...")

(this is also in the attached zip file)

This worked fine from the command line, so I then added it as a system service, as the relay controller did:

- Save the contents of onkyotoggle.service script to /lib/systemd/system/onkyotoggle.service
Description=MoOde Onkyo Toggle Daemon

ExecReload=/bin/kill -HUP $MAINPID


(this is also in the attached zip file)

- set it going in systemd
$ sudo systemctl enable onkyotoggle
Created symlink /etc/systemd/system/ → /lib/systemd/system/onkyotoggle.service.
$ sudo service onkyotoggle start

Attached Files
.zip (Size: 1.08 KB / Downloads: 1)

Forum Jump: