Trigger an "virtual" Item via Google Home Assistant for starting a rule

Hey guys,

I got it already working that I can switch some Power Plugs on and off via Google Home Assistant. But I dont know how I can directly trigger a rule when I say for example that I’m leaving home. I can setup in the Google Home App some routines for that and Google triggers the Items directly. But I want to trigger just my own rule (or an virtual Item that can trigger a rule) because I wanna use Wake on Lan and Remote Shutdown abilities.
Can you help me please?

PS for your understanding: Remote Shutdown and WOL is already working but not through the speech assistant

Hi

That sounds like it should work.

Get Google Assistant to switch “on” a virtual item.

Create a rule that triggers when the virtual item changes to ON

And at the end of that rule, switch your virtual item OFF.

Does that help?

Okay this is my situation:
items config:

 Switch  ZuHause         "zu Hause sein"     (Home)  ["Switch", "Switchable"]    //Trigger für Sprachassistent für OpenHAB Regel
    Switch  Wach            "wach sein"         (Home)  ["Switch", "Switchable"]    //Trigger für Sprachassistent für OpenHAB Regel
    Switch  PCOff           "PC ausschalten"    (Home, LivingRoom)                  {http=">[OFF:GET:http://192.168.1.200:5001/]"}

This is my example rule:

rule "Switch wach sein"
    when
    Item Wach changed
    then
    if(Wach.state == ON){
        logInfo("info","Du bist jetzt aufgestanden")
        SteckdoseSchreibtisch_Switch.sendCommand("ON")
        ThermostatWohnzimmer_ThermostatMode.sendCommand(1)
        ThermostatSchlafzimmer_ThermostatMode.sendCommand(11)
    } else{
        logInfo("info","Du gehst jetz schlafen")
        ThermostatWohnzimmer_ThermostatMode.sendCommand(0)
        ThermostatSchlafzimmer_ThermostatMode.sendCommand(1)
        PCOff.sendCommand(OFF)
        if (timer_pc === null) {
            timer_pc = createTimer(now.plusSeconds(30), [ |
                SteckdoseSchreibtisch_Switch.sendCommand("OFF")
                timer_pc = null
            ])        
        }
    }
    end

I selected the items ZuHause and Wach in the cloud connector and I can see them in my Google Home App. But when I say for example that I am going to bed that Google cannot reach the items. I see them and can trigger it in the App but nothing happens. Can you help me?

Oh I see…

Have you added the “Switchable” tag to the items you want Google Assistant to switch?

Okay thanks for your tip. I changed the lines from

Switch  ZuHause         "zu Hause sein"     (Home)  ["Switch", "Switchable"]
Switch  Wach            "wach sein"         (Home)  ["Switch", "Switchable"]

to

Switch  ZuHause         "zu Hause sein"     (Home)  ["Switchable"]
Switch  Wach            "wach sein"         (Home)  ["Switchable"]

And now it work for me. Is it a bug or does it work as designed that you can’t multitag items for Home Assistant? Otherwise I have no idea why it do work now.

1 Like

I’ve got no idea…

This is openHAB2 :wink: