Page 1 of 2
Autohue
Posted: 21 Jan 2015 20:58
by ninjawil
Hi,
I am having trouble trying to pass variables to autohue plugin. It's a tasker plugin and I tried editing the job command but had no luck.
The plugin performs OK until I try override settings. Even without editing any commands once I enable this overide it does not work.
Any ideas?
Thanks
Will
Re: Autohue
Posted: 23 Jan 2015 09:30
by Martin
Hi,
Unfortunately I don't own any Hue lights to really test the plugin.
Is there anything in the log of Automagic when you enable
Debug Log in the preferences of Automagic and execute the action with
Override settings checked?
When you check
Override settings but don't modify the default script at all, does it work or does the action also fail?
Could you post a configured action with a default script in the forum or send an example flow to
info@automagic4android.com?
Regards,
Martin
Re: Autohue
Posted: 25 Oct 2017 10:29
by drboa
Dear all,
I realize that I am 2 years late but it makes me confident that there is a solution to the AutoHUE problem somewhere in the community. I purchased it yesterday and like previsous author I can also not extract variables from it or post any variables to it. Has someone found a workaround yet!!?
Many thanks for a swift reply!
/B-O
Re: Autohue
Posted: 26 Oct 2017 13:23
by Desmanto
If it seems there is no way to pass/extract variable, you can only make your own multiple choices then. Only partial variable passing.
You can create a set of the plugin action with certain value and use parallel expression to split them. Example if you have variable IPaddress as 192.168.1.100, 192.168.1.101, 192.168.1.102 etc. Then you have to create multiple parallel expression to check each of them.
Expression : IP = "192.168.1.100";
Plugin : Autohue, and set the IP 192.168.1.100 manually in the action.
Each IP with one expression and one plugin action. In the end you will have a lot of them. That makes up a huge flow, but it is the only workaround.
And also the downside is you don't have the feedback, as you can't extract the variable out.
Re: Autohue
Posted: 27 Oct 2017 09:41
by drboa
Hey Desmanto!
Many thanks for your reply - I like your posts, they are generally very useful. When it comes to AutoHUE, I have had 24 more hours now to experiment and it seems to be a bummer with Automagic unfortunatley. I do not know if the use of curly brackets in the json syntax is conflicting with the curly brackets in Automagic (that represents a variable with dynamic content) is the reason or not. True is; neither "Hue Bridge Info" not "HueState" deliver any values to a debug dialogue immediately under.
I have put the Hue Bridge on a static IP so that I eliminate problems related to dynamic IP address assignments... Nothing works unfortunately. I'm thinking about to fire up my old tasker and code the home automation explicitily in it, but it is really my last resort... I like Automagic much better for a thousand reasons - this is the first serious setback and I think that with an increasing drive to automate things in the living environment, a solution from Automagic and/or AutoHUE has to be worked out shortly...
/B-O
PS. if you have any other on this topic - let them flow!!!
Re: Autohue
Posted: 27 Oct 2017 09:47
by drboa
Dear Martin,
Many thanks for your reply!! It only works if I run it in simple mode. If I check the box "modify json" BUT leave it unmodified - it already ends in an error!!!
I'll enable debug logging and send you a screen dump on your email tonight. I really appreciate your help because to me it is frustrating and (as mentioned in my previous post above) I really do want to stay with Automagic...
Many thanks in advance and please keep your eyes out for my email!
Best regards / B-O
Re: Autohue
Posted: 27 Oct 2017 15:48
by Desmanto
drboa wrote:Hey Desmanto!
Many thanks for your reply - I like your posts, they are generally very useful. When it comes to AutoHUE, I have had 24 more hours now to experiment and it seems to be a bummer with Automagic unfortunatley. I do not know if the use of curly brackets in the json syntax is conflicting with the curly brackets in Automagic (that represents a variable with dynamic content) is the reason or not. True is; neither "Hue Bridge Info" not "HueState" deliver any values to a debug dialogue immediately under.
I have put the Hue Bridge on a static IP so that I eliminate problems related to dynamic IP address assignments... Nothing works unfortunately. I'm thinking about to fire up my old tasker and code the home automation explicitily in it, but it is really my last resort... I like Automagic much better for a thousand reasons - this is the first serious setback and I think that with an increasing drive to automate things in the living environment, a solution from Automagic and/or AutoHUE has to be worked out shortly...
/B-O
PS. if you have any other on this topic - let them flow!!!
Automagic curly brackets will be evaluated to variable if you use double quote. To force literal curly bracket, use single quote. But I don't know if It works properly in the plugin.
Unfortunately I don't have the light bulb to test it out. But a deep search on the plugin, there are others also have problem dealing with the variables. It seems you can use HTTP GET to retrieve data from the hue bridge.
https://developers.meethue.com/content/ ... ther-usage
I still don't know the bridge and light bulbs work, what is the protocol of the hue bridge and how it communicate to the lights. But if you need only to communicate to the bridge only to control other lights, and the connection can be done in HTTP; then you actually don't need any plugin at all. From the link above, it stated that the response is in JSON. If it is the same with yours, then everything is very easy now. Since automagic is very JSON-friendly.
Simply take the JSON (from the response of HTTP GET) and parse it using fromJSON()
The result is map value {hue} which you can use to extract certain variable. It is a nested map, so you have to dig down to the value. In example
Code: Select all
state = hue["state"]["on"];
color = hue["state"]["ct"];
model = hue["modelid"];
Based on the sample JSON, state = true, color = ct, model = LTW001. You can try to use condition debug dialog to check the result of the map {hue}.
For the HTTP part, I think maybe you have the documentation somewhere in the manual book, where it allows you to control it via browser. If yes, then you can use Chrome developer tab to check the http uri sent, and you can mimic it later in automagic. You can mimic from how to sent the command, how to retrieve the state. As long as it can be done from browser, you can do it in automagic.
Re: Autohue
Posted: 28 Oct 2017 17:19
by drboa
Dear Desmanto!!
You are a fantastic guy... ...or girl or cat - nevertheless a great asset for this forum!! With your nice hints I managed to resolve ALL problems regarding Philips HUE bulbs and am quite astound about my achievements. I realize that there are not so many followers on this thread - maybe the solution is obvious to everyone else!!? If not, I will shortly recapitulate what has to be done and in what sequence:
1) Put a static IP on your bridge (details are available in the users manual!)
2) unlock it for "development" by creating an "authorized user". Follow the "recipe" on this page:
https://developers.meethue.com/document ... ng-started
3) Retrieve the APK key!
4) Test it by turning on your first lamp. In Automagic, the nomenclature is as follows:
a) Create a new task - leave the trigger empty for now
b) Tie a Script to it with the following syntax: data = newMapFromValues("on",true);
c) Tie an HTTP Request action to it with the following features: Name (as you wish), URL:
http://localIPAddress/api/APKkey/lights/1/state (example:
http://192.168.1.100/api/aselfiuhreliuz ... ts/1/state), method: PUT, content type: text - text/plain, Data: {data,jsonformat}, Timeout 5s, save to variable, call it command, option: check "follow redirects".
Once you have completed that and established contact, querying the bulbs with method: GET is as easy!!! Just to be sure: (example:
http://192.168.1.100/api/aselfiuhreliuz ... 5/lights/1), method: GET, Timeout 5s, save to variable, call it response, option: check "follow redirects".
Good luck on everyone - Desmanto gets the cred!
/B-O
Re: Autohue
Posted: 28 Oct 2017 17:36
by drboa
Hey Desmanto and all!
I have a remaining issue that I hope I may trouble you with.
I have purchased a program called "Triggers". It installs on my Samsung Gear S3 watch and communicates with my telephone Samsung S7 Edge via IFTTT's "Maker" platform (nowadays called "Webhooks"). The phone now (commanded by my watch) sends an HTTP command in the following syntax:
https://maker.ifttt.com/trigger/toggle_ ... ey/API_key (the latter is my personal api that got issued by the registration of the webhooks service by IFTTT.
The "toggle_lamps" embedded syntax does exactly that; toggles all my hue lamps. It works, but!!!!!! I would want Automagic to intercept this https-post via the "general broadcast" trigger so that I would no longer need IFTTT. I just cannot figure out how to make it work... ...does anyone have an idea!?
Many thanks in advance for your kind support!!
/B-O
Re: Autohue
Posted: 29 Oct 2017 04:59
by Desmanto
Hi drboa,
Nice sharing. It will be useful for other users, as googling "Automagic autohue" will lead to this thread. I just know that the hue dev has a great documentation for their protocol. I believe every dev who has a great documentation should be rewarded by having the users posting tutorials on how to integrate their API to other 3rd party apps.
I used to be guy before transformed into a cat.
That's my avatar for a long time, since the first time I active in other forum several years ago; kinda like my own signature/mark. It is easier for others to spot my posts.
===============================
IMHO, IFTTT is too slow. Latency is several seconds. Since the request will be sent to their server and bounce back to our phone. How do you use the app on Gear S3? Is it constantly connected via bluetooth to your phone? Or does it connected to the wifi/3G?
AFAIK, the app use connection from the bluetooth, to ask the app on phone to send request to their server. If it is so, and you have root; you can redirect the dns to localhost. Adding something like maker.ifttt.com 127.0.0.1. Then in automagic, create a Trigger Http request, where Automagic act as the replacement for the server, and process the variable. Not a practical workaround I think.
If your Gear S3 and phone always connected to the same wifi when you needed it, you can find some app that can send http request to local address. Use the same HTTP request trigger to process the command. Gear S3 will post request to the phone as event.
Or if Gear S3 is capable of play/pause music, sending the media key event thru the bluetooth to the phone; you can use Trigger Media Button Event to catch the event. The downside is, you won't be able to use the real function of the media button (to play/pause the music).