openHAB Skill for Amazon Alexa New Metadata Syntax Beta Test

Yes, myopenhab shows my server as online. I was looking for the URL you provided. It returns a long list of items, not only my alexa items.

Ok, will install the M5 today and See if that will help…

Unfortunately no change … I did a fresh M5 container install. No items found. I then deleted my “openhab cloud” account and created a new account with a different eMail address. no change.

disconnected openhab skill and reconnected it, no change

The url: “https://myopenhab.org/rest/items?metadata=alexa” does return a long list of items and attributes, not only my alexa items. Maybe this is the problem ?

Update:

this is my OH log in karaf at the moment when I start a device search in alexa:

12:22:49.321 [DEBUG] [.io.openhabcloud.internal.CloudClient] - on(): request 12:22:49.321 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Got request 7239123 12:22:49.322 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Path /rest/items 12:22:49.322 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Method GET 12:22:49.322 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Headers: {"host":"myopenhab.org","cache-control":"no-cache","accept-encoding":"gzip, deflate","accept":"application/json","user-agent":"openhab-cloud/0.0.1"} 12:22:49.322 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Query {"metadata":"alexa,autoupdate,channel,synonyms","fields":"editable,groupNames,groupType,name,label,metadata,stateDescription,tags,type"} 12:22:49.322 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Request method is GET 12:22:49.323 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Jetty set header host = myopenhab.org 12:22:49.323 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Jetty set header cache-control = no-cache 12:22:49.323 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Jetty set header accept-encoding = gzip, deflate 12:22:49.323 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Jetty set header accept = application/json 12:22:49.324 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Jetty set header user-agent = openhab-cloud/0.0.1 12:22:49.367 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onHeaders 7239123 12:22:49.368 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16229 12:22:49.369 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16384 12:22:49.369 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 155 12:22:49.397 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16376 12:22:49.398 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16384 12:22:49.398 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 8 12:22:49.423 [DEBUG] [.io.openhabcloud.internal.CloudClient] - on(): request 12:22:49.424 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Got request 7239128 12:22:49.424 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Path /rest/uuid 12:22:49.424 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Method GET 12:22:49.424 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Headers: {"host":"myopenhab.org","cache-control":"no-cache","accept-encoding":"gzip, deflate","user-agent":"openhab-cloud/0.0.1"} 12:22:49.425 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Query null 12:22:49.425 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Request method is GET 12:22:49.425 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Jetty set header host = myopenhab.org 12:22:49.425 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Jetty set header cache-control = no-cache 12:22:49.426 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Jetty set header accept-encoding = gzip, deflate 12:22:49.426 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Jetty set header user-agent = openhab-cloud/0.0.1 12:22:49.427 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onHeaders 7239128 12:22:49.428 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239128, content size 36 12:22:49.428 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onComplete: 7239128 12:22:49.429 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Finished responding to request 7239128 12:22:49.435 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16376 12:22:49.435 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16384 12:22:49.436 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 8 12:22:49.475 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16376 12:22:49.476 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16384 12:22:49.477 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 8 12:22:49.507 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16376 12:22:49.508 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16384 12:22:49.508 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 8 12:22:49.524 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16376 12:22:49.525 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16384 12:22:49.525 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 8 12:22:49.526 [DEBUG] [.io.openhabcloud.internal.CloudClient] - on(): request 12:22:49.526 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Got request 7239133 12:22:49.526 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Path /rest/ 12:22:49.526 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Method GET 12:22:49.527 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Headers: {"host":"myopenhab.org","cache-control":"no-cache","accept-encoding":"gzip, deflate","accept":"application/json","user-agent":"openhab-cloud/0.0.1"} 12:22:49.527 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Query null 12:22:49.527 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Request method is GET 12:22:49.527 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Jetty set header host = myopenhab.org 12:22:49.528 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Jetty set header cache-control = no-cache 12:22:49.528 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Jetty set header accept-encoding = gzip, deflate 12:22:49.528 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Jetty set header accept = application/json 12:22:49.528 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Jetty set header user-agent = openhab-cloud/0.0.1 12:22:49.551 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onHeaders 7239133 12:22:49.552 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239133, content size 1908 12:22:49.553 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onComplete: 7239133 12:22:49.553 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Finished responding to request 7239133 12:22:49.567 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16376 12:22:49.568 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16384 12:22:49.568 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 8 12:22:49.599 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16376 12:22:49.599 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16384 12:22:49.600 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 8 12:22:49.630 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16376 12:22:49.631 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16384 12:22:49.632 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 8 12:22:49.671 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16376 12:22:49.672 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16384 12:22:49.673 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 8 12:22:49.714 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16376 12:22:49.714 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16384 12:22:49.715 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 8 12:22:49.751 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16376 12:22:49.752 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16384 12:22:49.752 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 8 12:22:49.784 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16376 12:22:49.785 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16384 12:22:49.786 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 8 12:22:49.820 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16376 12:22:49.821 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16384 12:22:49.822 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 8 12:22:49.860 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16376 12:22:49.861 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16384 12:22:49.862 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 8 12:22:49.900 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16376 12:22:49.901 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16384 12:22:49.902 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 8 12:22:49.939 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16376 12:22:49.940 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16384 12:22:49.941 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 8 12:22:49.977 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16376 12:22:49.978 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16384 12:22:49.978 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 8 12:22:50.019 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16376 12:22:50.021 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 16384 12:22:50.021 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 8 12:22:50.022 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onResponseContent: 7239123, content size 1718 12:22:50.022 [DEBUG] [.io.openhabcloud.internal.CloudClient] - onComplete: 7239123 12:22:50.022 [DEBUG] [.io.openhabcloud.internal.CloudClient] - Finished responding to request 7239123

