HA automation: sleep as android + tasker

Hi,

I’ve read this archived discussion on Reddit and I was wondering if anyone can help me setup an automation that starts when I go to bed and open sleep as android.

I would use it to shut down my nas, my hue lights etc.

Thank you in advance!

Do you still need help with this? If so, what have you done so far? While I am new to HA, I have a decent grip on Tasker and also use Sleep As Android, so maybe I can help in some way.

I will appreciate your help!

My goal is to create a “go to bed animation” involving:

NAS (shutdown my synology DSM)
LIGHT (switch off all the lights if are still on)

Then I don’t know if sleep as android can be used for also for the wake up…I mean like waking up light based on the alarm on the smartphone.

Is this possible?

Sure, that certainly sounds possible. Sleep As Android has a number of Tasker profile triggers, including going to sleep, waking up, and everything in between. Read more about that on their website here: Automate Sleep with Tasker.

In fact, on that webpage, they have a series of walkthroughs on how to set up a number of Tasker automations using their app. Once you get the Tasker side working, the next step would be to connect it to HA. I haven’t done that yet, myself, but I’ve noticed many people use REST API calls to fire events in HA from Tasker. Here is an example.

1 Like

hey did you make it possible to run? i would like to do the same
i have tasker and sleep as android but im completly new to tasker

Sure, I use it on a daily basis.
I’m using a tasker task which triggers whenever I put my phone on the wireless charger next to my bed. The task starts a sleep task in Sleep as Android and the sends a http post command to my Home Assistant which triggers a script. The script announces my next alarm time and the time untill the next alarm, initiates my night mode (lights off, pc off, etc.) and then starts playing a lullaby with gently decreasing volume every minute :lol:.

Wakeup script can also be triggered through Tasker. Use sleep as android alarm as trigger event, then start your wakeup light script through http post. Take a look at this post for my setup: Creating a alarm clock

1 Like

nice one but how did you set up tasker?
tasker->new profil->event->plugin?

is there any tutorial to set tasker up like this?

Wow!

Can you share your config please???

@Tolaxor @Jokerigno did you take a look at the link I posted yesterday?

Perhaps I should open up a “Share your projects” topic for this but there allready is an alarm clock topic (which I started with to begin with ;)).

Yup thanks but i still need to figure out how to set up tasker. :joy:

I posted a link earlier in this thread that explains how to set up Tasker to work with Sleep As Android. Read through that and let me know if you have any further questions.

hey so i set up tasker: Event -> System -> Intent received: action: com.urbandroid.sleep.alarmclock.SLEEP_TRACKING_STARTE
->new task: (called Alarm) and configuration: start sleep tracking

am i missing something or can i continue with home assistant?

1 Like

ok got all set up so far i used the tasker video from
BRUH Automation

Hey,

after a decade I finally managed to setup my first automation with tasker= when start sleep tracking, switch off all lights.

Now I think I have to study more to personalize it!

Thank you!

Could you please share the steps?

@fversteegen use the example provided in this post and modify the Path and Data to fit your needs, then apply the Event Sleep plugin as your profile and configure whichever event you want from sleep as android. Use the services tab to test what you want. Maybe easier to do a script depending on what you want to do.

Also, this was linked earlier in this post :wink:

2 Likes

Sorry for resume such an old post, but what i want to do is to start all the routine with google home. I want to tells my google home to set my alarm at a specific time but using sleep as android for alarm and not the google alarm. Is that possible?