Problem with Alexa device discovery

  • Platform information:
    • Hardware: Raspberry pi 4 (4gb Ram)
    • OS: Openhabian
    • openHAB version: 2.4.0-1
  • Issue of the topic:
    I have an esp8266 with a temperature sensor. I use MQTT to send temperature data to openhab MQTT service (Broker). With paper UI I configure Things,Channels and Items. All work very well and I can see in paper UI control the right values. Then I install open Hab cloud service and configure one account. I see my openhab online and I can access it. I configure Alexa skill and give it access to myopenhab. Then I find a guide and I try to add tag using REST api to the temperature Items, then I try to discover devices with Alexa. No way, I reboot openhab and try again. Then I find documentation for Alexa with V3 metadata. So I delete from paper UI the item and I try to create a new item configuration file in $OPENHAB_CONF/items
    After create the Items file, with paper UI I link the item in the thing channel
    I try with these items configurations that I copy from Openhab Alexa’s guide but when I scan for devices with Alexa no new device is found.
Number Prova "Temperatura Bagno" {alexa="TemperatureSensor.temperature" [scale="Celsius"]}
Number:Temperature Temperature2 "Temperature"           {alexa="TemperatureSensor.temperature"}

In the logs I can’t find any problem about Alexa. I don’t know if there’s a problem mixing paper UI configuration and file configuration

Make sure that the mode for your openHAB cloud service is set to “Notifications & Remote Access”. You can access that configuration from Paper UI > Configuration > Services > IO (tab) > openHAB Cloud > Configure.

Thank you Jeremy for the reply.
The openHAB service is configured as you say(I think it is the default value).

I also try also to add item to “Items to expose to apps”, then I find a post and I see that for Alexa is not necessary to configure “Items to expose to apps” and I remove items from the list.

These are configurations in web page

In a post I see also that “Enforce an auto update” is necessary for Alexa so I try but Alexa can’t find the device.

This is the device in the Control page: Bagno_BME280, the thing label is “Temperatura Bagno”

@Massimo you need to add tagging to your items for Alexa to discover them.

Notice the [“Lighting”] tag in example.

Switch CouchLight "Couch Light" <light>  ["Lighting"]  { channel="mqtt:topic:pibroker:sonoff2:power" }

For temp you will need change Lighting to Temperature.

Try to assign a group, I think this was necessary for me to get alexa running.

Group	gBad		"Bad"	<bath>		(gOben)
Number	Temperatur_Bad	"Temperatur Bad"	(gBad, gTemperatur_Bad)	{ alexa="TemperatureSensor.temperature", channel="deconz:temperaturesensor:homeserver:tTemperatur_Bad:temperature"}

Also be patient, I need to wait some minutes for the items to show up in alexa.

Thank you for replies.
H102 I already tried to put tag (I use rest API) before.
Probably you want me to put V2 tags as in documentation for Alexa
I try to do as you suggested with file Items (sorry these are first times I use them, maybe I miss something). I try these configurations but Alexa didn’t find any new device

Number Prova "Temperatura Bagno" ["Temperature"] {alexa="TemperatureSensor.temperature" [scale="Celsius"]}
Number Prova "Temperatura Bagno" ["CurrentTemperature"] {alexa="TemperatureSensor.temperature" [scale="Celsius"]}
Number Prova "Temperatura Bagno" ["Temperature"] {channel="mqtt:topic:08d8eeb4:Bagno_BME280_Temperatura" }
Number Prova "Temperatura Bagno" ["CurrentTemperature"] {channel="mqtt:topic:08d8eeb4:Bagno_BME280_Temperatura" }

Shubert I see the example you provided so I try these codes(one at a time) and wait some minutes with several Alexa scan (5-6 scans). I also try restart openhab2 service. Alexa didn’t find any new device

Group temperatura "temperatura"
Number Prova "Temperatura Bagno" (temperatura) {alexa="TemperatureSensor.temperature" [scale="Celsius"]}
Group   gBad            "Bad"   <bath>          (gOben)
Number  Temperatur_Bad  "Temperatur Bad"        (gBad, gTemperatur_Bad) { alexa="TemperatureSensor.temperature" }
Group   gBad            "Bad"   <bath>          (gOben)
Number  Temperatur_Bad  "Temperatur Bad"        (gBad, gTemperatur_Bad) { alexa="TemperatureSensor.temperature", channel="mqtt:topic:08d8eeb4:Bagno_BME280_Temperatura" }

In OpenHAB documentation (page for Alexa) Group appears to be non-mandatory and I suppose that is better to use new Alexa Version 3 API syntax.
Is it a problema mixing Paper UI web created Things with file Items?
Is there any other log that I can watch? (I checked /var/log/openhab2/events.log but I can’t find anything)

I mix PaperUi and file created items.

For logging:
tail -f /var/log/openhab2/openhab.log -f /var/log/openhab2/events.log
But it is not very easy, you are blind what amazon is doing in the AWS cloud. And also our own OpenHAB cloud connector is not giving us much info.

The new API3 syntax provides more functionality than the old.

Do you have the alexa OpenHab skill installed? is it working for the panels?

Thank you Schubert, as you said I can’t see anything about Alexa scanning in the log you provided so I have no clue :frowning:
I have Alexa skill installed and enabled. I can see it in myOpenHAB.

Is there any other thing that I can watch to see if connection between myOpenHAB and Amazon is working well? Have I to open some port in the router (I suppose that OpenHAB open connection to myOpenHAB so there’s no need to open port)

Your cloud connection looks good.

I think the item files are the tricky part. If I remember correctly, I had errors in there and this did prevent the other items to be processed for Alexa (but showing in the panel).
Can you try to make a backup and remove all items but one + the group.
So in the code you copied from me, you introduced an error with the groups that you don’t have “gOben”, “gTemperatur_Bad”.

