Alexa, control Heating

myopenhab
openhab2
alexa
Tags: #<Tag:0x00007fd314f26ea0> #<Tag:0x00007fd314f26c98> #<Tag:0x00007fd314f26a68>

(Patrik) #1

Hello,

i have some problems to control my heating with Alexa. I have installed the openHabSkill on Alexa and connect it wirh myOpenHab account.

After that, i search for items and found only my defined group in Alexa ( where are the other Items?)

So far so good, actually o have a wall thermometer which is connected to two heating thermometer. The wall thermomether is connected to homegear and i’m able to control it over openHab2.

This are my Items:

/*************************************** Gruppen *******************************************************/
// --> Raum
Group gWohnzimmer 

// --> Funktion
Group gHeizung "Heizung" [ "Thermostat" ]

/*************************************** Items *********************************************************/
Number wz_hz_thermostat "Setze" ( gHeizung) ["TargetTemperature"]  {homematic="homematic:HG-HM-TC-IT-WM-W-EU:1ecedb21:****:2#SET_TEMPERATURE"}
Number wz_hz_temperatur "aktuelle Temperatur" ( gHeizung) ["CurrentTemperature"] {homematic="homematic:HG-HM-TC-IT-WM-W-EU:1ecedb21:****:2#ACTUAL_TEMPERATURE"}
Number wz_hz_luftfeuchtigkeit "aktuelle Luftfeuchtigkeit" ( gHeizung) ["CurrentHumidity"] {homematic="homematic:HG-HM-TC-IT-WM-W-EU:1ecedb21:****:2#ACTUAL_HUMIDITY"}

In Alexa, i only find the Group “Heizung”

If i say the following sentence.

“Alexa, setzte Heizung auf 22 Grad” ( Alexa, set Heizung to 22 degrees )
Answer:
“Die Heizung ist im Automatikmodus, die Solltemperatur beträgt 22 Grad”
( The heating is in automaticmodus, the the set temperature is 22 degrees"

After that, i see the following in the openhab event.log

2017-07-22 11:25:36.609 [ItemCommandEvent          ] - Item 'wz_hz_thermostat' received command 22
2017-07-22 11:25:36.624 [ItemStateChangedEvent     ] - wz_hz_thermostat changed from NULL to 22

However, the heating thermostat does not matter. Also in the Homegear.log is nothing to see.
Maybe someone has a tip what I do wrong … And the following commands recognizes Alexa unfortunately not at all:

“Alexa, Heizung aktuelle Luftfeuchtigkeit” - Antwort: “Heizung unterstützt das nicht” (Heizung does not support this)
“Alexa, Heizung aktuelle Temperatur” - Antwort: “Wetterbericht für meinen Ort…”


(Alex) #2

AFAIK [ “CurrentHumidity” ] is NOT supported at the moment. And you only see the group “Heizung” as a device in Alexa APP, that’s normal!

And you you need the maintag [ “Thermostat” ] AND ALL 3 childtags [ “CurrentTemperature” ], [ “TargetTemperature” ] and [ “homekit:HeatingCoolingMode” ]

see here: Official Alexa Smart Home Skill for openHAB 2

You have to tell Alexa the followings commands:

Alexa, set Thermostat to 22 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?

in german:
Alexa stelle Heizung auf 22 Grad.
Alexa reduziere Heizung um 2 Grad
Alexa erhöhe Heizung um 1 Grad
Alexa reduziere Heizung
Alexa wie ist Heizung eingestellt? (I’m not sure about this!!)
Alexa wie ist Heizung Temperatur?


(Metin) #3

Could you please also give an example how to use homekit:HeatingCoolingMode with Alexa? I would expect that I can set the heating mode to automatic/manual/off, but I have searched everywhere, and I seem not be able to find a documentation of this.


(Alex) #4

@metin

That’s a little bit tricky!

You need dummy-items and rules !!

If you also have Max!-binding, then you can do as follows: (it’s partially in german, sorry!)

In my example it have 3 modes: AUTO, MANUAL, BOOST

If I want to turn it OFF, I say “Alexa, set Kitchen Thermostat to 4.5 degrees”

.items

Group  GF_KitchenThermostat  "Küche Thermostat"      (gGF) [ "Thermostat" ]
String GF_Kitchen_maxMode    "Mode:" 	<snow>	     (gMAX, GF_Kitchen, GF_KitchenThermostat) [ "homekit:HeatingCoolingMode" ] {channel="max:thermostat:LKF0025489:MEQ1442698:mode"}
Number GF_Kitchen_maxActual  "IST Temperatur  [%.1f °C]" <temperature>	(gMAX, GF_Kitchen, Temperature1, GF_KitchenThermostat) [ "CurrentTemperature" ]	{channel="max:thermostat:LKF0025489:MEQ1442698:actual_temp"}
Number GF_Kitchen_maxSetTemp "SOLL Temperatur  [%.1f °C]" <temperature>  (gMAX, GF_Kitchen, GF_KitchenThermostat) [ "TargetTemperature" ] {channel="max:thermostat:LKF0025489:MEQ1442698:set_temp"}
Switch GF_Kitchen_manual	 "Küche manuell" [ "Switchable" ]
Switch GF_Kitchen_boost		 "Küche Turbo"   [ "Switchable" ]

.rules

rule "Max Küche manual"
	when
		Item GF_Kitchen_manual received command
	then
	    switch (receivedCommand) 
		{ 
			case ON:	{
			sendCommand(GF_Kitchen_maxMode, "MANUAL")					
			}
			case OFF:	{
			sendCommand(GF_Kitchen_maxMode, "AUTOMATIC")
			}
		}
end

rule "Max Küche Boost"
	when
		Item GF_Kitchen_boost received command
	then
	    switch (receivedCommand) 
		{ 
			case ON:	{
			sendCommand(GF_Kitchen_maxMode, "BOOST")					
			}
			case OFF:	{
			sendCommand(GF_Kitchen_maxMode, "AUTOMATIC")
			}
		}
end

In Alexa-APP --> Smart Home --> Groups–> you need a group named e.g. “Heizung Küche” and put inside this group your “device” = “Küche Thermostat”.

Utterances: Do you need it in german or english?


(Metin) #5

Thanks, this is very helpful. I will try this asap. However, does this mean that the [“homekit:HeatingCoolingMode”] is not actually used at all?

I am using MAX! devices, but they are paired with a CUL stick over Homegear, so I use the Homematic binding in openHAB, but it should not make a difference.

Re utterances: German is fine. .-)


