"Quick Settings" Toggle Tiles by Tasker on Android

Nope I m not using any proxy. I was telling hoping for this to work.

Unfortunately not. Didn’t spend much time on it either. I remapped my Bixby button in the meantime for my purpose :slight_smile:

Oh how did you do that?

I got the s9 plus and have turned off the Bixby button. Might as well make use of it now.

7 posts were split to a new topic: Tasker and the Bixby button

Does this work with Android Pie?

I can confirm that this works with Android Pie

it amazes me that the hue android app doesn’t allow you to create a simple toggle, aka light switch, widget. I solved this by creating a tasker quick setting but your solution is better because it shows the current state of the light. Works well. Thank you

This is very very cool, I finally managed to have it working.

Is it possible to have more than one Tasker quick settings? I managed to have one but not able to add more

Did you try switch or light?
To me it worked with switch and light, but not with input_boolean (haven’t spent to much time though)

Same here, did you get it to correctly execute somehow by now?

Additional error I get from Tasker:

Failed to execute ‘send’ on ‘XHTTPRequest’: The objects state must be OPENED.

I think there may be some problem with the POST? (but double checked everything)

I’m also using https.

I can’t get this to work. Could it be that API username is not defined?

I tried to implement this but I think it’s causing issues because of the new AUTH system used by HA?
Any quick fix or should we rebuild function using this Tutorial: Using the new Auth system with tasker

I haven’t yet used the new auth system, but remove the ?api_key=xxxxxxxxxx from the end of the address from the previous instructions.

Replace:

var xhttp = new XMLHttpRequest();
xhttp.open = ( "POST", url+address, false );
xhttp.send(body);
var result = JSON.parse(xhttp.responseText)[0].state;

With:

var xhttp = new XMLHttpRequest();
token= 'Bearer ' + global('xxxxxxxxxxxxxxxx');
xhttp.open = ( "POST", url+address, false );
xhttp.setRequestHeader('Authorization', token);
xhttp.send(body);
var result = JSON.parse(xhttp.responseText)[0].state;

(note the API key is now inside the token parameter as per the linked tutorial)

1 Like

@fanuch
Thanks, it’s working partially now.
The light switches but the %results value is empty therefore I thought it didn’t worked at first.
Gonna do some reading how to have that fixed.

/Edit
I think I’ll do a GET straight after the POST to get the actual state.

Excellent @schumi2004!

As per the guide, see if you get a result on this place at the end of your request:
flash(xhttp.responseText);

It’s possible the response is under a different label/array.

Hi!

do I need to have a raspberry pi to use this?

I’m trying to get a quick setting tile to toggle my lights on/off but I only have my phone, tasker, some autoapps and the smart light switches and nothing else.

Is it possible?

Thanks

No, where did you get that idea?

You need an Android phone with Tasker, and be running Home Assistant with API access.

What you’ve described is the entire point of this guide :slight_smile:

I wasn’t sure if everything on this site was based off of a raspberry.

How do I run Home Assistant on my phone and get API access? Is it the HA app in the play store?

I’m a mega noob at this stuff and understand very little

Thanks

Based on your response I would highly encourage you to read through the documentation.

One of the best things about Home Assistant is the very well written manual and examples.

Here is the API guide

I am trying to make it work with the new auth system using a token. I used the replacement that @fanuch wrote above. But it still doesn’t work. Did you make any other changes? I can’t even get it to send a command to HA, much less get the state. Are you able to export your working setup?