Rules documentation

is there a place with all the documentation as this is making me pull my hair out. Lets look at the chromecast binding we have 3 items

control
volume
playuri

then we go down the page and look at the rules and there is now something to do with appid that you can also do with the device but no documentation on site.

The documentation is shocking over the whole project. When i get to grips with it something id be happy to help with dont get why others have not done this

Well, you are invited to improve documentation, as there are always too little people that have time and expertise :wink:
In fact, there are many pages in the documentation which are almost ok or at least sufficient.
But one has to find the pages with errors …

any idea’s to where i can find the missing parts to the documentation

You’re the only one who knows what you think is missing.

If you read my OP i talk about the example rule mentioning appid as a parameter. There is no mention to where this came from or how it should be used.

It also changes how it refers to the chromecast from using the name setup in the things file to this chromecast_chromecast_38e621581281c7675a777e7b474811ed, where did this new name come from and how do i find it?

Sorry for the neagtive tone of my first comment. I dont want to get into a flame war just want to get things to work. Then when I know how to make things work I can then write some awsome documentation

I’m going to assume that this is the passage you’re speaking of:

when
    Item chromecast_chromecast_38e621581281c7675a777e7b474811ed_appId changed

chromecast_chromecast_38e621581281c7675a777e7b474811ed_appId is the name of an item.

Items are frequently defined in a .items file, so this would probably be in there. You should read the Item configuration doc here.

I have read the document in depth. Here is what I don’t understand in regards to the Chromecast binding

so I set my thing up

chromecast:audio:livingroomcc [ ipAddress=“192.168.20.104”]

next I add my items

Dimmer Volume { channel=“chromecast:audio:livingroomcc:volume” }
Player Music { channel=“chromecast:audio:livingroomcc:control” }
String playuri { channel=“chromecast:audio:livingroomcc:playuri” }

then we get to the rules file and we have

    rule "Turn on kitchen speakers when Chromecast starts playing music"
when
    Item chromecast_chromecast_38e621581281c7675a777e7b474811ed_appId changed
then
{
	logInfo("RULE.AUDIO", "Chromecast id changed!")
	// 36061251 Pandora
	// 2872939A Google Play Music
	if (chromecast_chromecast_38e621581281c7675a777e7b474811ed_appId.state == "36061251"
	|| chromecast_chromecast_38e621581281c7675a777e7b474811ed_appId.state == "2872939A") {
		kitchen_audio_power.sendCommand(ON)
		kitchen_audio_source.sendCommand(1)
	}
}
end

My question is where did this item come from “chromecast_chromecast_38e621581281c7675a777e7b474811ed_appId” how should this be defined in the items file?

How do I find the app ids? eg // 2872939A Google Play Music (what is spotify and where is this info from)

here is a link to the documentation I am following

chromecast binding docs

I think, this is - in parts - mixed up information.

When using autodiscovery and simple mode on, openHAB will introduce items bound to the channels by itself.

autodiscovery -> openHAB2 Bindings are often capable to discover the existing hardware, so the only thing to do is, to install a binding. The binding will find the hardware automatically or you have to configure the correct address (as here… set the ip address). After that, the thing does exist in openHAB2.

simple mode -> Take a look at Paper UI -> Configuration -> System -> Item Linking. If this parameter (org.eclipse.smarthome.links) is set to ON, openHAB will link every standard channel of a new thing to a new item. These items will be automatically generated. openHAB makes use of UID to ensure that the names of the items are unique. In question of chromecast the name starts with chromecast_ and ends with _appId.

You can lookup these names in Paper UI -> Configuration -> Things -> chromecast thing (here livingroomcc) -> channels -> show more (on the right side, per channel).

If simple mode is switched off, openHAB won’t generate items and there won’t be no items with _appId at all.

still cannot get this to work, here is where I am at

Things are setup as
wemo:socket:lrspeakers [udn=“Socket-1_0-221707K110032E”]
chromecast:audio:livingroomcastaudio “living room speakers” [ ipAddress=“192.168.20.107”]

