Custom alexa announcement with temperature

Hi guys!

I am new to hubitat, i came from smartthings.
I set up everything fine, so next step is alexa integration.

I want to make the followings:

When i open a door (contact sensor) alexa welcomes me, and tells the temperature of the house (temp sensor)
So smething like this:
"Hello, Welcome Brian! The temperature is 25 celsius. "

How can i do this?

Thanks
Brian

Hi @brain - welcome to Hubitat!

What you want to do is definitely possible, but you'll need to add one of two community integrations:

or

Both of these create devices that can be used for text-to-speech (TTS). You can then create a rule in Rule Machine that sends a speech notification to the desired Alexa speaker when the chosen contact sensor opens.

1 Like

The two apps recommended are great and I use Echo speaks to make many announcements for various things.

I think, however, you can do what you asked using just a Alexa Routine . I am pretty sure Alexa routines can be triggered off of contact sensors. With the new Alexa custom action you can type in a phrase that Alexa will execute.

Using Echo Speaks will definitely give you more flexibility though.

1 Like

I was thinking along these same lines. However, you don't need the custom actions to have Alexa say something. And yes, it can be triggered with a virtual contact with switch. This works best when you have a small vocabulary of things you want Alexa to say.

In this particular use case, I don't know how you'd pass a variable (the temperature) without having a switch and routine for every possible temperature. Would love to learn something different, though.

I was thinking you could use custom actions to get the house temp. With custom actions you could type "Alexa what is House thermostat temperature", and set which device you want it to speak to.

1 Like

Yes, if you have an Alexa side skill such as Ecobee, you could do exactly that. Maybe not in as brief a wording as OP states, but close enough.

You can read back temp from other devices as well, such as motion sensors, if they support temp readings, not just thermostats. No side skill required..

1 Like

Thanks @aaiyar!

Yeah, i know echo speaks, but never tried it.
I know i can make custom speech, but can i make the exact sentence with it?
So like: "Hello Brian! The temperature is %temp "
Something like this what i need.

Thanks @terminal3!

I want this kind of sentence, like in the movies :slight_smile:
"Hello Brian! The temperature is 23 celsius, have a great day"

So i need an app like this:
"Hello Brian! The temperature is %temp, have a great day"

Yes

I really can't found how to make this in echo speaks.

When i try to edit the sentence in the response designer, its only allows
the trigger's device's variables to put in.

How can i put another device's variables into the sentence.

So for example i want the trigger to be a contact sensor, but read the value from the temperature sensor

Andrew

You can do this using Rule Machine. I used to do this when I used Rule Machine. If I have time later today, I'll set it up again and post the Rule.

I checked in the rule machine, but i think it is the same like in echo speaks
where only trigger's device can be use:

"Use %device% to include event device name, %value% to include event value, %time% to include event time, %date% to include event date, %now% for current time.
To include global variable value use %global-variable-name%."

My recollection is that you need to first create a global variable that contains the temperature. And then RM can use the GV.

Ohh, now that's above my knowledge :smiley:
I wait for your example, if you don't mind.

Thank you!

It is fairly simple - here's how you can do it using RM:

  1. Create a global variable (decimal type) that will hold the temperature

Screen Shot 2020-12-27 at 1.52.52 PM

  1. Use a rule to update this GV every time the temperature changes

Screen Shot 2020-12-27 at 1.53.18 PM

  1. Use a rule to announce the value of this GV using the trigger of your choice

Screen Shot 2020-12-27 at 1.53.38 PM

And to make it even easier - I have attached the two rules below, so you can just import them:

{"deviceReplacements":{"1734":{"deviceName":"DoNS-MyPhone","deviceLabel":"DoNS-MyPhone","deviceTypeName":"DoNS-Email","deviceTypeNamespace":"adsavia"},"4557":{"deviceName":"Generic Z-Wave Contact Sensor","deviceLabel":"Contact - Garage Door","deviceTypeName":"Generic Z-Wave Contact Sensor","deviceTypeNamespace":"hubitat"},"285":{"deviceName":"Pushover","deviceLabel":"Pushover","deviceTypeName":"Pushover driver","deviceTypeNamespace":"hubitat"},"1098":{"deviceName":"Fibaro Motion Sensor ZW5","deviceLabel":"Motion & Lux - Living Room","deviceTypeName":"Fibaro Motion Sensor ZW5","deviceTypeNamespace":"hubitat"}},"appReplacements":{"4817":{"appTypeName":"Rule-4.0","appTypeNamespace":"hubitat","appName":"Rule-4.0","appLabel":"Contact Sensor Open - Send Temp Notification","parentAppTypeName":"Rule Machine","parentAppLabel":"Rule Machine","singleInstance":false},"4816":{"appTypeName":"Rule-4.0","appTypeNamespace":"hubitat","appName":"Rule-4.0","appLabel":"Temp changes - set GV","parentAppTypeName":"Rule Machine","parentAppLabel":"Rule Machine","singleInstance":false}},"appData":{"4817":{"state":{"actionListMain":["1"],"lastEvtValue":0,"installed":true,"connectors":{},"actionDone":true,"waitEvents":[],"private":"true","gvList":["VirtTemp"],"hasDevice":null,"hasRuleAct":false,"selectActionsParams":{"thisStr":"Main","label":"Contact Sensor Open - Send Temp Notification"},"editCondIf":null,"ndx.true":2,"allVars":{"VirtTemp":{"val":70.1,"type":"Decimal"}},"simpleCond":false,"usesTime":false,"nestedRepIf":[],"lastEvtTime":"13:53","trigCustoms":[],"repeating":[],"capabDone":true,"cutAction":[],"locationBlocked":[],"stopped":false,"ndx.false":2,"lvList":[],"nestedLabel":[],"paramNdx":1,"ruleNdx":1,"timeTriggers":[],"allVarsO":["VirtTemp"],"actLabelIndent":"","howManyT":2,"howMany":2,"subscribedVariables":[],"certainTimes":[],"varUseList":{},"waitCondNdx":1,"prevState":{"PB":"true","4557":"closed"},"capabsfalse":{"1.false":"Contact - Garage Door open"},"timeTriggersW":{},"capabstrue":{"1.true":"Contact - Garage Door open","2.true":{}},"timeFormat":"HH:mm","lastEvtDate":"27-Dec-2020","waitConds":[],"actionsMain":{"1":{"wait":null,"delay":"","modes":{},"method":"getMsg","indent":"","rule":0,"label":"Notify DoNS-MyPhone and Speak on Pushover: 'The current temperature is %VirtTemp%'\\n","cond":0}},"nestedInIf":[],"actNdx":2},"appSettings":[{"deviceList":null,"multiple":false,"name":"tCapab1","type":"enum","value":"Contact"},{"deviceList":null,"multiple":false,"name":"tCapab2","type":"enum","value":""},{"deviceList":null,"multiple":false,"name":"actionDone","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"msgMain.1","type":"textarea","value":"The current temperature is %VirtTemp%"},{"deviceList":null,"multiple":false,"name":"runAction","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"pausRule","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"actSubTypeMain.1","type":"enum","value":"Send or Speak a Message"},{"deviceList":{"1734":null},"multiple":true,"name":"noteMain.1","type":"capability.notification","value":null},{"deviceList":null,"multiple":false,"name":"insertAct","type":"enum","value":""},{"deviceList":null,"multiple":false,"name":"delete","type":"enum","value":""},{"deviceList":null,"multiple":false,"name":"state1","type":"string","value":"open"},{"deviceList":{"4557":null},"multiple":true,"name":"tDev1","type":"capability.contactSensor","value":null},{"deviceList":null,"multiple":false,"name":"tstate1","type":"enum","value":"open"},{"deviceList":null,"multiple":false,"name":"rCapab1","type":"enum","value":"Contact"},{"deviceList":{"285":null},"multiple":true,"name":"speakMain.1Device","type":"capability.speechSynthesis","value":null},{"deviceList":null,"multiple":false,"name":"actionCancel","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"editAct","type":"enum","value":""},{"deviceList":null,"multiple":false,"name":"comments","type":"textarea","value":""},{"deviceList":null,"multiple":false,"name":"hasAll","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"ranMsgMain.1","type":"bool","value":""},{"deviceList":null,"multiple":false,"name":"cancelCapab","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"cutAct","type":"enum","value":""},{"deviceList":{"4557":null},"multiple":true,"name":"rDev1","type":"capability","value":null},{"deviceList":null,"multiple":false,"name":"stopRule","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"delayActMain.1","type":"bool","value":""},{"deviceList":null,"multiple":false,"name":"origLabel","type":"text","value":"Contact Sensor Open - Send Temp Notification"},{"deviceList":null,"multiple":false,"name":"actTypeMain.2","type":"enum","value":""},{"deviceList":null,"multiple":true,"name":"logging","type":"enum","value":null},{"deviceList":null,"multiple":false,"name":"editCond","type":"enum","value":""},{"deviceList":null,"multiple":false,"name":"actTypeMain.1","type":"enum","value":"Send, Speak or Log a Message, Send HTTP Request"},{"deviceList":null,"multiple":false,"name":"speakMain.1","type":"bool","value":"true"},{"deviceList":null,"multiple":true,"name":"deleteAct","type":"enum","value":null},{"deviceList":null,"multiple":false,"name":"updateRule","type":"button","value":""}],"subscriptions":[{"handler":"allHandler","name":"contact.open","type":"DEVICE","typeId":4557,"typeName":"Contact - Garage Door","filter":"true"}]},"4816":{"state":{"lastEvtValue":0,"actionListMain":["1"],"installed":true,"waitEvents":[],"private":"true","connectors":{},"actionDone":true,"gvList":["VirtTemp"],"hasDevice":null,"hasRuleAct":false,"ndx.true":2,"selectActionsParams":{"thisStr":"Main","label":"Temp changes - set GV"},"editCondIf":null,"allVars":{"VirtTemp":{"val":70.1,"type":"Decimal"}},"simpleCond":false,"nestedRepIf":[],"usesTime":false,"lastEvtTime":"13:53","trigCustoms":[],"repeating":[],"capabDone":true,"cutAction":[],"locationBlocked":[],"stopped":false,"ndx.false":1,"lvList":[],"nestedLabel":[],"paramNdx":1,"ruleNdx":1,"timeTriggers":[],"allVarsO":["VirtTemp"],"actLabelIndent":"","howManyT":2,"subscribedVariables":[],"certainTimes":[],"varUseList":{},"waitCondNdx":1,"prevState":{"PB":"true"},"capabsfalse":{},"timeTriggersW":{},"capabstrue":{"1.true":"Temperature of Motion & Lux - Living Room(<span style='color:black'>74.5</span>) *changed* ","2.true":{}},"timeFormat":"HH:mm","lastEvtDate":"27-Dec-2020","waitConds":[],"actionsMain":{"1":{"wait":null,"delay":"","modes":{},"method":"getSetVariable","indent":"","rule":0,"label":"Set VirtTemp to Motion & Lux - Living Room Temperature\\n","cond":0}},"nestedInIf":[],"actNdx":2},"appSettings":[{"deviceList":null,"multiple":false,"name":"tCapab1","type":"enum","value":"Temperature"},{"deviceList":null,"multiple":false,"name":"tCapab2","type":"enum","value":""},{"deviceList":null,"multiple":false,"name":"actionDone","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"valOffsetMain.1VirtTemp","type":"decimal","value":"0"},{"deviceList":null,"multiple":false,"name":"runAction","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"pausRule","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"actSubTypeMain.1","type":"enum","value":"Set Variable"},{"deviceList":null,"multiple":false,"name":"numOpMain.1VirtTemp","type":"enum","value":"sensor value"},{"deviceList":null,"multiple":false,"name":"insertAct","type":"enum","value":""},{"deviceList":null,"multiple":false,"name":"delete","type":"enum","value":""},{"deviceList":{"1098":null},"multiple":true,"name":"tDev1","type":"capability.temperatureMeasurement","value":null},{"deviceList":null,"multiple":false,"name":"tstate1","type":"text","value":"*changed*"},{"deviceList":null,"multiple":false,"name":"actionCancel","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"editAct","type":"enum","value":""},{"deviceList":null,"multiple":false,"name":"myVarsMain.1","type":"enum","value":"VirtTemp"},{"deviceList":null,"multiple":false,"name":"comments","type":"textarea","value":""},{"deviceList":null,"multiple":false,"name":"hasAll","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"cancelCapab","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"cutAct","type":"enum","value":""},{"deviceList":{"1098":null},"multiple":false,"name":"valDevMain.1VirtTemp","type":"capability.temperatureMeasurement","value":null},{"deviceList":null,"multiple":false,"name":"stopRule","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"delayActMain.1","type":"bool","value":""},{"deviceList":null,"multiple":false,"name":"origLabel","type":"text","value":"Temp changes - set GV"},{"deviceList":null,"multiple":false,"name":"ReltDev1","type":"enum","value":"*changed*"},{"deviceList":null,"multiple":false,"name":"valCapabMain.1VirtTemp","type":"enum","value":"Temperature"},{"deviceList":null,"multiple":false,"name":"actTypeMain.2","type":"enum","value":""},{"deviceList":null,"multiple":true,"name":"logging","type":"enum","value":null},{"deviceList":null,"multiple":false,"name":"editCond","type":"enum","value":""},{"deviceList":null,"multiple":false,"name":"actTypeMain.1","type":"enum","value":"Set Mode, Variables or File, Run Custom Action"},{"deviceList":null,"multiple":true,"name":"deleteAct","type":"enum","value":null},{"deviceList":null,"multiple":false,"name":"updateRule","type":"button","value":""}],"subscriptions":[{"handler":"allHandler","name":"temperature","type":"DEVICE","typeId":1098,"typeName":"Motion & Lux - Living Room","filter":"true"}]}}}
1 Like

Done. Check the post above this one.

Thank you!

I really appreciate your help!

I try to rebuild from draft what you did to understand it.
Screen Shot 2020-12-27 at 1.53.18 PM

At this point, what did you choose actions to run?
-Set mode, variables or file, run custom action
and then
-set variable

?

Set Variable (and then choose Sensor Value).

To make it simple, why not just import the exported rules that I pasted above? To do so, save the JSON to a file on your computer, and then use the import function of RM to import the rule.

I wanted to rebulid it, but now i understand it and succes :slight_smile:
Thank you for your help.

Now i am happy :smiley:

2 Likes