Have Alexa tell me the room temperature using Cloud Connector and Xiaomi temperature sensors

Tags: #<Tag:0x00007f616ce24bc0> #<Tag:0x00007f616ce24af8>

I’m struggling with setting up a configuration where Alexa can tell me the room temperature. I’d like to set the target temperature as well, but for a start I want to focus on getting the current temperature.

First I read the docs at https://www.openhab.org/docs/ecosystem/alexa/ and tried to work with the sample

Group  Thermostat    "Bedroom"                                {alexa="Endpoint.Thermostat"}
Number Temperature   "Temperature [%.0f F]"    (Thermostat)   {alexa="TemperatureSensor.temperature"}

So I’ve created a group and an item:

Group    GsfWrTempAlexa "Workroom" {alexa="Endpoint.Thermostat"}
Number   IsensorsSfWrHeating_TemperatureAlexa "Temperature in Workroom [%.0f C]"
<temperature> (GsfWrTempAlexa) {alexa="TemperatureSensor.temperature", channel="mihome:sensor_weather_v1:xyz:temperature"}

I checked the items in the Cloud Service and found:

{
		"members": [],
		"link": "https://myopenhab.org/rest/items/GsfWrTempAlexa",
		"state": "NULL",
		"editable": false,
		"type": "Group",
		"name": "GsfWrTempAlexa",
		"label": "Arbeitszimmer",
		"tags": [],
		"groupNames": []
},
{
		"link": "https://myopenhab.org/rest/items/IsensorsSfWrHeating_TemperatureAlexa",
		"state": "NULL",
		"stateDescription": {
			"pattern": "%.0f C",
			"readOnly": true,
			"options": []
		},
		"editable": false,
		"type": "Number",
		"name": "IsensorsSfWrHeating_TemperatureAlexa",
		"label": "Temperature in Workroom",
		"category": "temperature",
		"tags": [],
		"groupNames": ["GsfWrTempAlexa"]
}

I then had Alexa discover new devices. Both (Group and Item) were found. But when I said "Alexa, tell me the temperature in workroom, Alexa told me that workroom was not responding.

I found it suspicious that there were no tags stored, because for my power plugs I’ve tagged the items with “Switchable”. So I tagged IsensorsSfWrHeating_TemperatureAlexa with “CurrentTemperature”. After a re-discovery Alexa kept complaining about not getting a response. I even tried changing the room name to help Alexa, but still no success.

The REST API reported the tag I set btw:

{
		"link": "https://myopenhab.org/rest/items/IsensorsSfWrHeating_TemperatureAlexa",
		"state": "NULL",
		"stateDescription": {
			"pattern": "%.0f C",
			"readOnly": true,
			"options": []
		},
		"editable": false,
		"type": "Number",
		"name": "IsensorsSfWrHeating_TemperatureAlexa",
		"label": "Testroom",
		"category": "temperature",
		"tags": ["CurrentTemperature"],
		"groupNames": ["GsfWrTempAlexa"]
	}

What am I doing wrong? Is there somewhere a tutorial which tells me the exact steps for this task?

Best regards,
cd_

I’ve got mine working with Alexa and Google, and both are using the Google Assistant method with tags:

For example:

Group gLNG_Thermostat "Lounge Thermostat" <heating>	["Thermostat"]
Number LNG_Heating_TargetTemp "Lounge Target [%.1f °C]"         <heating> 	(gLNG_Thermostat)  ["TargetTemperature"]
Number LNG_Humidity1 "Lounge Humidity [%.1f %%]" 			    <humidity> 	(gLNG_Thermostat)    ["CurrentHumidity"] 	{mqtt="<[mosquitto:esp-lng-1/env/humidity:state:default]"}
Number LNG_Temp1 "Lounge Temperature [%.1f °C]" 			    <temperature> 	(gLNG_Thermostat)  ["CurrentTemperature"] 	{mqtt="<[mosquitto:esp-lng-1/env/temperature:state:default]"}

As said, these are working for both Alexa and Google Assistant.

Thank you! It helped to tag the group as well! Now it works!

Two things which I still find mentionable:

  1. Why didn’t it work using the tags specified in the cloud Alexa Smart Home Skill docs?
  2. It took a while (1-2 minutes) until the Alexa Skill recognized the new item.

Best regards,
cd_

Your temperature item didn’t have a proper state at the time the skill tried to get its current status. You can check the troubleshooting documentation for more information.

I will have a look at the troubleshooting docs, thanks!