Expose string item to Alexa

Hi,

I try to expose a string item to alexa which should be readonly (not be changed by Alexa).

Just as example, let´s say the purpose of the item is to save the actual weekday.

So the item can have different string values (monday/tuesday/wednesday/…)

In openhab I can see the current value of the item, but I would like to ask Alexa something like “What is the state of weekday?” and receive an answer like “Tuesday”.

I tried to use ModeController.mode in combination with supportedModes. It was possible to ask for the state of the item, but I didn´t manage to make it readonly.

My item definition looks like this:
String state_weekday “today” { alexa=“ModeController.mode” [friendlyNames=“weekday”, supportedModes=“monday=monday,tuesday=tuesday,wednesday=wednesday”] }

Any hints?

Thanks

You need to add the metadata parameter nonControllable=true.

String state_weekday "today" { alexa="ModeController.mode" [friendlyNames="weekday", supportedModes="monday,tuesday,wednesday", nonControllable=true] }

Great - this works for me! Thanks a lot!

This solution is fine, if there is a predefined set of possible states. But is there also an approach - if the possible states/values are unknown?

The modes need to known on the Alexa end. If you are referring to dynamic modes defined by a binding, per the documentation: “In regards to supported modes and their mappings, by default if omitted, the openHAB item state description options, if defined, are used to determine these configurations.”.