Can Alexa Speak an OH value?

Was wondering if this was possible without writing an Alexa skill.

I get asked by my son frequently what the pools water temp is frequently as he itching to go swimming. The value is available to OH through the Aurelius binding. I have the value displayed on a home status board using HabPanel.

Is there a way to ask Alexa “What’s the pool temperature?” And have her read the value?

I currently use hue emulation with Alexa and was wondering if there was a way to extend the functionality.

Squid :squid:

Have you tried using the announce channel?

(I think that’s the name of the channel)

I had some fun at a client’s house, amusing him and his kids by making Alexa say silly things.

Unfortunately that will not accomplish what I’m looking to do.

Sorry, I thought you wanted the Alexa to spontaneously announce the temperature

So are you suggesting that you’d like your young and inquisitive one to be able to “ask Alexa” what the temperature of the pool is?

So in theory you only need to setup the Pool temperature as a Thermostat with only a current temperature sensor.

As described here, https://www.openhab.org/docs/ecosystem/alexa/

Search for “current temperature” on that page and in the group endpoint section you’ll find some information of use.

Depending on the information and control you have via the Aurelius interface, you might be able to control it via Alexa too.

I was very kindly assisted with the correct syntax for mapping Alexa to the Velbus thermostats, which have some very specific mode settings.

That is what I also wanted to suggest.
Tested it on my system, working for temp-sensors connected via a tasmota device, NOT working on the temperature item that is set by a rule. Still searching!

1 Like

I have a temperature item that is set only by a rule and I can definitely ask Alexa for the value.

Number Water_Temperature "Water [%.1f °F]" <temperature> [ "CurrentTemperature", "Fahrenheit" ]

This is set with postUpdate by a rule with various values:

Water_Temperature.postUpdate(75)

How does it not work for you? Does Alexa give you an incorrect value? Or not respond?

In my setup this item isn’t found by he Amazon Alexa App at all. I have used the v3 syntax.
The tasmota devices are found!

Maybe try the Item the way I have it to see if it works? Also, what is your Item? Mine has been working very well.

Ups, my items are Strings. I have to take a look why that was configured so. Persisting is working.

So my current pool temperature is defined as follows:

Number PoolWaterTemp "Pool Temperture  [%.1f °F]" { channel="autelis:jandy:poolcontrol:temp-pooltemp" }

So if I am reading what you mentioned above correctly I need to use a rule to post this as a Thermostat value…then Alexa can read it back to me using the Echo Binding? I take it there is no way to accomplish this with HUE Emulation? Just trying not to add more cloud connectors.

Thanks,

Squid

Try this. Just add the tags, then discover devices. Alexa keys off of the tags.

Number PoolWaterTemp "Pool Temperture  [%.1f °F]" [ "CurrentTemperature", "Fahrenheit" ] { channel="autelis:jandy:poolcontrol:temp-pooltemp" }
1 Like

@jswim788

Do you know if the HUE Emulation will pick this up or do I need to use the full ECHO binding?

IMHO that would be the openHAB skill of the Echo device, which does require the myopenHAB cloud.

You could put that together using the echo control binding, it’s similar in how I have the command “turn on/off the fan” work to turn on the ceiling fan by having a rule on the last command channel. You would still have to have a routine with that phrase as the command but you can have it just do nothing, like in my case I have it turn on a dummy switch that’s not bound to anything. Here’s what I have, it’s quick and dirty and I know there are other more complex but more flexible ways of doing this but it works for me and could be adapted for your use pretty easily. A few notes, all of my last command channels are in a group called GAlexa_LastCommand, so I could get capture the command from any echo and my items are defined as such:

String Echo_Kitchen_LastVoiceCommand              "Echo Kitchen Last Voice Command"                     (GAlexa_LastCommand)       {channel="amazonechocontrol:echo:echo_account:XXXXXXXXXR:lastVoiceCommand"}

The rule (Jython), which grabs the echo name (the bit between “Echo_” and “_LastVoiceCommand”), to know which room you’re in and acts accordingly.

