Alexa question --> Read out boolean status of lamps & switches?

Hey friends,

Hope someone can give me a hint in the right direction.
I have a simple light item which I can control just fine with Alexa. I now want the question answered “is the floorlight on?”

Switch Floor_Light "floorlight %s" <light> ["Lighting"] { channel="knx:device:e5f3fe24:A", alexa="Lighting" }

When asking the machine if the lights on/off it answers “floorlight doesn’t support that!” which I take some kind of offense in because I’m quite sure Openhab does support that and the mistake is with me using it and not the software itself :smiley:
I went over the documentation but the only examples coming close to what I need is tempeature - and that exposes another Alexa interface which lights, as I understand it so far, don’t have.

Thanks in advance,
Georg

See this link. :wink:
https://developer.amazon.com/en-US/docs/alexa/smarthome/smart-home-skill-api-message-reference.html

Operation Message
Respond to a directive request that completes successfully Response
Request a state report Alexa.ReportState
Respond to a state report request Alexa.StateReport
Proactively notify Alexa that an endpoint property has changed Alexa.ChangeReport
Notify Alexa that you are responding asynchronously to a message because the operation will take longer than 8 seconds. (used for locks) Alexa.DeferredResponse
Report whether an endpoint has connectivity Alexa.EndpointHealth
2 Likes

Thanks for the link!

What I’m confused about is the fact that in the Alexa companion app, the light is shown as “off” or “on”.
I tried adding the ReportState in addition to the lighting but still no change in behaviour. The app tells me the state of the switch, Alexa, when asked, tells me “how should I know?”, exaggerated :wink:

Or does that link mean that this falls under
“Your skill should not fail if it receives additional fields in a directive or directives it does not recognize.”

And I can’t realise this with the standard Openhab Skill?

Thanks a lot!

Check out lastVoicecommand

wait I think I’ve described this wrong - I don’t want to control Alexa from Openhab (with the binding the lastVoiceCommand is part of, https://www.openhab.org/addons/bindings/amazonechocontrol/ ).
I want Alexa to query OpenHab and report back the state of a lightswitch. I don’t even have that binding.

Sorry shoud I missunderstand you.

So this is a limitation on the Alexa side with the PowerController interface. Only Amazon would be able to answer the reason for it.

As you noticed, you can get the status of a PowerController modeled item via the Alexa App but you can’t get that same status when requesting via voice commands. This is because the skill only gets ReportState requests for the former but not for the latter.

I know it’s pretty frustrating but if this is a feature you must have, you could use a workaround via the toggleController interface. Keep in mind that you will need to use the component friendly name to control the device and the Alexa app integration wouldn’t have a nice bulb icon to turn on and off.

Switch Floor_Light "floorlight %s" <light> ["Lighting"] { channel="knx:device:e5f3fe24:A", alexa="ToggleComponent" [category="LIGHT", friendlyNames="Power"] }

Alexa, turn on floor light power
Alexa, what’s the status of floor light?
Alexa, is floor light on?

1 Like

Thank you, Jeremy.
Now that I know that it’s not simply me being too dumb I’m fine with finding a workaround for the parts where I really need to ask for the status!

Cheers!

@jeshab just wanted to let you know, functionality works, but Alexa is really weird with what commands it takes (disclaimer: German). I’ve implemented it with item:

Switch Garden_Power "Garten" { channel="knx:device:e5f3fe24:H", alexa="ToggleComponent" [category="Strom", friendlyName="Strom", actionMappings="Aus=OFF,An=ON", stateMapping="Aus=OFF,An=ON"] }

and the command “schalte Garten an” doesnt work" but “Garten off” does (without the ‘switch’/‘turn’ keyword.
In addition, when asked what the state is, it answers “Garten Garten ist OFF/ON” (yes, English phrasing, although it takes the German commands without issues.

Anyway, I can now check if I’ve forgotten my garden electricity without taking my phone out, even if the voice commands are not as smooth as I would’ve wished for.

Thanks again for your help - thought that you’d perhaps like a success-Update :slight_smile:

/ Georg

The category parameter is not translatable. It needs to be one of these values. Same goes with the semantic extensions you have setup. These are only for open/close commands which doesn’t apply here and therefore aren’t needed.

Correct. This is what I meant by “Keep in mind that you will need to use the component friendly name to control the device”. You have to use device name Garten + friendly name Strom to send a command in this case. I agree it’s another unnecessary limitation on the Alexa side.