I didn’t configure backup yet. I will try to configure it and remove everything. Meanwhile I try to disable all the Thing from paper UI but Alexa still don’t find anything. In the code I copied I also try the first example where group exists, so error shouldn’t prevent other items to be processed for Alexa

Group temperatura "temperatura"
Number Prova "Temperatura Bagno" (temperatura) {alexa="TemperatureSensor.temperature" [scale="Celsius"]}

I try to correct group as you suggest
I make a new group from Paper UI but there’s something strange.

In function I can’t set Equal
Then I create Item file with this code

Number Prova "Temperatura Bagno" (gTemperature) {alexa="TemperatureSensor.temperature"}

In web page I see this

but if I select gTemperature and click on OPEN ITEM I can’t see the group(I have an Error 404 OK in the browser).

I try to create the group using Items file (removing “gOben”, “gTemperatur_Bad”) but still not work

Group   gBad            "Bad"   <bath>
Number  Temperatur_Bad  "Temperatur Bad"        (gBad) { alexa="TemperatureSensor.temperature" }

Could be data rappresentation of temperture? I have the 20.3 as value maybe Alexa in Italy want it formatted with comma(20,3)?
Could be the way I collect data from esp? I send the value through MQTT once time every minute but communication goes from sensor to MQTT broker I haven’t configured the possibility to ask value from Alexa to sensor

Sorry I haven’t find time to setup backup so I couldn’t delete all the objects except one

Use sudo openhab-cli backup --full to create a backup zip file that will be located in var/lib/openhab2/backups. You will need to use somethings like FileZilla to move the backup to a different device or use a USB stick.

This will backup /etc/openhab2/ and /var/lib/openhab2/
This way, the information about installed addons is backuped, but not the addons itself, so when installing openhab2 new, the actual version of the bindings will be installed.
The only things to backup in addition, are the manually installed addons.

To restore the backup stop OH sudo systemctl stop openhab2 place the backup file in the above mentioned location (where you moved it from) then use sudo openhab-cli restore var/lib/openhab2/backups/zip_file_name. Next restart OH with sudo systemctl start openhab2

If you have an extra sd card or Pi then I would recommend doing this to verify everything works as expected.:wink:

For the Alexa config have you opened a browser and used http://openhab:8080/amazonechocontrol/ (Note, you may need to use your server IP address in place of “openhab”) to log in and get your device serial number?

Thank you very much H102. This backup guide is very useful :slight_smile: I’m going to try with a new sd card as you suggested.
I haven’t installed the amazone echo control binding yet because I want Alexa to control my devices throught OpenHAB in this moment, I don’t want to control Echos from OpenHAB. One step at a time :stuck_out_tongue_winking_eye:

I may be wrong (wouldn’t be the first time,:rofl:) but you need the binding b/c that is how Alexa gets access to OH???

Thank you, no problem I’m going to try it.
I thought that the way Alexa interact with OpenHAB is openHAB Cloud Service (that I installed).
In the Alexa skill I have to configure myOpenHAB access credential so I thought that Alexa access to my account of myOpenHAB for interact with my things.
The amazon echo control from the guide seems to let you control Echo from OpenHAB through amazon web pages

I thought that are two different things (and uses)
Amazon echo->Skill OpenHAB->my OpenHAB account->my home devices
OpenHAB->Amazon Echo Control Binding->Amazon web page-> my echo dot
Am I wrong?

Can’t say for sure, but if you can not discover your devices with Alexa then it seems you need both openHab Cloud and Amazon Control bindings.

Install the Amazon binding and then see if Alexa can discover your devices. You might just find the solution to your problem.:wink:

The item state doesn’t actually get processed during the skill discovery. So even though the skill would have problems getting the current state of your temperature item later on, it would at least modeled the device on your Alexa account.

It shouldn’t be a problem but I think there could be some conflicts if you are configuring specific items via the Paper UI and item files at the same time. Can you please use a new item name when defining its file configuration? Also, try to add a simple switch item to see if it get discovered and check the OH server logs that the file is actually processed and there are no syntax errors. Last, try to unlink and link back the OH skill onto your Alexa account.

No need for a group in this case as @Massimo is only trying to expose one capability associated to a given device. Additionally, if you want to use a group as an endpoint, you need to configure its metadata configuration otherwise, it won’t be considered by the skill.

Actually you don’t need the Amazon Echo Control binding to use the Alexa skill. The skill gets access to your OH server through the cloud connector service as @Massimo outlined in the differences between the two integrations.

Thank you Jeremy. I try to create a new switch item. Alexa find it. I create only the item without linking it in a channel.

Switch LightSwitch "Test" {alexa="PowerController.powerState"}        

Then I try to create temperature like I do in my first post with another name. Alexa find the device but I want do the test without link the channel.

Number:Temperature Temperature2 "Test2" {alexa="TemperatureSensor.temperature"}

Then I try to create a new temperature item. I want to check if linking channel with the item let Alexa find it.
I can’t link item to my Things with web page. When I try I can’t find them in the channel configuration with system:default profile. I can see them only with the follow profile (I can’t understand why…)
So I use this code to link channel in my Items file

Number:Temperature Temperature3 "Test3" {alexa="TemperatureSensor.temperature", channel="mqtt:topic:08d8eeb4:Bagno_BME280_Temperatura"}

Then I scan for devices in Alexa APP and I find it.
In Alexa I see also “Temperatur Bad” my last configuration try.
I don’t understand what was the problem but when I try to find device after configuring switch item I have this screen in the Amazon alexa APP

I think that wasn’t an OpenHAB configuration problem but now it works.
Thank you all for support and thank you Jeremy to point me in the right direction.