Best way to publish Groups to Alexa?

Groups previously could be tagged with old V2 tags of lighting and they would send OFF commands to all members. Now, you can’t have anything on a group but endpoint.Lightbulb, so its not clear to me how you send OFF/ON commands to all group members

You should not use V2 tags when migrating to OH3 to configure the Alexa integration. The support for these will be removed in the upcoming changes when running an OH3 server to prevent conflicts with the semantic classification.

Where did you read that? Do you understand what’s the difference between state derived and standard “functional” groups?

For v3 you can add Metadata more than just ‘endpoint.Light’ by switching to the code tab:

value: PowerController.powerState
config:
  category: LIGHT
1 Like

sigh

That’s just a property of openHAB Groups. Like it or not, want it or not, regardless of any tags, if you send a command to a Group it gets distributed to member Items.

Maybe the question is how to send a command to a Group type Item from Alexa.

To summarize my original explanation above:

  • State derived groups, used to propagate commands to group members, can only be modeled as single endpoint (e.g. PowerController.powerState)
  • Standard “functional” groups, used to define a group of functionalities, can only be modeled as group endpoint (e.g. Endpoint.Light)

Hopefully, this is clear enough.

As far as new method, nothing has changed in how to configure your items for Alexa in OH3. If your concern is about the WebUI Alexa integration, you can always use the item file definition or the code tab as an alternative. Nobody is forcing you to use the new UI or at least to migrate all your existing items at the same time. You can take your time so you can get more familiar with the new functionalities added in OH3.

Keep in mind, there is a major metadata syntax update for the Alexa skill coming down the pipes including a rework of the current WebUI integration.

Thanks. Is there some kind of caching going on with items which are discovered by myopenhab.org alexa skill? Even after enable/disabling the skill and removing ALL devices, certain group name functionality won’t work. It’s like its cached and old, name.

Can you please define what you mean by “won’t work”?

I have not noticed any caching when configuring things in the past - I remove the ‘devices’ from Alexa and then just run the Discover process again. Note I rarely remove all devices as it would take me a bit of time to assign them back to the rooms.

Hi Jeremy

I have a group of light switches, called gAllLights with name All Lights.

OH/Alexa show the power state is ON, because 1 light is on. The companion app discover the group just fine. However when I say ‘Alexa, turn off all lights’ she beeps to acknowledge, yet it doesnt turn off.

If I say ‘Alexa, turn off all light switches’ - the group turns off just fine. Previously, it was the name that would trigger the group. Now, I’m not sure. There is something I’m not understanding correctly.

What am I missing?

I’ve had a little read of some posts on Reddit etc.

I think the issue is the group name being ‘All Lights’ since ‘Light’ is actually a device type in Alexa. To test try renaming the group ie: ‘All Illumination’.

From what I read a good work around is to create an ‘Inside Lights’ group and ‘Outside Lights’ group the so you can say ‘Turn of Outside Lights’

1 Like

Hi Sunny, I had this working for a few years without issue on OH2.5/2.4. But yes, it works with another name…Ill try your suggestion. The wife wont be happy :stuck_out_tongue:

So, is my theory sound here to be able to switch off all Switches and Dimmers in one hit?

1 x Group for Outside Dimmers (alexa brightness and power controller, all items Dimmer type)
1 x Group for Outside Switches (alexa power controller, all items Switch type)
1 x Group for Inside Dimmers (alexa brightness and power controller, all items DImmer type)
1 x Group for Inside Switches (alexa power controller, all items Switch type)

1 x Group for All Lights , label ‘BLAH’ (encompasses all 4 above groups) with alexa power controller

The aim is to issue 0/100 to Dimmers and ON/OFF to all lights, irrespective of being a switch or a light by saying ‘alexa , turn off all BLAH’

I’d do it by creating a main ‘Outside’ group and which holds the sub groups ‘Outside Switches’ and ‘Outside Dimmers’ the sub-groups have the corresponding Items (ie. FrontPorch_Switch or ForntPorch_Dimmer).