@rule("Alexa Last Command")
@when("Member of GAlexa_LastCommand received update")
def alexaLastCommandEvent(event):
    if str(ir.getItem(event.itemName).type) == "Group":
        return
    echoName = event.itemName.replace("Echo_","").replace("_LastVoiceCommand","")
    echoCommand = event.itemState.toString()
   
    if echoCommand == "turn on the fan":
        events.sendCommand(echoName + "FanSpeed_Rules","100")
    elif echoCommand == "turn off the fan":
        events.sendCommand(echoName + "FanSpeed_Rules","OFF")

In your case, i’d probably do it kind of like this:
TTS item for the echo control binding (defined in the same pattern as LastVoiceCommand)

String Echo_Kitchen_TTS                           "Echo Kitchen TTS"                                    (GAlexa_TTS) {channel="amazonechocontrol:echo:echo_account:XXXXXXXXX:textToSpeech"}

and rule (i’d add to my existing rule, but for simplicity):

@rule("Alexa Last Command")
@when("Member of GAlexa_LastCommand received update")
def alexaLastCommandEvent(event):
    if str(ir.getItem(event.itemName).type) == "Group":
        return
    echoName = event.itemName.replace("Echo_","").replace("_LastVoiceCommand","")
    echoCommand = event.itemState.toString()
   
    if echoCommand == "what's the pool temperature":
        # Get value from item here
        events.sendCommand("Echo_" + echoName +  "_TTS", "Value of your pool item")

This should respond to the command “what’s the pool temperature” with the value of the item you have on the same echo you asked.

I use the Echo skill as @opus suggests. I suspect you’ll need it and not the Hue emulation. Is there a reason you don’t want to use the Echo skill? It works very well. No need for any rules, just discover devices and then control them via voice.

All we do with the Velbus thermostats is just add the tags / metadata and let Alexa discover new things via the myopenhab connection.

Changing my rule to postUpdate a number instead of a string did the trick. Now I do have Number items which are found by the Alexa App. However when asking “How is the outside temperature?” I get told the reported temperature in my location but not the one from my sensor. The same goes for “water temperature”. I get told at what emperature water is melting. If I ask for the temperature in the basement I get told the average temperature in basements. :rofl:
Still digging in…

Edit:
Solution found (sort off). Put each temperature sensor in a own group inside the Alexa App and do NOT use the names “Outside” (in German “Aussen”) nor “Water”. “Showerwater” worked., instead of “outside” I used “garden”.
What the heck!

1 Like

Reading the documentation of the skill it says it must be connected to myopenhab?

Can you use without?

Must use the myopenhab or your own hosted version. The language interpretation is in the Amazon cloud, so it needs a way to communicate.

Yes, here’s just the beginning of my rule that does exactly that. I have it speaking lots of values and doing things based on the TTS value.

AlexaCmds is a group tied to all the Amazon device TTS items.

//
// https://community.openhab.org/t/released-openhab2-amazon-echo-control-binding-controlling-alexa-from-openhab2/37844/1227?u=edwolfe3
// Alexa getting information from OH
//

