Alexa with PaperUI things & items

Hi,

I have all my things, channels and items working great with OH 2.5 using PaperUI.

I am trying to add Alexa.

I’ve linked my local server to the myopenhab account and it shows as online there and I can see my hab panels from myopenhab, so I guess this part is good.

I’ve also linked my Alexa, so this looks good too;

But I don’t see any items on myopenhab, should I?

And Alexa doesn’t seem to know any of my deivces…

After reading around it seems the PaperUI items can’t be used because they lack Tags?, so it seems to imply I need to create items via the text config files to get this to work.

Howerver, there seems to be a mix of how to do this. older versions of the Alexa plugin used one syntax and the newer version (which I have I assume) uses another.

I’m getting a bit lost. I think all the things are in place I just need to know the syntax of the Items file for the latest version of the plugin.

For the following example PaperUI switch over mqtt, what should the item file look like so Alexa can see it?

All my items are mostly mttq ones. Most switches, a couple of dimmers and a thermostat to read, all mttq.

I think if I can get just a couple of example Items definitions to work, I’ll be sorted.

You can get all this information in the Alexa skill documentation.

Switch GarageLights "Garage Lights" {alexa="Switchable", channel="mqtt:topic:037653bf:garage-lights"}

Thank you for that. I can see how that works for switches now, that probably covers a lot of my things.

So, I need to remove my items from PaperUI and add them in config files, really to avoid duplication?

Is PaperUI expected to to be able to support these extra “alexa=” features as some point soon?

Also, got a little more difficult one. Can alexa handle this?

I’ve a channel for Kodi which I hope to use to play things;

The Item shows up like this (it’s a combo box of things in favorites) ;
image

Can alex being made to handle this channel, by saying something like, “play film4” ?

You should go over the post below explaining how item metadata can be configured via PaperUI, otherwise you will have to switch to config files as you mentioned.

You can use the ModeController interface to achieve this. The example below uses a group endpoint so you could add other functionalities to control your Kodi device via Alexa.

item

Group gMovieRoomKodi "Movie Room Kodi" {alexa="Endpoint.StreamingDevice"}
String MovieRoomKodi_PlayOrOpenAFavorite "Favorite" (gMovieRoomKodi) {alexa="ModeController.mode" [supportedModes="FILM4=Film 4",friendlyNames="Favorite"], channel="kodi:kodi:d95068b1:playfavorite"}
Player MovideRoomKodi_Control "Control" (gMovieRoomKodi) {alexa="PlaybackController.playback", channel="kodi:kodi:d95068b1:control"}

utterances

Alexa, set favorite on movie room kodi to film 4
Alexa, pause on movie room kodi

If you want to use “play film 4” utterance, you would need to create a routine on the Alexa side to interact with the relevant OH device.

Thanks for taking the time to reply.

I had noticed that you can use String to select from a predefined list of options, but that means it’s hard coded list in the Item itself. However, the favourite list is dynamic and changing as the user adds and removed things in the Kodi gui. As this changed in Kodi, the combo box in the Paper UI item changes to reflect the contents… So the alexa prompt would need to match things in the Item, not the hard code list of string literal. In PaperUI, you open the combo box and pick one of the list of strings… Obv I am aming to say soemthing like “play favorite “apollo 13” on kodi”, or something like that. But “apollo 13” won’t be hard coded in the item.

It looks like this;
image
and you can click the combo to get the full list as below;

image

I hope I explained that ok!! :slight_smile:

And this is bugging me…

Under the Cabin, I can ask for the actual temp, I can set the target, and I can turn the heater on/off. All those work just fine… but!!! I can’t get it to tell me humidity… I item is there, because I can see it here;
image
Just can’t get alexi to tell me, Tried all ways of asking, most just say, “that is not support yet”

Is something done wrong?

The list of your favorite item options will need to be known on the Alexa side no matter what. However, if it’s a matter of not specifying manually all the supported modes, as mentioned in the ModeController interface documentation, the skill can automatically use the state description options for that given item, assuming the Kodi binding populates that information, which seems to be the case based on your observation. So, you can omit that configuration parameter and Alexa should know all the favorite modes for that item.

String MovieRoomKodi_PlayOrOpenAFavorite "Favorite" (gMovieRoomKodi) {alexa="ModeController.mode" [friendlyNames="Favorite"], channel="kodi:kodi:d95068b1:playfavorite"}

Keep in mind that if these options keep changing on the OH side, you will need to trigger a discovery on the Alexa to update that list. Moreover, you need to know that the Alexa language processing may not always understand made-up terms. So you may have to update accordingly, through trial and error, on the Kodi end if necessary.

