Using map within the description of a Switch fails with Alexa V3 discovery

Hi Guys

So it appears Alexa cant discover my device when my item file exists as below:

Switch FrontDoorMotion_Armed "[MAP(motion.map):%s] Front Door Motion Sensor" (gMotionSensors,Group_HabPanel_Dashboard) { alexa="PowerController.powerState" }

As soon as I omit the map portion in [] it works. Does anyone know how I go about using a MAP with the discovery process?

Thanks!

By convention, that would be [state description] on the right.
I’m not sure if that is a “rule”, nor what happens if you break it.
It certainly will not display “the other way around”

Switch FrontDoorMotion_Armed "Front Door Motion Sensor [MAP(motion.map):%s]" ...

I guess Alexa looks for a description of this Item and falls over at unexpected [

Seems so, I already tried changing the order without success.

I’m curious, why? I have never ever seen an Item label given in "[format] text" form, why would that be a sensible thing to try to fix an Alexa problem? Was there some clue pointing that way?

I’ve no idea what you mean. I use the map , as far as I know, it goes inside the “” like the description. Feel free to enlighten me if it’s meant to go elsewhere.

Well, this

Switch FrontDoorMotion_Armed "[MAP(motion.map):%s] Front Door Motion Sensor"

is different to this

Switch FrontDoorMotion_Armed "Front Door Motion Sensor [MAP(motion.map):%s]"

the [map] is not thrown into the “label” at random, it is placed second, after the actual label text.

Yes and what I’m saying is the placement, either before or after makes no difference to Alexa. She won’t discover it. The map actually works just fine at the start FYI. I’ve been using it like this for over 2 years but recently wanted to be able to turn them on/off via Alexa.

Hmm. Okay, I made a test with two Items (OH2.5) -

Switch testa "[MAP(motion.map):%s] Motion Sensor"
Switch testb "Motion Sensor [MAP(motion.map):%s]"

and inspected how they looked from REST API - this is the important thing, what the created Items look like from inside openHAB

{
  "link": "http://localhost:8080/rest/items/testa",
  "state": "NULL",
  "transformedState": "unknown",
  "stateDescription": {
    "pattern": "MAP(motion.map):%s",
    "readOnly": false,
    "options": []
  },
  "editable": false,
  "type": "Switch",
  "name": "testa",
  "label": "",
  "tags": [],
  "groupNames": []
}

{
  "link": "http://localhost:8080/rest/items/testb",
  "state": "NULL",
  "transformedState": "unknown",
  "stateDescription": {
    "pattern": "MAP(motion.map):%s",
    "readOnly": false,
    "options": []
  },
  "editable": false,
  "type": "Switch",
  "name": "testb",
  "label": "Motion Sensor",
  "tags": [],
  "groupNames": []
}

They’re different.
Only the conventional testb has a label field.
The unconventional testa has an empty label.

If you give labels in a sitemap or HABpanel, rather than relying on Item default label, you would never know.
I’m pretty sure Alexa uses the Item default labels.

Different openHAB versions may be more or less effective at syntax checking.

As always when editing files, a binding may need a restart to correctly pick up changes.

EDIT - yes there a few threads about Alexa not finding Items that have not been given a label

2 Likes

Cool, ill give the changes youve suggested a go and see. Thanks rossko57!