Items are setup as
Switch lrspeakers_switch “Living room speakers [stateformat]” { channel=“wemo:socket:Livingroomswitch:state” }

Dimmer Volume { channel=“chromecast:audio:livingroomcastaudio:volume” }
Player ccmusicliving { channel=“chromecast:audio:livingroomcastaudio:control” }
String playuri { channel=“chromecast:audio:livingroomcastaudio:playuri” }

then my rule

rule "Turn on kitchen speakers when Chromecast starts playing music"
when
    Item ccmusicliving changed
then
{
	logInfo("RULE.AUDIO", "Chromecast id changed!")

	// 36061251 Pandora
	// 2872939A Google Play Music

	if (ccmusicliving.state == "36061251"
	|| ccmusicliving.state == "2872939A") {
		lrspeakers_switch.sendCommand(ON)
	}
}


end

If im doing something super dumb im sorry just starting to pull my hair out here

If this is the thing:

wemo:socket:lrspeakers [udn="Socket-1_0-221707K110032E"]

I’m pretty sure this switch definition is wrong:

Switch lrspeakers_switch “Living room speakers [stateformat]” { channel=“wemo:socket:Livingroomswitch:state” }

I guess it should be

Switch lrspeakers_switch “Living room speakers [stateformat]” { channel=“wemo:socket:lrspeakers:state” }

instead.

The rule should be more like:

rule "Turn on kitchen speakers when Chromecast starts playing music"
when
    Item ccmusicliving changed
then
    logInfo("RULE.AUDIO", "Chromecast id changed! New id is {}",ccmusicliving.state.toString)
                                                    // 36061251 Pandora
                                                    // 2872939A Google Play Music
    if (ccmusicliving.state.toString == "36061251"
    || ccmusicliving.state.toString == "2872939A") {
        lrspeakers_switch.sendCommand(ON)
    }
end

Please pay attention to .toString. Keep in mind, that a state is not the same as a string.
I guess you got the chromecast ids from events.log?

@tom_bruton

Be sure to have one of the current OH2 builds, e.g. SNAPSHOT build #1148.

In documentation ( docs ) most of the channels are missing.

In fact, there are the following channels: see here Link

        <channel id="control" typeId="control"/>
        <channel id="volume" typeId="volume"/>
        <channel id="mute" typeId="mute"/>
        <channel id="playuri" typeId="playuri"/>

        <!-- App Information -->
        <channel id="appName" typeId="appName"/>
        <channel id="appId" typeId="appId"/>
        <channel id="idling" typeId="idling"/>
        <channel id="statustext" typeId="statustext"/>

        <!-- Media Info -->
        <channel id="currentTime" typeId="currentTime"/>
        <channel id="duration" typeId="duration"/>

        <!-- Metadata Info -->
        <channel id="metadataType" typeId="metadataType"/>
        <channel id="albumArtist" typeId="albumArtist"/>
        <channel id="albumName" typeId="albumName"/>
        <channel id="artist" typeId="artist"/>
        <channel id="broadcastDate" typeId="broadcastDate"/>
        <channel id="composer" typeId="composer"/>
        <channel id="creationDate" typeId="creationDate"/>
        <channel id="discNumber" typeId="discNumber"/>
        <channel id="episodeNumber" typeId="episodeNumber"/>
        <channel id="image" typeId="image"/>
        <channel id="imageSrc" typeId="imageSrc"/>
        <channel id="locationName" typeId="locationName"/>
        <channel id="location" typeId="location"/>
        <channel id="releaseDate" typeId="releaseDate"/>
        <channel id="seasonNumber" typeId="seasonNumber"/>
        <channel id="seriesTitle" typeId="seriesTitle"/>
        <channel id="studio" typeId="studio"/>
        <channel id="subtitle" typeId="subtitle"/>
        <channel id="title" typeId="title"/>
        <channel id="trackNumber" typeId="trackNumber"/>

You could see them in PaperUI --> Things --> “Your Chromecast” --> Configure = image

then --> SHOW MORE

You have to define and link items to your channels.

Then your rule will run!