Is there a way to see what has been returned ?

My lights follow this pattern:
Group: “light”, dimmer item in group: “light.brigthness”, color item: “light.color”, switch item: “light.powerstate”

That’s normal. The skill needs to get all items for a given user to determine which ones are configured for Alexa during the discovery process.

The logs are looking good. I can see the 3 queries that are initiated during a discovery process.

That unfortunately is only available on the skill side and we don’t log that information due to resource constraints.

The metadata configuration is case sensitive. Make sure to match exactly what is documented.

Also, I should have asked you before but I got sidetrack by the fact you mentioned you were on the beta test. Did you make any chances in term of Alexa configuration since you couldn’t discover your devices anymore? Have you tried to remove all your existing Alexa configuration and start with one simple switch? If it gets discovered then stagger changes from that point.

Hi, I solely configure the metadata using the openhab gui. The values for the metadata are directly from the dropdown list in the gui. e.g.: for the light group cellar “Keller” this is the metadata for the group (the code tab, when I edit the metadata of the item using the gui):

value: Light
config: {}

The dimmer item:
value: Light.Brightness
config: {}

the power state:
value: Light.PowerState
config: {}

I switched back from the beta skill a few weeks back to the then live version. Since then I only added new devices but made no fundamental change in openhab or my alexa environment (I have roughly a dozen Alexa devices - one in each room of our house)

Regarding narrowing down the error:
yes, that yould be my next step: create an empy openhab 3.2M5 docker container without any config and create one switch only and see whether that is being discovered. I had hoped I could avoid that “bottom up” process … but if the logs look ok and if there is not other obviously stupid mistake on my side, I will have to do that :frowning:

For reference, the discovery issue listed above was related to users with a high number of Group items setup on their servers causing the discovery to timeout after 10 seconds. A fix has been released to the live skill.

Why is the SecurityPanel pin checked by the skill now? In the previous version it was sent with the armstate in this format “disarm:1234”. Now, since it’s defined in the Alexa metadata, it can’t be changed as desired by the user (in example if someone stole it). A pin that can’t be changed isn’t very useful

Because it is more practical and removes the need to have a rule on the OH side to parse and check an item state, and then set the state of that item to a specific value.

I am not sure to understand the issue. The Alexa metadata can be changed as desired by the user. Maybe if you could provide additional details on what you are trying to achieve, including your item definition, it would help understand your use case.

In my openhab implementation the security system can be disarmed both by android app (typing the PIN) and by Alexa (saying the PIN). The PIN is stored in a string item and it could be changed via GUI so everyone at home, included my 70 yo father, can do it. Maybe there’s a way to write Alexa metadata via a rule? Because if that’s not the case only someone capable to access the openhab admin page via a PC could do that. And however, the pin must be changed twice, one in the string item and one in the Alexa metadata.

