Catch in .rules commands from Google Assitant

Tags: #<Tag:0x00007f617359a570> #<Tag:0x00007f617359a340>

Hi everyone

TL;DR : Is it possible to catch in .rules an event coming from Google Assistant ?

My goal is to open an old garage door and gate with google assistant, but they’re not yet “connected”. I managed to make the connected with a relay (KY019) + ESP8266 + zigbee2mqtt and it works just fine.

I needed access restrictions to my sitemaps (for personal reasons) and I managed to do that aswell thanks to this link.

So I have an Apache2 server to manage access restrictions.

So far so good.

Then I took a loot at Google Assistant integration and I wanted to do that. So I set up everything for it to work. I saw on the doc that it’s not possible to send custom commands because of the Google Assistant. Then I figured a trick to send custom commands to custom devices from Google Assistant:

  • My real custom device (ESP8266) in .items
Number Test_Relay {channel="mqtt:topic:***********:*********"}
  • A fake device in my .items
Rollershutter Garage_Rollershutter "Garage" {ga="Door"}
  • And a custom rule
rule "RuleOpenGarage"
when 
    Item Garage_Rollershutter received command UP
then 
    logInfo("RuleOpenGarage", "received  UP" + Garage_Rollershutter)
    Test_Relay.sendCommand("0") 
end

This way I thought the Google assistant would send command to the fake item when I say “Close garage door” the rule would catch the event and redirect the command as I wished to my ESP8266.

Maybe my Apache2 configuration is messing with what Cloud Connector needs to access, I can link my vHosts if needed.

But the logInfo doesn’t appear in my logs when I send a command via my Google Assistant. I’ve searched for the answer why the event was not triggered in my .rules but I found it nowhere.

More info : when I say “Ok Google open the garage door”, this is logged in openhab

Received HTTP POST request at 'items/Garage_Rollershutter' for the unknown item 'Garage_Rollershutter'

Thanks in advance

Playdric

I think NGNIX was messing up with everything, I uninstalled it completely and my trick now work

1 Like