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.

[how to] Replace Apps by scripts

I'm not sure about you guys but the number of apps I'd like to use is much larger than the number of apps Homey can handle... reliably 
The driver apps are a hard requirement, obviously but the other apps can sometimes be exchanged

I thought it might be a good idea to list these workarounds and share with the community, if you have any please share as well  

The below is the workaround I use to replace the Simple Log / Paper Trails functionality, the requirement  are :

- A web server  (Personally I use a Raspberry Pi 3 for this)
- HTTP Requests App
- Better Logic (optional) 

Start by putting the below PHP script on the webserver, and prepare the logs folder 
https://gist.github.com/Radiotechniman/2fd57f82e51e033035fa0620d30580c7

Then create a variable either in Better Logic or through Homey, I called it "ADD_Log" 
Next I created the below flow : 


Please note you can have multiple logs if you set the "'l" (lower L) variable  

To add something to the log I add a "Set String Variable" to the flow that needs to be checked: 

 
Personally I like SSH to view the log (tail -f /location/of/file ) but any text editor can be used 






Comments

  • Thanks! Good idea and initiative !
  • Thanks, my homey forces me to do this stuff unfortunately.. 
    Anyway, I have an other one the trash collection app, nice but it takes room, the below script will allow you to script something similar. 

    Requirements are the same as the above so I won't list them here 
    next you need two files located here : 
    https://gist.github.com/Radiotechniman/30698fb2c2e0fe3ecb30c876a02f7f31

    These need to be saved on the php server and the trash.json file needs to be filled with the dates that the trash is picked up in your city..  I used excel/google sheets to do this quickly  
    Next, and this is optional, you can update the kliko.php with your names for the kliko's, I used the dutch words 
    Once that is done go into Better Logic and create 2 new variables, i called them "Kliko_vandaag" & "Kliko_morgen"
    and created the following flow with 2 "GET JSONpath Better Logic" (one for today & one for tomorrow) 

    In the first field put the <url to the kliko page>" in the second enter "$.vandaag" and in the last the corresponding BL variable.
    Lastly I let it run just after midnight so the variable is updated in time for me to use it in the morning  





    Last step is to make the other flows that will use the two variables, but i'll leave that up to you
           
  • technimantechniman Member
    edited March 2018
    Since Buienradar has an open API I created a page/script for that as well.  
    Requirements are the same as the above so I won't list them here 
    next you need to save the following file to your server :
    https://gist.github.com/Radiotechniman/019be9126ab1af1f2bcaba3b6023fc93

    Next have a look at the file and optionally update the "rainthresholds" and or "lat&lon" values 
    once that's completed, I'd advise you to call the URL to see that it works :-) 

    Please note you can call the page with "http://ipadres/buien.php?lat=xxx&lon=yyy" that's why the above is optional
    The page will give you a JSON file with the data; 

    Location: I could not find any way of extracting homey's location, since I need it anyway I might as well expose it for future use.
    Bool: selection of boolean values, might be handy  
    RainBy: amount of rainfall in mm/h , for current 60 minutes (hour), next hour and by minutes as of now   
    SeverityLevel:  a rain level from 0 to 4,  I used the same as on the website 0 = 0-2 / 1= 2-5 / 2 = 5 -10 etc.  
    HomeyQuestions: should speak for them self (see what I did there;-) )



    another example but with the minutes & homey's responses



    If there is enough requests I might add the other questions as well 

    Please note the website is updated every 5 minutes, so there is no need to refresh the page more than that
    As how to plug this into homey. .
     
    I created a flow and run it every 5 minutes,  in the action column add a "GET JSON trigger object" card from the http app. 

    Next create the betterlogic variables you want to use and then make a new flow with a "JSON object" trigger
    and the "JSONpath Better Logic" action where you specify the complete path 
    e.g.
    $.homeyquestions.whenstart
    $.homeyquestions.whenstop 



    Lastly create the "question" flows, otherwise it won't work  :-) 

Sign In or Register to comment.