As mentioned previously, there is no direct way to use the action “play” with the ModeController interface. It is reserved on the Alexa side currently for PlaybackController interface. The only way, which is definitely not optimal, is to use Alexa routines to set the device desired mode but it would mean hard coding each modes. So if you want to stick to dynamic modes, you will only be able to use the utterance example I mentioned above (e.g. Alexa, set favorite to apollo 13 on kodi)

Try using the CurrentHumidity metadata label instead, which translates to a non-controllable RangeController interface.

Getting closer all the time, what’s not right;

This still replies “That’s not support yet”, when asked, “what the humidity in the cabin”

But has not problem with “what’s the temp in the cabin”

With regards to the favourites thing, much better. If i removed the hard coded list, it does indeed pull them. But I think I’m having to delete the device in Alexa and add it back to pick it up. Can I make the refresh happen from OH end. I could do something in a rule on change of item, if i knew what to do.

As for the utterance,


This seems to work very well, I can just say “watch apollo 13 in movie room”.

Thanks for all the help so far!! :slight_smile:

Alexa, what’s the cabin humidity?

Not possible for the time being. There is an automated discovery on the Alexa side that is triggered every 24 hours or so. Other than that you will need to manually trigger the discovery.

Alexa, what’s the cabin humidity?

No, all the things that seem right reply “Sorry, that’s not supported yet”, I change the word humidity to anything else, it goes of and searches the web or something. So I’m sure it’s recognising it as what it is, just not able link it to the item…?

Not possible for the time being. There is an automated discovery on the Alexa side that is triggered every 24 hours or so. Other than that you will need to manually trigger the discovery.

Looks like i’ve take this as far as I can then. I’ll add some new favourites and see how long (if at all) it takes Alexa to be able to use then. or if I need to remove it each time. which will make it a bit pointless, after all this.

Thanks for helping getting this far.

Remove your cabin device from the Alexa discovered list and trigger a manual discovery.

Remove your cabin device from the Alexa discovered list and trigger a manual discovery.

I have been doing this as a matter of course, when I make any change to the item that is linked to Alexa. Just to ensure it’s in full sync with the right information. I remove the device using the app, the say “find devices” it replies found x new devices. I then go into devices, it can’t be seem. I swipe down and it appears. That’s the process I have been following when I made an Item change. It might not be required on each change, but it seems the best way to make sure it’s right.

Even after this, it always says;
"Sorry, that’s not supported yet”

I have linked each item to both Alexa and GA, if I ask GA the same question, it responds correctly with the humidity, so I think it’s an Alexa issue somewhere.

Not sure what to tell you at this point. I just ran a test and it worked on my end. Check your Alexa voice history to see if your requests were understood correctly.

As a side note, looking at your item definition, you should also add the thermostat mode capability as well associated with the PowerController interface (aka Switchable) so you can have the mode setting and turn on/off utterances available.

item

Switch CabinHeater "Heater" (gCabin) {alexa="PowerController.powerState,ThermostatController.thermostatMode"}

utterances
Alexa, turn on the cabin thermostat
Alexa, turn off the cabin thermostat
Alexa, set cabin thermostat to heat
Alexa, set cabin thermostat to off
Alexa, what’s the cabin thermostat set to?

@jeshab, I will try a little more tomorrow to nail the thermostat down.

To give you an upload on the dynamic list selection, it’s working pretty well.

I can use “watch” as the trigger word and simply say;

“Alexa, watch edge of tomorrow in movie room” and it works

Only little niggle is that after Alexa switches kodi to play the source, it ALWAYS says “Movie room isn’t responding, please check you …” It always does this. So I’m guessing whatever reply it’s getting back from the plug makes it think it hasn’t worked, even though it as worked perfectly. It would be good if it didn’t, I can tell that will become very annoying!!! lol :slight_smile:

And if I add any new favourites, I can just say “alexa, find devices” and after that it knows them. I do need to rename the favourite “b. b. c. one” after looking in activity to see what it heard, but that’s no big issue and can easy be lived with. Just the annoying message that’s ruining it now :slight_smile:

Make sure to go over the troubleshooting documentation related to device not responding. If you modeled a group endpoint for your Kodi device, you need to make sure that all the Alexa-enabled items part of that group are returning valid states.

Thanks @jeshab, that’s working :slight_smile:

I tried both things as I read them from trouble shooting;

This didn’t work;

and, this did;

Working well now. got there in the end.

If Kodi had a few more api calls to hook it better, it could be fully controlled I’m sure, that would be SOO cool :slight_smile: but it’s a good start.

That’s actually the correct way to set it up :+1:

Looking at the Kodi binding code, that channel state gets set to UNDEF after receiving a command.