This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
Flows
Advanced HTTP Get Request for Homey (::1)
GeurtDijker
Member
Wondering myself, should the title be automation of the automation? or Requesting Homeys own API's?
I want to contribute and document the nice Advaced Geeky options of the "HTTP Get Request" in combination with Homey Self.
(I think these advanced options deserve a own thread to document them)
I will start with 3:
Get your Bearer Token somewhere, fe when you log on and select your Homey, the link contains it:
fe http://YourHomeysLocalIPAddress/?bearer_token=Deaf001000bad1000effe000hace000215c001
(everything after bearer_token=)
2) Create a flow with a Trigger (What you want, any trigger will work but you need one)
Place an "HTTP Request Flow Card" in the Then... Column, choose Type "HTTP Put JSON"
Edit the string below in your favorite editor (fe Notepad) and replace the fake Bearer token for your own Bearer Token
I use ::1 as Loopback adres for Homey, no need to change to your local Homey's IP Address. (::1 is the IPv6 equivalent for 127.0.0.1 )
URL>> {"method":"put","protocol":"http:","host":"::1","path":"/api/manager/ledring/settings/","headers":{"Authorization":"Bearer Deaf001000bad1000effe000hace000215c001","Content-Type":"application/json"}}
Choose from one of the options fr the LED ring (off, pulse, rainbow)
Option>> {"uri":"homey:manager:ledring","name":"off","options":{}}
Option>> {"uri":"homey:manager:ledring","name":"pulse","options":{}}
Option>> {"uri":"homey:manager:ledring","name":"rainbow","options":{}}
Put the URL sting from { to } (including first and last bracket ) in the URL field and the Option from { to } in the Option field.
I want to contribute and document the nice Advaced Geeky options of the "HTTP Get Request" in combination with Homey Self.
(I think these advanced options deserve a own thread to document them)
I will start with 3:
- 1st: setting the LED Idle mode
- 2nd: Restarting Homey from a Flow
- 3rd: Sending Logs to Athom ;-)
Any suggestions are welcome!1st: setting the LED Idle mode
Prerequisites:
- Homey ;-)
- HTTP Request flow cards (1.2.0)
- Your own Bearer token
- Optional: Install the extra Screensaver App ( Martens Screensaver https://forum.athom.com/discussion/1376/screensavers/p1
Do it yourself:
1) Get your own Bearer tokenGet your Bearer Token somewhere, fe when you log on and select your Homey, the link contains it:
fe http://YourHomeysLocalIPAddress/?bearer_token=Deaf001000bad1000effe000hace000215c001
(everything after bearer_token=)
2) Create a flow with a Trigger (What you want, any trigger will work but you need one)
Place an "HTTP Request Flow Card" in the Then... Column, choose Type "HTTP Put JSON"
Edit the string below in your favorite editor (fe Notepad) and replace the fake Bearer token for your own Bearer Token
I use ::1 as Loopback adres for Homey, no need to change to your local Homey's IP Address. (::1 is the IPv6 equivalent for 127.0.0.1 )
URL>> {"method":"put","protocol":"http:","host":"::1","path":"/api/manager/ledring/settings/","headers":{"Authorization":"Bearer Deaf001000bad1000effe000hace000215c001","Content-Type":"application/json"}}
Choose from one of the options fr the LED ring (off, pulse, rainbow)
Option>> {"uri":"homey:manager:ledring","name":"off","options":{}}
Option>> {"uri":"homey:manager:ledring","name":"pulse","options":{}}
Option>> {"uri":"homey:manager:ledring","name":"rainbow","options":{}}
Put the URL sting from { to } (including first and last bracket ) in the URL field and the Option from { to } in the Option field.
For the Martens Screensaver also change the uri in options, fe:
{"uri":"homey:app:martens.screensavers","name":"TIFF","options":{}}
{"uri":"homey:app:martens.screensavers","name":"TIFF","options":{}}
{"uri":"homey:app:martens.screensavers","name":"red_sleep","options":{}}
{"uri":"homey:app:martens.screensavers","name":"white_sleep","options":{}}
Other names for the current Martens Screensavers are white_sleep / white_slow_sleep / red_sleep / red_slow_sleep / TIFF / faint_rainbow / fainter_rainbow
3) Save an Test !
Happy Homey Usage!
Other names for the current Martens Screensavers are white_sleep / white_slow_sleep / red_sleep / red_slow_sleep / TIFF / faint_rainbow / fainter_rainbow
3) Save an Test !
Happy Homey Usage!
Tagged:
Comments
2nd Restarting Homey from a Flow
Prerequisites:
Do it yourself:
1) Get your own Bearer token (See Top Post)2) Create a flow with a Trigger (What you want, any trigger will work but you need one)
type {} in the second input field of the "HTTP Post JSON" card. (Default it shows an example {} but is empty! )
3) Don't forget to name the flow and Press SAVE! If you press TEST your Homey wil ..... [Timeout on Connection...]
Disclaimer:
Restarting should not be necessary, Don't just do it if you don't have problems. But with the current sometimes les stable releases or just beta apps from other developers...... it could be a workaround to schedule a restart early in the morning to have a fresh homey each dayHappy Homey restarting!
Update 2016-09-21:
This was the way to do it for advanced users ;-)From now (Soon ™) you can download a new Candy App (from version 0.4.0) and use one Action card:
https://forum.athom.com/discussion/comment/31912/#Comment_31912
and buy @MatjaLipu a beer if you like it .....
3rd Sending Logs to Athom ;-)
Sometimes you have to send Logs to Athom when something doesn't work. Shouldn't it be possible to automate this?Lets see:
Prerequisites:
Do it yourself:
You need two flows, one to send the log, the second to get the LOG ID.1) Get your own Bearer token (See Top Post)
2) Create a flow with a Trigger (What you want, any trigger will work but you need one, I have one on my Scan NFC Card with a scanned RFID)
Save it ans Name it. fe: SendLogs
Note: I also want an audible feedback (Say Something: Sending Logs!)
That card needs 4 options, so edit in your favorite editor, and paste ;-)
From left to right:
- http://url/ = {"method":"post","protocol":"http:","host":"::1","path":"/api/manager/system/journalctl","headers":{"Authorization":"Bearer Deaf001000bad1000effe000hace000215c001","Content-Type":"application/json"}}
- {} = {}
- JSONpath = result
- trigger = GetLogNr
3) Create in the Better Logic a String variable with a name fe. LastLogSend
Create a second new flow, name it fe GetLogNr, with a Trigger "HTTP Request Flow Card" in the When ... Column, choose Type "Get Variable step 2". Enter GetLogNr as the "Trigger from step 1".
"Get Variable step 2" has a token <Value] that contains the result of the post to Homey. in this case the Log ID you have to send to Athom to investigate your logs to research the problem. I like it to get this as a Push Message, and in case I send logs using my NFC card i like a spoken message. As last I like to save the Log ID in the BetterLogig variable LastLogSend. This way the Better Logic Settings shows it including the date and time I send the logs even after a reboot.
Use whatever you like in the Then... colomn. You could probably also send an email ;-)
I don't know if it happens ( in some future or not yet discovered bug) that I am not able to log on to Homey, but Homey is still able to communicate with the Athom Log receiving server and Homey is able to trigger the flow using my NFC card..... Then I will still be able to send my logs
(Sorry Athom for sending several logs without msg about problems, I had to know if this was possible and to troubleshoot the building of this Flow!)
Created a flow that should reboot daily at 2am.
Used a HTTP Post JSON card with this in the first field
Second field has {} in it.
When I test it, I get "Cannot read property 'indexOf' of null"
I guess I was not clear by inserting URL>> before the actual string. That came from my RAW notes,
Put the URL sting from { to } (including first and last bracket ) in the URL field! ;-)
Thanks!!
Lot of people with the red ring lately, I don't think they all used this method...
My Homey Flow Backup is still working (a .jpg with screenshots of all flows ) So its not a big deal.
Jep maybe they can reproduce it. I followed your steps, but it resulted in a the booting animation (orange ring) for over 10 minutes, then i powercycled. After this the red ring appeared shortly after the booting animation.
When I tried to restore without wipe the same occured: first a neverending booting animation, then a powercycle followed by the RROD.
I am struggeling to find a solution.
I am using Domoticz with Imperihome on a tablet, now I want to create a button that can trigger a flow, I already know how to configure and use the "HTTP request flow cards app" in Homey.
I first tried to create a few examples and got the "reboot example" to work, within a flow itself, but what I want, is to use a line of code in Imperihome, It has the option to create a generic widget that will execute a HTTP request, and that is exactly what I need, but I need some help..
Thank you @GeurtDijker for these examples!
Thanks in advance fellow Homey's!
Pauluz
but in my Example ::1 is the shortest notation for localhost or 127.0.0.1 the looback IP address
From another host you need the IP address of your Homey
But i have no experience with imperihome and widgets.
I hope someone more experienced with Imperihome and Widgets will respond and point me into the right direction.
That would be a possible solution,
an other option would be:
Enable ssh server on your pc and use the ssh app on Homey. (didn't test)
Link to thread:
https://forum.athom.com/discussion/5266/wake-computer-from-sleep-using-homey
The thing I'm missing is Homey's IFTTT app to execute the soundcloud URL. Would this HTTP request solve it and if so, how?
My applet in IFTTT looks like this:
If anyone I follow on soundcloud trigger "Homey" IFTTT card
The IFTTT applet has 3 variables whereas one is the track URL - {{TrackUrl}}
The trigger card in Homey import those 3 variables as a tag.
Could I use the tag {{TrackUrl}} to request the URL with this HTTP request app?
N00b here
Thanks!
Did you figured it out yet? If not, can you add some screenshots of the flows you try to get to work?
What URL do you want to request?
You are able to use tags in flow card parameter fields: