Google Home & openHAB connection How-To

Nope, works fine here without issues.
How about trying with just a test switch?

Switch TestSwitch "Test Switch" [ "Switchable" ]

Make sure to ask google to sync your devices: “OK Google, sync my devices”, which should result in a reply like “Ok, syncing your devices for OpenHAB”.

Then add the switch to Habpanel or BasicUI to monitor if you can switch the test switch

When I was facing a similar problem, I removed all other items from my file and only tried with the problematic one. Once you get it working, start adding more items (that are Google Home or Home Kit related).

Also, make sure your quotes are simple " and nothing fancy like “ ”, which seems to be the case with your code.

FIXED. Yay. Thanks for your advice RolfV. It works now and here is my string:
Switch Deck_Lights “Deck Lights” [ “Switchable” ] {mqtt=">[broker:/cmnd/sonoff-gpo4/POWER:command:ON:ON],>[broker:/cmnd/sonoff-gpo4/POWER:command:OFF:OFF]"}

Hello everybody,

I’m new on OpenHAB and trying to integrate KNX and Google Assistant.
Lighting and switches are working, but for thermostat, I have some problems.
I can read the ambient temperature, but mode, and set point as well is not operating.
here is items code:

Group    Office               "Office"         <office>        (Home)                   ["Room"]
Group    Library              "Library"        <office>        (Home)                   ["Room"]

Switch        demoSwitch         "Light [%s]"               <light>   (Library)  ["Switchable"]     { channel="knx:device:bridge:minbox:demoSwitch" }
Dimmer        demoDimmer         "Dimmer [%d %%]"           <light>    (Office)   ["Lighting"]   { channel="knx:device:bridge:dimbox:demoDimmer" }

Group g_office_thermostat "Thermostat" <climate> (Office) ["Thermostat"] 
    Number        cTemperature    "Temperature [%.1f °C]"    <temperature>  (g_office_thermostat) ["CurrentTemperature"]  { channel="knx:device:bridge:DMD:cTemperature" }
    Number        setp    "Set Point [%.1f °C]"  <temperature>  (g_office_thermostat) ["TargetTemperature"]  { channel="knx:device:bridge:DMD:setp" }
    Number        fanspeed    "Fan Speed [%.0f]"  <fan>  (g_office_thermostat)   { channel="knx:device:bridge:DMD:fanspeed" }
    Switch        mode         "Mode [%s]"   <heating>    (g_office_thermostat)   ["homekit:HeatingCoolingMode"]    { channel="knx:device:bridge:DMD:mode" }
    Switch        power         "Power [%s]"  <switch>   (g_office_thermostat) ["Switchable"]  { channel="knx:device:bridge:DMD:power" }

and here is things code:

Bridge knx:ip:bridge [ 
    ipAddress="192.168.1.236", 
    portNumber=3671, 
    localIp="192.168.1.37", 
    type="TUNNEL", 
    readingPause=50, 
    responseTimeout=10, 
    readRetriesLimit=3, 
    autoReconnectPeriod=1,
    localSourceAddr="0.0.0"
] {
    Thing device minbox [
        address="1.1.6",
        fetch=true,
        pingInterval=300,
        readInterval=3600
    ] {
        Type switch        : demoSwitch        "Light"       [ ga="0/0/6+<0/0/7" ]
        }
    Thing device dimbox [
        address="1.1.4",
        fetch=true,
        pingInterval=300,
        readInterval=3600
    ] {
        Type dimmer        : demoDimmer        "Dimmer"      [ switch="0/0/1", position="0/0/3+<0/0/5", increaseDecrease="0/0/2" ]
        }
     Thing device DMD [
        address="1.1.8",
        fetch=true,
        pingInterval=300,
        readInterval=3600
    ] {
        Type switch        : power        "switch"       [ ga="0/1/7+<0/1/8" ]
        Type switch        : mode        "heating"       [ ga="0/1/3" ]
        Type number        : cTemperature   "Temperature" [ ga="9.001:<0/1/4" ]
        Type number        : setp   "Temperature" [ ga="9.001:0/1/5+<0/1/6" ]
        Type number        : fanspeed   "fan" [ ga="5.010:<0/1/0" ]
        }
}

your helps appreciated.

Can you control it manually via the PaperUI Control or your sitemap?

yes, it’s working fine thru sitemap, paper-ui and Android app (openhab app)
as I understand, [“homekit:HeatingCoolingMode”] will change the mode by string, but in KNX mode will control by 1 bit object. 0 = cooling and 1 = heating mode and for switching on and off the thermostat, there is another 1 bit data point.
I guess I have to find a way to transform [“homekit:HeatingCoolingMode”] from string to number as explained.

I found the way
we should make one Item in order to read and store the status of thermostat thru HomeKit, and two rules to apply the homeKit to KNX and reverse.
this is my Item codes:

Group g_office_thermostat "Thermostat" <climate> (Office) ["Thermostat"] 
    Number        setp    "Set Point [%.1f °C]"  <temperature>  (g_office_thermostat) ["TargetTemperature"]  { channel="knx:device:bridge:DMD:setp" }
    Number        cTemperature    "Temperature [%.1f °C]"    <temperature>  (g_office_thermostat) ["CurrentTemperature"]  { channel="knx:device:bridge:DMD:cTemperature" }
    Number        fanspeed    "Fan Speed [%.0f]"  <fan>  (g_office_thermostat)   { channel="knx:device:bridge:DMD:fanspeed" }
    String        mode_f    "Thermostat Mode" <climate> (g_office_thermostat) ["homekit:HeatingCoolingMode"] 
    Switch        mode         "Mode [%s]"   <heating>    (g_office_thermostat)   { channel="knx:device:bridge:DMD:mode" }
    Switch        power         "Power [%s]"  <switch>   (g_office_thermostat) ["Switchable"]  { channel="knx:device:bridge:DMD:power" }

as you can see the mode_f is not linked to any KNX GA, and this is only to read and write from and to HomeKit
and here is rule to read data from homeKit and write it to KNX:

rule "thermostat from mobile"
    when
        Item mode_f received command
    then
        if (receivedCommand  == "cool")
            {
                sendCommand (power, ON)
                sendCommand (mode, OFF)
            }
        if (receivedCommand  == "heat")
            {
                sendCommand (power, ON)
                sendCommand (mode, ON)
            }
        if (receivedCommand  == "off")
            {
                sendCommand (power, OFF)
            }
         if (receivedCommand  == "on")
            {
                sendCommand (power, ON)
            }
 end

and rule to read From KNX and update HomeKit

rule "thermostat to mobile"
    when
        System started or
        Item power received update or
        Item mode received update 
    then
        if (power.state  == ON)
            {
                if (mode.state == ON)
                {
                    postUpdate (mode_f, "heat")
                }
                else
                {
                    postUpdate (mode_f, "cool")
                }
            }
            else
            {
                postUpdate (mode_f, "off")
            }
 end

Tested and works fine.
Hope it can help others…

1 Like

do you know homekit and google home work together ?

They don’t