rule "Alexa Status via Voice"
	when
		Member of AlexaCmds changed to "water softener status" or    				// listening words must be in lower case
		Member of AlexaCmds changed to "washing machine status" or 
		Member of AlexaCmds changed to "bedroom tablet dark" or
		Member of AlexaCmds changed to "bedroom tablet off" or
		Member of AlexaCmds changed to "basement tablet dark" or
		Member of AlexaCmds changed to "basement tablet off" or
		Member of AlexaCmds changed to "outside humidity" or 
		Member of AlexaCmds changed to "outside temperature" or 
		Member of AlexaCmds changed to "outside pressure" or 
		Member of AlexaCmds changed to "loft humidity" or 
		Member of AlexaCmds changed to "basement humidity" or 
		Member of AlexaCmds changed to "attic humidity" or 
		Member of AlexaCmds changed to "kitchen humidity" or 
		Member of AlexaCmds changed to "garage humidity" or 
		Member of AlexaCmds changed to "loft temperature" or 
		Member of AlexaCmds changed to "basement temperature" or 
		Member of AlexaCmds changed to "attic temperature" or 
		Member of AlexaCmds changed to "kitchen temperature" or 
		Member of AlexaCmds changed to "add ask temperature" or 
		Member of AlexaCmds changed to "add ask humidity" or 
		Member of AlexaCmds changed to "actiq temperature" or 
		Member of AlexaCmds changed to "actiq humidity" or 
		Member of AlexaCmds changed to "add a temperature" or 
		Member of AlexaCmds changed to "add a humidity" or 
		Member of AlexaCmds changed to "garage temperature" or
		Member of AlexaCmds changed to "mail delivered" or
		Member of AlexaCmds changed to "has mail been delivered" or
		Member of AlexaCmds changed to "status of mail delivered" or
		Member of AlexaCmds changed to "status of mail delivery" or
		Member of AlexaCmds changed to "open garage door" or
		Member of AlexaCmds changed to "open garage" or
		Member of AlexaCmds changed to "garage open" or
		Member of AlexaCmds changed to "close garage door" or
		Member of AlexaCmds changed to "close garage" or
		Member of AlexaCmds changed to "garage close" or
		Member of AlexaCmds changed to "sonos play" or
		Member of AlexaCmds changed to "play sonos" or
		Member of AlexaCmds changed to "sonos on" or
		Member of AlexaCmds changed to "sonos off" or
		Member of AlexaCmds changed to "stop sonos" or
		Member of AlexaCmds changed to "stop song" or
		Member of AlexaCmds changed to "tv off" or
		Member of AlexaCmds changed to "tea off" or
		Member of AlexaCmds changed to "hi off" or
		Member of AlexaCmds changed to "t v off" or
		Member of AlexaCmds changed to "television off" or
		Member of AlexaCmds changed to "smart home report" or
		Member of AlexaCmds changed to "smarthome report" or
		Member of AlexaCmds changed to "report" or
		Member of AlexaCmds changed to "inventory" or
		Member of AlexaCmds changed to "smart home inventory" or
		Member of AlexaCmds changed to "smarthome inventory" or
		Member of AlexaCmds changed to "smart home amatory" or
		Member of AlexaCmds changed to "sonos volume up" or
		Member of AlexaCmds changed to "sonos volume down" or
		Member of AlexaCmds changed to "ecobee on" or
		Member of AlexaCmds changed to "ecobee off" or
		Member of AlexaCmds changed to "last motion" or
		Member of AlexaCmds changed to "last motion location" or
		Member of AlexaCmds changed to "motion location" or
		Member of AlexaCmds changed to "lights on" or
		Member of AlexaCmds changed to "sonos stop"
	then

		// Get the room of the echo device                              
		var sourceRoom = triggeringItem.name.split("_").get(1)
		logInfo("ECHO", "-----------------------------------------------------------------------------")
		logInfo("ECHO", "sourceRoom = " + sourceRoom)
				
		// Use the room to specify the actual device TTS for the returned response
		var TheRoom_TTS = "Echo_"+sourceRoom+"_TTS"
		logInfo("ECHO", "TheRoom_TTS = " + TheRoom_TTS)
	
		// Show triggeringItem state
		logInfo("ECHO", "triggeringItem.state = " + triggeringItem.state)

		if (systemStarted.state != ON && Home_Away.state == ON && gInternet.state == ON && (triggeringItem.state == 'last motion' || triggeringItem.state == 'last motion location' || triggeringItem.state == 'motion location')) { 
	
			logInfo("ECHO", "Alexa Last Motion Location Status via Voice has been triggered using " + triggeringItem.name)

				Thread::sleep(1500)
			
			var String locationmap	  = null
			var String motionlocation = null
			locationmap    = transform("MAP", "lastmotionlocation.map", LastMotion_Location.state.toString())
			motionlocation = "    Last Motion Location is unknown to me at this time."
			
			if (systemStarted.state != ON && LastMotion_Location.state !== null && LastMotion_Location.state != NULL) {
				
				motionlocation = "    Last Motion Location was detected at " + locationmap + "."
			}
			
			TheRoom_TTS.sendCommand(motionlocation)
			logInfo("ECHO", "LastMotion_Location = " + motionlocation)	
			logInfo("ECHO", "-----------------------------------------------------------------------------")
		}

Best, Jay