Telling Google Home good night should start sleep tracking

Hi, guys.
You can do it via app called Tasker.

So I’m currently programming a bot for Google assistant, and while this defiantly would be possible to add in and potential isn’t actually that hard, it has some drawbacks.

Google Assistant only really allows integration through external bots, and apps cannot be linked into default commands. Therefore, commands like “set an alarm for X” or “good night” or even “start sleep tracking” wouldn’t be possible, as far as I can tell. The best alternative could still be “tell sleep as android to start tracking” which isn’t too bad. Maybe a better name than sleep as android for the Assistant module may be needed because I’m not sure if you can have the word “Android” in a bots calling command, however this wouldn’t be too hard to implement.

1 Like

Hello Daniel, may I use your expertise here. The issue I see is how to tell the SaA app on your phone that the users did issue the command. The app is designed as offline and there is no authentication. So we would need to have some could service which is called though the assistant and than somehow direct a cloud messaging message to all devices of the users and see if on one of them SaA is listening. But I’m not sure if we can even somehow pair the users? Do you have any idea how this could be done?

1 Like

I think what you are looking for is the “app actions” integration, however I’m not entirely sure if that is suitable.

Hypothetically, it should just be an extension of the app, and from what I can tell (I haven’t used this specific Assistant tool before), it should do what you intend. You can definitely set it up so a user can use Google Assistant to start sleep tracking. The only thing I can’t figure out is if this works across devices, so that a Google Home could be used instead of a phone itself. If this isn’t something you’d want, then this is probably what you need from what I can tell.

My knowledge is mainly in the conversational aspect of Google Assistant, being able to communicate with a backend webhook server. You could quite cheaply and easily setup a webhook server that could handle what you need to do and more. Google have a free service a a part of Firebase which allows for almost instant communication between a server and devices. It’s preauthenticated through Google, and is trivial to implement into the webhook server.

If you want to discuss this in more depth, a better way to contact me would probably be Discord, due to substantialky quicker responses, but I am always available here. Discord: @DanPerks#6755

Actually my “home” works pretty good. I am using TP-Link lamps and wallplugs, wich i can controll with “ok Google” … blablabla …

So actually I use "ok google, turn off the light ( or turn off everything ) and start sleep "
Then I only have to tap the “start sleep tracking” button.

I dont know if there allready is a option to start sleep tracking automaticly when the app starts, but if there is not, then it would be a nice option to have, cause this would solve most problems i guess.

I guess you got it wrong. We are looking for a solution, and not for a workaround. But thx for the idea.

I am sorry to resurrect an old thread, but wanted to comment. I’m actually trying to figure out how to do this again on my new phone, the old one just bricked and I had it all set up there. I should have copied over the steps or written a guide. But here’s the elements of what I was doing to get it to work. Perhaps someone can comment with more details.

Was using a combination of IFTTT Webhooks+Google Assistant, to send and Autoremote message that triggered Tasker and started sleep tracking.

I would say “hey Google” “it’s time to crash” and that would trigger IFTTT with Google Assistant+Webhooks, to trigger my Autoremote URL message, which Tasker was set up to see and trigger the start sleep tracking plugin.

Hopefully that helps. I’m trying to remember how I did it, and where I found the steps to get it done and can’t anymore. It was Reddit somewhere I believe. I’m most of the way there but can’t get the Tasker profile set up properly… Anyways, if anyone can use that data and then fill in my memory it would be appreciated, I’m sure, by the whole community.

And when I say Google Assistant, I mean Google home as well, since you talk to the Assistant through GH.

cheers

Oh yeah, once you set up your Webhooks+GA trigger phrase in IFTTT you can add that phrase to any routine in Google Home, and it subsequently triggered sleep tracking through the method I just described. :+1:

Google Assistant now offers native Shortcuts to perform app actions on devices. If Sleep as Android exposed its Start Sleep Tracking (and any other) actions as Shortcuts, this would be easily possible to add to a Google Assistant routine without having to go through Tasker or Automate.

2 Likes

@jiri-urbandroid Should we wait for this integration anywhere soon?

I’m waiting for this feature too.

Maybe Sleep as Android app could have setting?

Where you could choose if sleep tracking starts automatically or not when app is opened…

That would make it pretty easy to use assistant for sleep tracking…

App should have setting if tracking starts automatically or not when app is opened…

Pretty simple solution?

Edit: didn’t think that all the way through, what comes to those who uses smart speakers etc…

But would be useful option for those who uses assistant on phone to start tracking automatically when app is opened…

Looks like there’s Assistant integration now based on the March 10 release notes, not sure how to get it working though.

Looking at the release notes, I can’t understand how to use it. Documentation doesn’t have anything as well.
Was anybody able to get this working?

1 Like

Nothing unfortunately. Any feedback would be appreciated.

It’s possible to set it up. Just it is quite difficult. I talked about how to do it here.

1 Like