(Alex) #6

@metin

If you have EXACTLY the same modes like homekit (“OFF, HEAT, COOL, AUTO, heat-cool” or “0,1,2,3”), which is not the case while using Max! (=MANUAL, AUTOMATIC, BOOST, VACATION, ((OFF= 4.5° C))) or Homematic (I don’t know the mode strings or numbers), then it should be possible without using rules. So in your case you have to use rules!!

Utterances in german:

Alexa stelle “Heizung Küche” auf 22 Grad.
Alexa reduziere “Heizung Küche” um 2 Grad
Alexa erhöhe “Heizung Küche” um 1 Grad
Alexa reduziere “Heizung Küche”
Alexa wie ist “Heizung Küche” eingestellt? (I’m not sure about this!!)
Alexa wie ist die Temperatur von “Heizung Küche”?

Alexa schalte “Küche manuell” ein/aus.
Alexa schalte “Küche Turbo” ein/aus.

I used “Turbo” because “german Alexa” don’t unterstand the word “Boost”. !!!


(Daniel Wilhelm) #7

Hi Patrik

A few weeks before i had the same problems with my Max!Thermostats. I have to implement more than 15 of these.
Now with help from another guy of the community it all works perfect…

here some examples of my codes… i will explain it here it only for my bedroom…

items.file

Group:Number:AVG	       gTemperature	"akt. Temperatur ansehen"	<temperature>   (Home)
Group:String:EQUAL         gHeatingMode "Modus"                                     (Home)

