Echo advanced thermostat control

I recently got an Echo, and after switching over to OH2 was able to get it to control my Eco Plugs (flashed with espeasy) fairly easily using the new Hue Emulation addon. Today I thought I would have a go at linking it to my CT100 zwave thermostat. Added the “TargetTemperature” tags to my setpoint items and everything just worked. So that got me thinking… since the Hue Emulation should allow the Echo to control anything that can be sent an on/off command; why couldn’t it control the other functions of the thermostat like mode?

I set up individual items and sitemap “buttons” for a couple modes. Despite being an inefficient use of space in the sitemap (compared to having a single switch with multiple mappings), the separate buttons reliably switch the modes on my thermostat. The echo even picks them up as devices.

When asking the Echo to, for example, “turn cool on” I get the response “sorry, the device cool is not responding…”. Evidently the addon doesn’t pass mappings as strictly ON.

Does anyone have any suggestions as to how this could be done? My other thought was to pass the command in the item definition similar to MQTT. This would actually be preferable as I don’t necessarily want the items on my sitemap individually, but either I do not know the correct syntax, or this does not work with zwave.

Snippet of my .items file

Number HVAC_Cool "Cool" ["Switchable"] {channel="zwave:device:zstick:node2:thermostat_mode"}
Number HVAC_Auto "Auto" ["Switchable"] {channel="zwave:device:zstick:node2:thermostat_mode"}


Sitemap

Switch item=HVAC_Mode label="HVAC Mode" mappings=[0="Off",1="Heating",2="Cooling",3="Auto"]
Switch item=HVAC_Cool mappings=[2="Cool"]
Switch item=HVAC_Auto mappings=[3="Auto"]


Your items are Number types, so they won’t accept ON/OFF commands, the sitemap file is not used at all (this is just for the UI’s). You could use a proxy item, an item (Switch) that exists only to execute a rule which in this case would turn your thermostat to the right mode.

Well that makes perfect sense now that it’s not midnight :wink: I had thought about rules, but thought there would be a more direct way of doing it.
I’m guessing one could use the rule to turn the switch back off immediately after it has been triggered onalso so that it is effectively a “one way” switch.

Got this working pretty easily. Alexa is somewhat picky about how your devices are named though, so I thought I’d share what I did. I’d like to say thanks to @digitaldan also for his work on the addon.

Initially I was working with switching between Auto and Cool modes that way I wouldn’t keep kicking the AC off during my testing. I named my virtual switches Auto and Cool respectively which worked fine right away because my cool setpoint is named AC. My heat setpoint is named “Heat” though, so when I went to add heat mode my naming convention had to change.

I then tried prefixing my switches with “Thermostat”. “Thermostat Cool,” “Thermostat Heat” etc, but Alexa apparently has a hard time with devices with similar names. The voice history showed that she understood what I said perfectly, but I would either be met with “I’m not sure how to help you with that” or “there are multiple devices…”

I believe I also tried the convention of “Cool Mode” “Heat Mode” etc. If I remember correctly, Alexa accepted the commands correctly, but they all triggered the heat switch in Openhab. My guess is that this is similar to the other problem in that Alexa had a hard time distinguishing between the similar names.

I eventually settled on the convention of “Airconditioner,” “Heater,” “Auto,” and “Thermostat” for the off command. This works since my setpoints are called AC and Heat.

Here’s an example of one of the rules. I don’t think it’s necessary to actually turn the switches back to the OFF state, I think a switch can be sent and ON command even when it’s already on, but I already put it in there so I left it. Heat and auto are done the same way, the switch named “Thermostat” is set up the opposite so I can say “Turn the thermostat off.”

rule "Mode Cool"
when
        Item HVAC_Cool received command ON
then
        sendCommand(HVAC_Mode, 2)
        sendCommand(HVAC_Cool, OFF)
end
1 Like