Get item state via Google DialogFlow (former API.AI)

Hi there,

my goal:
I’d like to ask my google home device for the state of an openHAB item.
In detail: I’d like to know when garbage/trash will be collected (which means I need to put out the garbage bin).

So I’d like to create my own Action and right now I am stuck at DialogFlow. Unfortunately DialogFlow’s UI supports only POST requests, but I need to send a GET request to openHAB’s REST API. This means I need to go the hard way via the new Inline Editor (like Glitch).

Has anyone a working sample?

Stefan

1 Like

Hi @StefanH,

I’m working on my side project utilizing DialogFlow and Google Cloud Functions.
This project is a really good example -> https://github.com/actions-on-google/apiai-facts-about-google-nodejs/

I think that at some point we would need to incorporate DialogFlow inside openHAB Action for Google Assistant if we want to be able to respond to user’s queries like what’s the items state etc. @MARZIMA do you think it would be possible?

I’m willing to help in the future with incorporating DialogFlow in openHAB Action, as I have some experience with it.

Cheers,
Kuba

2 Likes

Hi Guys,

sounds cool. Please keep in mind the OH Action is based on Actions SDK and not on API.AI.
You need to be aware that for smarthome Actions Google made strictly the Actions SDK way. So from my knowledge the API.AI approach is a more generic one, whereas the Smarthome Actions are more specific for the smarthome domain. Similiar as with Alexa and the generic skills and the smarthome skill approach.

So I would be happy to have you guys involved. @kubawolanin & @StefanH can you check if we can fullfill your stuff by the upcomming official „OH Google Action“? Can we squeeze it in by reusing the smarthome API of google smarthome actions. Maybe it is covered by the current Google API for smarthome Actions?

If not and there is the requirement for having more complex, specific conversations we should put this efforts under one common umberella and join forces. I guess the main things for Google Assistant + OH items will be served by the official Action (under review and QA at Google). But I am a big fan of extending it as much as we think it makes sense for the community…

BR Mehmet

1 Like

thanks for your replies, but I have the feeling your are overrating my skills :wink: my coding skills are average (hobby, not professional) and I am completely new to this stuff here. I installed openhab 2 weeks ago :wink: then I found a video in the internet that explained how to build your own google action with API.AI in less than 10min. impressive. unfortunately this video is based on an HTTP POST request, but to read an items state in OH I need to use a GET request. that’s my current problem :wink:

I must admit, I don’t like the dependency on external openhab-cloud for the upcoming offical openhab / google action. I’d rather like to use my local instance of openhab-cloud. who knows how long https://myopenhab.org/ will exist and how long it will be free of charge?!

This is why the openHAB Foundation was established. All the users who have a smiley face next to their icons contribute a certain amount of money each year to support the foundation. The money donated goes to pay for the cost to keep myopenhab.org and this forum up and running.

The foundation is a non-profit and as far as I can tell (I’m a voting member but don’t keep up with the traffic too well on foundation stuff since I can’t contribute too much) the plan is to offer it for free forever or until it becomes completely unaffordable which seems unlikely. Prior to the foundation being set up I believe kai et al were paying for this out of pocket.

The dependency on myopenhab.org for connectivity with external services like Google, Alexa, and IFTTT has more to do with how authentication works between the servers and not some nefarious plot. To get your cloud service to work with IFTTT, for example, you would have to go to them and get them to add a custom channel and integration for your instance of openhab-cloud which seems unlikely.

At work we started with api.ai as part of a voice business assistant we are working on. In the end we wanted something more extendable as well open source and found that in rasa.ai. I highly recommend checking it out rather then going with any of the cloud options that are all moving to a paid model. The rasa guys are also very easy to work with.

2 Likes

very interessting. i see, minimum 2eur per month. what would be fantastic is if everyone could make changes to the documentation on the fly. even without donating :slight_smile: I personally love OH, but the documentation is sometimes a mess.

No donations are required to make changes to the documentation. It’s opensource like the rest of the project. Go make a PR or file an issue on the openhab-docs project.

1 Like

sorry for this stupid question. is there a tutorial on how to create a PR?

https://help.github.com/articles/creating-a-pull-request/

At a high level:

  • fork the repo
  • create a branch for what you intend to fix in your fork
  • make and test your changes in your fork
  • commit your changes to your fork
  • on github select “New Pull request”. Reference the issue number that this PR is addressing and don’t forget to sign off “Signed off by your real name: yourrealaddress@email.com

For short and simple edits to the docs, you can edit the files right in the browser without your own fork or branch. Browse to the file on github, press the pencil icon to open the file for edit, make your changes, make sure to reference the issue the edit is intended to address and sign off.

1 Like

awesome, thanks!!