Rule based on Heos Binding, ungroup/group based on input

I feel this might be a very basic issue, but I’ve been trying to get it to work a quite some time now with absolutely no success.

I have multiple Heos speakers and I want to control the grouping of them based on the input of the main speaker. I have created the group and can group/ungroup on a switch within OH.

Here’s the rule I trying to get to work, it’s really not anything fancy by the looks of it.

rule "Heos grouping"
when
	Channel heos:player:86155633:-2045547701:Inputs triggered
then
	if receivedEvent == "optical_in_1" {
		HEOS_GroupAll.sendCommand(OFF)
	}
end

As per the documentation for the HEOS binding the input returns a string, and I have confirmed the value is in fact ‘optical_in_1’ (Though it dosn’t work regardless ofthe value here).
HEOS_GroupAll is the switch I’m using to manually group/ungroup the speakers.

What am I missing here? Thanks!

bit of advice: try using logInfo() to get outputs, which you can then use

rule "..."
when
...
then
	logInfo("Heos Logging", receivedEvent)
	...

This will print your variables or texts in the logfile for you to read.

just a hunch, but try toString() (I don’t have a Denon to test)

	if (receivedEvent.toString() == "optical_in_1") {
1 Like

Thanks a lot, I’ll try that out.

Where do I find the logfile stored? I’m running OH on a PI and connecting from a windows compter.

oh. Very basic questions! :wink:

but if you’re running openHABian, just use option 21 in sudo openhabian-config to activate the “Log Viewer”, which will then provide you with the last entries of your logfiles in your browser http://YOUROPENHAB:9001

Ahh thanks alot! :slight_smile:

And yeah very basic even if I have read that page like 5 times I still wasn’t able to understand it :smiley:

tl;dr:>

  1. open your SFTP of your choice (e.g. WinSCP) and connect to your openHAB Pi
  2. open /var/log/openhab
  3. find events.log and openhab.log
  4. open it in your texteditor of your choice and have fun

or

  1. ssh to your openHAB pi (e.g. putty)
  2. use sudo openhabian-config
  3. navigate to “20 | Optional Components”
  4. chose “21 | Log Viewer”
  5. wait til installation is ready
  6. open your browser and type http://YOUROPENHAB:9001 and get the lates log entries of both files ootb

so you have at least direct access to your logs and you can work from there… have fun!

1 Like

Thanks - it turns out Log Viewer was enabled so that works out nicely for me :wink:

I also found out that the rule didn’t even load due to missing quotes aroud the channel, after fixing that the entire rule seems not to evaluate anyway as there’s nothing logged by the LogInfo line. And then I ran out of time, so I’ll be testing some more later today :slight_smile:

Alright I might very well be completely stupid, but I cannot for the life of me figure this out :smiley:

Even this extremely simple rule does not provide a log (when viewed @9001):

rule "Heos grouping"
when
	Channel "network:pingdevice:192_168_87_188:online" triggered
then
	logInfo("Heos Logging", receivedEvent)
end

The rule file is loading as expected. the channel is basically pinging the IP of my TV to check if it’s online. And whenever it is triggered I would expect a log - but that does not happen.

It’s the same when trying to use other channels.

AFAIR “triggered” only applies to specific channels of only a handful bindings (e.g. astro), and network doesn’t have that option.
try linking an item to the channel

Item "HEON_DEVICE" received command
or
Item "HEON_DEVICE" changed

but: what is your goal, which you’d like to achieve with that?

What I’m aiming at here is that when my Heos Ceol (Speaker) is using source “optical_in_1” then it should ungroup the Heos group making the Heos Ceol be the only speaker active. When using any other source it should regroup. (See this thread for more info: Heos - group and ungroup rule)

Since listening to the heos player channel didn’t work* I wanted it to ungroup whenever my TV is turned on. This is the second best solution, but I would strongly prefer the checking the input source of the Heos Ceol if possible.

As far as I remember, I have tried the options suggested, but when I get back home I’ll give it another go :wink:

*though I now know that the rule didn’t fire at all, so it might actually work once i figure out how to get the rule to fire