Set the ‘Outside’ group Amazon Alexa meta to ‘Lighting’ and then set the Alexa meta for the sub-groups according to their use (ie. Dimmer = BrightnessController.brightness and Switch = PowerController.powerstate.

This should allow you to use the ‘Outside Lights’ group name as part of the utterance - hence you can say ‘Set the outside lights to 50%’ or ‘turn off outside lights’

I do try and stay away from using the Light or Lights in defining my groups as this is also a device type - instead I use words like Lamp, spots, strips, tubes etc.

To expand a bit, if you have several Alexa devices you can configure each device’s location and hence be able to say ‘Alexa, turn on the lights’ and only the lights in the room where the device is turn on. You configure this by adding the devices to the same room. An issue some may face here is that they don’t want all the lights to come on and a work-around for that is to set those devices to an endpoint ‘Other’ so Alexa doesn’t think they are lights but can still control their power / brightness / color.

Going back to your last post, my explanation above should result in the following:

1 x Group for All lights (alexa Lighting)
1 x Group for All Dimmers (alexa BrightnessController.brightness)
1 x Group for All Switches (alexa PowerController.powerstate)
1 x Group for Outside Lights (alexa Lighting - member of All Lights)
1 x Group for Outside Dimmers (alexa BrightnessController.brightness - Dimmer items - member of All dimmers)
1 x Group for Outside Switches (alexa PowerController.powerstate - Switch items - member of All  switches)
1 x Group for Inside Lights (alexa Lighting  - member of All lights)
1 x Group for Inside Dimmers (alexa BrightnessController.brightness - Dimmer items - member of All dimmers)
1 x Group for Inside Switches (alexa PowerController.powerstate - Switch items - member of All switches)

A couple of things you can try to keep the wife happy:

1). If Alexa responds with OK to a statement such as ‘turn off all lights’ - use a rule to check the ‘LastVoiceCommand’ channel of the echo control binding and if the command matches trigger the groiup accordingly.

2). Alexa may not respond with OK and hence it can be confusing - the work around is to create a Routine in the Alexa app to match the utterance. This routine doesn’t actually have to do anything since you can create the rule as per step 1 and still match on the ‘lastVoiceCommand’ - the routine simply gets the right response from Alexa.

Are you sure you don’t have an Alexa group named “All lights” on your account? Keep in mind that the Alexa language processing matches group over device names if both are the same. The fact it is acknowledging your request, a command is sent to a device or group on your account. Have you checked your OH event logs to see if a command is sent to your server after making the request?

When it comes to groups, I usually suggest using Alexa groups over OH ones so you can take advantage of the group implementation at the Alexa level. The only downside is that each time you delete all your OH-related devices from your Alexa account (which shouldn’t happen that often), you will need to re-add the relevant devices back to that group.

1 Like

Thanks Sunny

I have my light switches in the respective Switches group, but there will be nothing in the Lights sub groups, and that makes All Lights top level group redundant.

So I’m not sure what the point of those are? You’d think this would be far more straight forward :slight_smile:

Hi Jeremy, no i dont and yes whilst setting this up theres alot of change so using my routines etc has all broken.

This is down to the way you are thinking - you need to understand that a Group is in Alexa is different to a Group in OpenHAB. As @jeshab has mentioned you could go the route of creating all the Group’s in Alexa but it can be quite time consuming to re-add all the devices any time you need to clear the Alexa devices list. It also can be quite confusing when looking at the Alexa app as it doesn’t have nested groups.

As an example, I have 3 zones on a ceiling which I have voice controlled using Alexa - outer, middle and inner. The outer zone has 8 spots, middle 4 spots and inner 2 spots. So, to be able to use an utterance of ‘Alexa, turn on the outer spots’ I need to have Alexa see this as a device. Therefore, in OpenHAB I create a group ‘gOuterSpots’ and assign it the Alexa endpoint Light. Now, with the way you are thinking you would just add the ‘On/Off’ or ‘Brightness’ items for those 8 spots - however, what we are doing is allowing Alexa to see a ‘device’ called ‘Outer Spots’ and hence I want to ensure that she knows what the separate channels are. Hence I create the sub groups (ie. ‘gOuterSpots_Switches’ and ‘gOuterSpots_Brightness’) and then put the relevant items for each Spot into those.

I know that the groups look a bit superfluous, however, hopefully you can understand that Alexa needs these to be able to see ‘a device’. The members of the groups are in effect the capabilities of the device and you only put in the items which match those capabilities.

1 Like

Thanks Sunny, so what was missing was to add ‘All Inside Dimmers’ and ‘All Inside Switches’ to ‘All Inside Lights’ - this appears to turn all switches/dimmers off using ‘Alexa, turn off all inside lights’ ONLY if Alexa, powercontroller is set for gAllInsideLights HOWEVER

Whilst it works, Alexa says, please check the connection and power supply :confused:

If I change the top level group to endpoint.Light, it doesnt even get discovered nor work

Try setting the Metadata on the ‘gAllInsideLights’ using the code tab to the following:

value: Lighting
config: {}

Managed to get it working by using the code tab, but turn off all lights wont work. Only turn off all Inside or Outside lights :frowning: