Thanks heaps to everyone who worked on this update - it works great for me and the documentation is very good.
Question - I have a number of temperature sensors that I would like Alexa to be able to deal with (ie tell me the temperature on request).
I have added to tags as follows:
Number Livingroom_Temp "Living Room Temperature [%.1f°C]" <temperature> (gMapDBpersist,gSQLpersist_every10Min) { mqtt="<[broker:/broadlink/temperature:state:JS(broadlinkt.js)]",alexa="TemperatureSensor.temperature"}
I can see the living room temperature in the Alexa App - so she does know about it.
When I ask “Alexa, what is the living room temperature?” the response I get is “Living room fan does not support that”. What do I need to add to get the correct response? I have tried creating a living room group and adding the sensor to that group - no joy.
I had a similar issue when setting up my thermostat. You usually don’t want to have the function name in the label. So, you should label your temperature sensor “Living Room” instead. No need for groups. They are usually used to send commands to a set of similar devices.
I have used the disruption caused by the move to v3 followed almost at the same time as adding a Echo Show 5 to my stable of Echo devices as a good time to redo my current setup.
I have removed my thing file and instead created all the things using PaperUI, I halso added all the AmazonEchoControl channels using PaperUI too, this took along time and meant I had to redo my thermostats too as previously that was also configured using files. So I think most of Alexa stuff is now in Paper UI and not using files. Yay!
Ok so with that background to the current major revamp I have done to my OH system and alexa integration I will continue to ask my questions of this v3 skill.
Some time ago I tried to set up OH and Alexa to understand local room devices so if I say
Alexa, turn on the light, she turns on the lights in that room.
Alexa, Whats the temperature in here? and she advises the rooms name and the current temp,
Alexa, turn up the heat. The target temperature is increased by 1 degree in that room.
lastly I did try to add a Heater, Fan and Dehumidifer to each room and under v2 that of course did not work I have to give them a unique name and cannot refer to them as local device types
I see in the documentation that there are now more device types defined, unfortunately Amazon have not included Heater, Fan or Dehumidifer, in fact the only extra one I can currently see some improvement with for me is that there is now a TV device type. (I will need to rename other stuff so that will work as I already have the livingroom TV called TV).
My question is have I interpreted the documentation correct and even with V3 API support I cannot have custom types such as Heater, Fan or Dehumidifier? My objective is simple to say Alexa, turn on heater and she will turn on the heater in that room.
Your interpretation is correct. The Alexa room awareness feature (aka Alexa-enabled groups) is derived from the majority of the current display categories. So, until Amazon adds new categories, there is no way to address these devices. You should vote on this improvement that covers your use case.
On a side note, you could use the Amazon Echo Control binding lastVoiceCommand channel and a proxy Alexa-linked activity item to mimic that feature from the OH side for unsupported categories.
Expanding from my previous fan example, here is how I set up room awareness for my fans in OH: (The Alexa activity device is just to allow a successful response back when issuing the voice command; it doesn’t control anything)
rule "Alexa Voice Command Updates"
when
Member of gAlexaVoiceCommand received update
then
val String Location = triggeringItem.name.split("Echo").get(0)
val String FanPowerState = transform("REGEX", "turn (on|off) (?:the )?fan", triggeringItem.state.toString)
if (FanPowerState !== null)
sendCommand(Location + "FanPower", FanPowerState.toUpperCase)
end
Vote submitted.
Very nice solution, I have around 80 commands on OH that I currently have setup using the AmazonEchoControl binding but I have each command exactly specified not like you have done which is way cooler using regex.
rule "Alexa local fan Updates"
when
Member of EchoCmds received update
then
logInfo("alexa-enabled-groups","Running local Fan state change")
val String sourceRoom = triggeringItem.name.split("_").get(0)
val String FanPowerState = transform("REGEX", "turn (on|off) (?:the )?fan", triggeringItem.state.toString)
if (FanPowerState !== null)
try {sendCommand(sourceRoom + "_Fan", FanPowerState.toUpperCase)}
catch(Throwable t) {sendCommand(sourceRoom+"_Echo_TTS","Something went wrong.")}
logInfo("alexa-enabled-groups",sourceRoom+"_Fan changed to "+FanPowerState.toUpperCase)
end
And this works great, one small issue is how do you get over her saying “A few things share the name fan, which one do you want?” I have so far always added a routine on the alexa app for every specific phrase I have used where all she does is say either checking for status requests or roger that for commands. How do you deal with it?
Regards
Paul
The main advantage of using activities or even scenes is that they are stateless from Alexa perspective, thus autoupdate="false. Another point is that it covers all the different variation you would request the command (e.g. “power on/off” or “switch on/off”) that you could incorporate in the command regex.
val String FanPowerState = transform("REGEX", "(?:power|switch|turn) (on|off) (?:the )?fan", triggeringItem.state.toString)
If going that route, make sure to name the device exactly how you would call it otherwise you will get the device name conflict message response.
And you can change the fan speed like this: Alexa, set the fan speed on Clima Sala to level two Alexa, set the fan on Clima Sala to high
If you don’t have access to that capability, then you will need to use a proxy item such as a dimmer not part of the group endpoint set as PercentageController and update your device fan speed levels based on the percentage level via a rule.
I was just starting to add voice control to my devices using the new v3 application and struggling a little bit with how to name all of my devices differently, but still make it simple enough to use.
This seems like a brilliant way to deal with identical devices controlled by different echo units. One question I have, would you be able to share the MAP file for the example? Do you need to list every potential command, or can that be put together like the REGEX in the rule?
I am not sure to fully understand your question. I am not using any mapping in my example. Everything is based of the triggering voice command item name for the location and regex matching of its state for the fan power state.
Keep in mind, this example provides a workaround for categories that aren’t supported by the Alexa-enabled groups feature as of yet. For the ones that are supported, you should be able to call the device category (e.g. turn on the lights or turn off the TV) as long as you linked your echo device to the relevant group.
Ahh, I see now. I did not understand the transform statement, but now I see it. I have just enough programming skills to do a few simple things and I could not figure out how that was working.
I have 2 rooms with entertainment systems and I was thinking that I would have trouble addressing the TV, cable box, or other devices without getting interference between the rooms even though I have an echo in each room and have the devices assigned to that room. I will continue working on my setup and see how it works. I still think this is a great idea on how to handle some of the voice commands. I was actually thinking since I have all of my devices connected to OpenHab, that I could use a single virtual player device to receive the commands from Alexa and a rule to interpret and send the command to the currently operating device, but it would be helpful if I could identify which Alexa device is sending the command so I would only need a single set of rules for both rooms. I was thinking that this looked like it would be able to make that happen.
Now I think about it. Using a mapping file in place of a complex regex to get the proper state may not be that bad of any idea and probably easier to maintain.
val String FanPowerState = transform("MAP", "alexa_cmds_fan.map", triggeringItem.state.toString)
if (FanPowerState != "")
sendCommand(Location + "FanPower", FanPowerState)
So I have had a little play with the ‘alexa=“activity”’ now you have explained it, that makes it very interesting as a viable alternative to using routines.
I did try adding switch as an alternative to turn and it did not like it, spat out this error in the log
Cannot convert 'SWITCH' to a command type which item 'BR4_Heater' accepts: [OnOffType, RefreshType]
Is this an Amazon limitation?
As normally I can use switch or turn to control on/off devices.
I have converted eight routines across to “activitys” and think it is better way to go, I have made a single rule that deals with multiple devices, rather than a separate rule each that I used to use with exact matching. There are still many cases where I am going to keep the routine approach for now, but I will be looking through my long list of routines to see which can be converted.