I’m still missing a part here. How are you validating the PIN code? Can you please provide your configuration details such as item definition and rules? It would be easier to understand.

When someone disarm the security system the pin is written along with the command to the string item “AlarmMode” (e.g. “disarm:1234”), this fire the rule below

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: AlarmMode
    type: core.ItemCommandTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      type: application/javascript
      script: >

        var mode = command + "";
        var passCode = "";


        if (mode.indexOf(':') > 0) {
          var rcvd = Mode.split(':');
          mode = rcvd[0];
          passCode = rcvd[1];
        }

        if ((mode != items["AlarmMode"]) && (mode == "disarm")) {
			if (passCode == items["SecurityPIN"]) {
			  events.sendCommand("AlarmMode", "disarm");
			  events.sendCommand("Armed", "OFF");
			  events.sendCommand("SecurityEvents", "System disarmed");
			}
			else {
              events.sendCommand("SecurityEvents", "Wrong PIN");
			}
		}
	type: script.ScriptAction

When the switch item “Armed” is OFF the activation of an alarm sensor doesn’t activate the alarm siren.

Below items and metadata definitions

  "gSecuritySystem": {
    "class": "org.openhab.core.items.ManagedItemProvider$PersistedItem",
    "value": {
      "groupNames": [
        "gMyHome"
      ],
      "itemType": "Group",
      "tags": [
        "AlarmSystem"
      ],
      "label": "Security system",
      "category": ""
    }
  },

"SecurityPIN": {
    "class": "org.openhab.core.items.ManagedItemProvider$PersistedItem",
    "value": {
      "groupNames": [
        "gSecuritySystem"
      ],
      "itemType": "String",
      "tags": [
        "Point"
      ],
      "label": "PIN",
      "category": ""
    }
  },

  "AlarmMode": {
    "class": "org.openhab.core.items.ManagedItemProvider$PersistedItem",
    "value": {
      "groupNames": [
        "gSecuritySystem"
      ],
      "itemType": "String",
      "tags": [
        "Point"
      ],
      "label": "Alarm Mode",
      "category": ""
    }
  },


  "alexa:gSecuritySystem": {
    "class": "org.openhab.core.items.Metadata",
    "value": {
      "key": {
        "segments": [
          "alexa",
          "gSecuritySystem"
        ],
        "uid": "alexa:gSecuritySystem"
      },
      "value": "SecurityPanel",
      "configuration": {}
    }
  },

  "alexa:AlarmMode": {
    "class": "org.openhab.core.items.Metadata",
    "value": {
      "key": {
        "segments": [
          "alexa",
          "AlarmMode"
        ],
        "uid": "alexa:AlarmMode"
      },
      "value": "SecurityPanel.ArmState",
      "configuration": {
        "ARMED_AWAY": "away",
        "ARMED_NIGHT": "night",
        "ARMED_STAY": "stay",
        "DISARMED": "disarm",
        "exitDelay": 240.0,
        "pinCodes": [
          "1234"
        ]
      }
    }
  },

I think a parameter like a pin code can’t be hardcoded, as well as for the difficulty in changing it also because it is not possible to have a log of any break-in attempts via pin code.

How often do you change the value of your SecurityPIN item? Because it is basically the state of that item that needs to be put in the pinCodes metadata parameter. Not the actual PIN provided by the user.

The skill receives the PIN provided by the user on disarm requests and instead of passing it in the item command as before, it validates it against the configured PIN codes. I don’t see how it won’t work for your use case. You might have to decouple your OH workflow at the AlarmMode item level though.

Maybe never, or maybe once a day. You’re thinking like a computer programmer, not like a user.
The point is that this implementation can’t be used by those who don’t have specific computer skills. What would you think of your mobile phone if you had to take it to the store every time you want to change the unlock password?

Are you saying that your users can change their own validation PIN code as well? If so, wouldn’t you have separate validation PIN items for each user?

Have you checked the new JSScripting automation module part of the OH 3.2 release? Currently, you can update the metadata value but it doesn’t seem that it supports updating metadata parameters as of yet. However, it shouldn’t be too hard to add that ability if you are willing to contribute. That way you could control the pinCodes metadata parameter via a rule.