Number   F2_Bedroom_HeatingG        	"Heizung Gross"            	                            <heating>       (gHeating)          		                {channel="max:thermostat:KEQ0538054:OEQ1133869:set_temp"}
Number   F2_Bedroom_TemperatureG     	"Temperatur Schlafzimmer Gross"         	            <temperature>   (F2_Bedroom, gTemperature)                  {channel="max:thermostat:KEQ0538054:OEQ1133869:actual_temp"}
String   F2_Bedroom_ModeG      	        "Modus Schlafzimmer gross [MAP(maxcubeMode.map):%s]"    <heating>       (gHeatingMode)                              {channel="max:thermostat:KEQ0538054:OEQ1133869:mode"}
Number   F2_Bedroom_HeatingK         	"Heizung Klein"            	                            <heating>       (gHeating)          		                {channel="max:thermostat:KEQ0538054:OEQ1137726:set_temp"}
Number   F2_Bedroom_TemperatureK     	"Temperatur Schlafzimmer Klein"         	            <temperature>   (F2_Bedroom, gTemperature)                  {channel="max:thermostat:KEQ0538054:OEQ1137726:actual_temp"}
String   F2_Bedroom_ModeK      	        "Modus Schlafzimmer klein [MAP(maxcubeMode.map):%s]"    <heating>       (gHeatingMode)                              {channel="max:thermostat:KEQ0538054:OEQ1137726:mode"}

For the control with alexa I added some more lines in the items.file

Group   gSchlafGThermostat 			        "Heizung Schlafzimmer Gross" 							                    ["Thermostat"]
Number  SchlafGThermostatCurrentTemp 		"Heizung Schlafzimmer Gross Aktuelle Temperatur" 	(gSchlafGThermostat) 	[ "CurrentTemperature" ] 	{channel="max:thermostat:KEQ0538054:OEQ1133869:actual_temp"}
Number  SchlafGThermostatTargetTemperature 	"Heizung Schlafzimmer Gross Soll Temperatur" 		(gSchlafGThermostat)	[ "TargetTemperature" ] 	{channel="max:thermostat:KEQ0538054:OEQ1133869:set_temp"}

Group   gSchlafKThermostat 			        "Heizung Schlafzimmer Klein" 							                    ["Thermostat"]
Number  SchlafKThermostatCurrentTemp 		"Heizung Schlafzimmer Klein Aktuelle Temperatur" 	(gSchlafKThermostat) 	[ "CurrentTemperature" ] 	{channel="max:thermostat:KEQ0538054:OEQ1137726:actual_temp"}
Number  SchlafKThermostatTargetTemperature  "Heizung Schlafzimmer Klein Soll Temperatur" 		(gSchlafKThermostat)	[ "TargetTemperature" ] 	{channel="max:thermostat:KEQ0538054:OEQ1137726:set_temp"}

Then i build the following lines in sitemap for example of one room

		        Default item=F2_Bedroom_TemperatureG		
                Setpoint item=F2_Bedroom_HeatingG 			label="Schlafzimmer gross" 	step=0.5 minValue=4.5 maxValue=30.0
  	    		Selection item=F2_Bedroom_ModeG											mappings=[AUTOMATIC="Auto", MANUAL="Manuell", BOOST="Boost"]
                Default item=F2_Bedroom_TemperatureG	    		
                Setpoint item=F2_Bedroom_HeatingK 			label="Schlafzimmer klein" 	step=0.5 minValue=4.5 maxValue=30.0
 	    		Selection item=F2_Bedroom_ModeK											mappings=[AUTOMATIC="Auto", MANUAL="Manuell", BOOST="Boost"]

The mapping file…

AUTOMATIC=AUTO
MANUAL=Manuell
BOOST=BOOST

And for last I use a rule to trigger the change of the heating mode…

rule HeatingChangeMode //Heizung einstellen
when
    Item FF_Dining_Mode changed or
    Item FF_LivingRoom_ModeW changed or
    Item FF_LivingRoom_ModeK changed or
    Item FF_Kitchen_Mode changed or
    Item FF_Bathroom_Mode changed or
    Item F2_Bedroom_ModeG changed or
    Item F2_Bedroom_ModeK changed or
    Item F2_JoelRoom_Mode changed or
    Item F2_FabiRoom_ModeS changed or
    Item F2_FabiRoom_ModeW changed or
    Item F2_Bathroom_Mode changed
then
    switch (triggeringItem.name) {
        case 0 : sendCommand(triggeringItem.name, "AUTOMATIC")
        case 1 : sendCommand(triggeringItem.name, "MANUAL")
        case 2 : sendCommand(triggeringItem.name, "BOOST")
    }
end

I think the rule could be write a lttle bit easier, simple to look which of this heating item was changed… but at the moment it will also works in this way.

Pherhaps the example will help you…

And sorry for my english :wink: