I have made a working concept for connecting the homeassistant to firebase which allows for google assistant integration and would allow for a remote web interface that would not require to expose your homeassistant, but would work only with firebase triggers. Firebase would act as a bridge in this instance between google assistant and homeassistant, or web and homeassistant.
The code I made is a concept, and I did not look for the best solution here, just the easiest for me, to see if this could work, and surprisingly it works really well for me.
Code for a component is here:
First step would be to create a new project in firebase console and generate a new private key under Project Settings -> Service account.
The generated .json file you would add to your configuration folder.
The component needs firebase_admin to work, so to install it:
pip install --upgrade
Then to configure it, it requires you to add the configuration:
google_firebase_store:
credentials_json: <the json file you downloaded from firebase>
web_token: <your homeassistant bearer token>
filter:
include_domains:
- switch
- device_tracker
- input_boolean
- input_number
The include domains states all the entities you want to sync.
Then you have to create firestore database on firebase web and there two collections: homeassistant and triggers.
After the restart homeassistant syncs all included entities to the firebase. The update is realtime, so anything you do on homeassistant you can see here. That would allow you to generate web page to manage homeassistant remotely.
But onto the other part, the triggers.
I also made a triggers that would turn on any input_boolean that has any changes in triggers database.
So if I create input_boolean.tv entity on homeassistant then the trigger would look like this:
And any change to the state field turns on the input_boolean.tv
This could be made for any entity, just some more coding is required. Therefore if a web is made this could also be allow for remote triggering. I have tried this, and as far as I can say, the triggers are really fast since the triggers are done in realtime.
As for the Google assistant integration, google has made a nice tutorial how you can connect your Google assistant to your firebase and manage the devices.
https://codelabs.developers.google.com/codelabs/smarthome-washer/
This actually saves the the state of the device to the firebase, and with the concept I made it could trigger homeassistant devices. Only difference here in this example is that this example uses realtime database, and I made the triggers on firestore, but his is easily changed in cloud functions. My guess also is that the new local fulfilments could be also added that way on homeassistant to work locally with nest devices:
https://codelabs.developers.google.com/codelabs/smarthome-local
but for me this local fulfilment used too much bandwidth and in 10 days it used up all my free plan, but I probably did something wrong here.
The code for the google assistant integration I will not put here as all I did was to modify the tutorial, and everything is hardcoded for my case.
What needs to be added is better triggers and modifying the firebase functions to use the devices that were synced from homeassistant and to trigger them properly.
Also the hosting allows for remote triggering, but this could also be an optional stuff, since you can upload the firebase functions without the hosting.