How to connect your HestiaPi to Amazon Alexa


#1

EDIT: I managed to connect my HestiaPi to Alexa - details below!

Just curious if anyone has been able to get Alexa to recognize your HestiaPi?

From the Openhab docs it appears that /etc/openhab2/items/default.items will have to be changed:

Items that you wish to expose to Alexa will need to be tagged to identify what type of device Alexa will see them as. See https://www.openhab.org/addons/integrations/homekit/ 4.6k for more information. Lighting, switchable and thermostat tags are currently supported (although not limited to those types of items). Thermostat control must use the Homekit style grouping to associate temperature, mode and set point, see the Homekit binding ReadMe above.

The example ends up with this:

Group  Thermostat    "Thermostat"                             {alexa="Endpoint.Thermostat"}
Number Temperature   "Temperature [%.0f F]"    (Thermostat)   {alexa="TemperatureSensor.temperature" [scale="Fahrenheit"]}
Number HeatSetpoint  "Heat Setpoint [%.0f F]"  (Thermostat)   {alexa="ThermostatController.upperSetpoint" [scale="Fahrenheit"]}
Number CoolSetpoint  "Cool Setpoint [%.0f F]"  (Thermostat)   {alexa="ThermostatController.lowerSetpoint" [scale="Fahrenheit"]}
Number Mode          "Mode [%s]"               (Thermostat)   {alexa="ThermostatController.thermostatMode" [OFF=0,HEAT=1,COOL=2,AUTO=3]}

Don’t quite understand how the tagging would apply to the HVAC HestiaPi default.items file yet as there’s is so much in there, but I plan to give it a go.

More info here: https://github.com/openhab/openhab-alexa/blob/master/USAGE.md


#2

I made the following changes to /etc/openhab2/items/default.items. Alexa can now find & add the HestiaPi, but doesn’t yet get any response from it. The last Mode line doesn’t do anything yet:

Group Thermostat "Thermostat" { alexa="Endpoint.Thermostat" }

Number MyTempProxy "Temperature [%.0f °F]" <temperature> (Thermostat) { mqtt=">[mosquitto:hestia/local/temperature:state:*:default]", alexa="TemperatureSensor.temperature" [scale="Fahrenheit"] }

Number TempMaxSetpoint "Temperature Max Setpoint[%.0f °F]" (Thermostat) { mqtt=">[mosquitto:hestia/local/tempmaxsetpoint:state:*:default],<[mosquitto:hestia/local/settempmaxsetpoint:state:default]", alexa="ThermostatController.upperSetpoint" [scale="Fahrenheit"] }

Number TempMinSetpoint "Temperature Min Setpoint[%.0f °F]" (Thermostat) { mqtt=">[mosquitto:hestia/local/tempminsetpoint:state:*:default],<[mosquitto:hestia/local/settempminsetpoint:state:default]", alexa="ThermostatController.lowerSetpoint" [scale="Fahrenheit"]}

Number Mode "Mode [%s]" (Thermostat) { alexa="ThermostatController.thermostatMode" [OFF=0,HEAT=1,COOL=2,AUTO=3] }

#3

Here are the steps to get your HestiaPi connected to Alexa (USA HVAC version). Well almost, I still have to get the Mode functionality done.

  • Set up an account at myopenhab.org to connect your HestiaPi to the “cloud”
  • You’ll need you UID & Secret values to link your HestiaPi. These should already exist (if you used the hestia-pi-touch-* image) at /var/lib/openhab2/uuid and /var/lib/openhab2/openhabcloud/secret
  • Edit your /etc/openhab2/items/default.items file:

Insert these lines:

Group  Thermostat    "Thermostat"                             {alexa="Endpoint.Thermostat"}
Number Mode          "Mode [%s]"               (Thermostat)   {alexa="ThermostatController.thermostatMode" [OFF=0,HEAT=1,COOL=2,AUTO=3]}

Change these lines:

Number MyTempProxy "Temperature [%.0f °F]" <temperature> (Thermostat) { mqtt=">[mosquitto:hestia/local/temperature:state:*:default]", alexa="TemperatureSensor.temperature" [scale="Fahrenheit"] }
Number TempMaxSetpoint "Temperature Max Setpoint[%.0f °F]" (Thermostat) { mqtt=">[mosquitto:hestia/local/tempmaxsetpoint:state:*:default],<[mosquitto:hestia/local/settempmaxsetpoint:state:default]", alexa="ThermostatController.upperSetpoint" [scale="Fahrenheit"] }
Number TempMinSetpoint "Temperature Min Setpoint[%.0f °F]" (Thermostat) { mqtt=">[mosquitto:hestia/local/tempminsetpoint:state:*:default],<[mosquitto:hestia/local/settempminsetpoint:state:default]", alexa="ThermostatController.lowerSetpoint" [scale="Fahrenheit"]}

Edit your /etc/openhab2/rules/default.rules file:

rule "set Cooling Mode"
when
        Item MyTempProxy received update
then
        Mode.postUpdate("3")
end

NOTE: This is a dummy function to keep Alexa happy, doesn’t change the mode yet.

  • Next install/open to the Alexa app on your smartphone.
  • Add the openHAB skill if you haven’t yet. Select menu top left, select Skills & Games and search for openHAB. If I remember correctly, it may ask for permission to access the openHAB app here.
  • To add your HestiaPi to Alexa, select the Devices icon on the bottom right, then the + icon top right. Add Device, Thermostat, * Other then DISCOVER DEVICES. The app should find your HestiaPi after several seconds.
  • When the app finds your HestiaPi, select SET UP YOUR DEVICE, add it to a group or select SKIP, finally select DONE
  • You should see a Thermostats icon on your DEVICES page
  • When you select it you should see the current Max & Min setpoints in addition to the current temperature.

You should now be able to say thing like:

Alexa, set Thermostat to 78 degrees
Alexa, decrease Thermostat by 2 degrees
Alexa, increase Thermostat by 1 degrees
Alexa, decrease Thermostat
Alexa, what is Thermostat set to?
Alexa, what is Thermostat temperature?

I still have to test these commands though, as I think the openHAB rules only support incremental temperature changes. You definitely can adjust the temperatures on the Thermostat page in Alexa.

I’m busy working on being able to set the Mode via openHAB, which will allow you to turn on the A/C or heating via Alexa.

Let me know if you figure out any improvements!